sapdev logo background
sapdev logo sapdev logo
Comments

SAP OO OBS STRUCT 1 documentation, setup help and example usage



Return to SAP documentation index


INCLUDE
ARTICLE

No Obsolete Casting for Interface Parameters

In ABAP Objects the construct STRUCTURE for defining the types of formal parameters in procedures is not allowed. The only procedures allowed in ABAP Objects are methods.

  • In ABAP Objects, the following statement causes an error message:


  • METHODS meth IMPORTING p1 STRUCTURE struc.
  • Correct syntax:


  • METHODS meth IMPORTING p1 TYPE struc.

    or

    METHODS meth IMPORTING p1 TYPE ANY.

    METHOD meth.
    FIELD-SYMBOLS TYPE struc.
    ASSIGN p1 TO CASTING.
    ...
    ENDMETHOD.
  • Reason:


  • Formal parameters whose type is defined with STRUCTURE are a mixture of parameters with types and parameters for which there is a casting for data types defined in the ABAP Dictionary or locally in the program. The types of the field symbols are defined with the TYPE addition. Local field symbols and the ASSIGN ... CASTING statement can be used for the casting.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    OO_OBS_STRUCTURE_1
    OO_OBS_STRUCT_DEF_1




    comments powered by Disqus