SAP OO OBS STRUCT 1

Get Example source ABAP code based on a different SAP table
  


ABAP Code Snippet
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.