SAP FORM STRUCTURE ABAP Statements

Get Example source ABAP code based on a different SAP table
  



FORM - STRUCTURE

Short Reference
• STRUCTURE FORM (obsolete)

ABAP Syntax(Obsolete)... STRUCTURE struc ...

What does it do? A formal parameter p1 p2 ... of a subroutine can be specified with the addition STRUCTURE instead of typing, where struc must be a program-local structure (data object, no data type) or a flat structure from the ABAP Dictionary. This structure is then applied to the formal parameter ( casting) and individual components can be accessed in the subroutine.

When passing an actual parameter to a formal parameter typed with STRUCTURE, the only check executed in non- Unicode programs is whether the length of the actual parameter is equal to or greater than the length of the structure.

In Unicode programs, there is a difference between structured and elementary actual parameters. With a structured actual parameter, its Unicode fragment view must match that of struc. With an elementary actual parameter, it must be character-type and flat.



Latest notes:Formal parameters typed with STRUCTURE can usually
be replaced by formal parameters typed with TYPE or LIKE. If a casting is necessary, generic formal parameters should be used and assigned to field symbols using the statement ASSIGN and the addition CASTING.



Example ABAP Coding
This example assigns the character string text
the structure line. DATA: BEGIN OF line,
col1 TYPE c LENGTH 1,
col2 TYPE c LENGTH 1,
END OF line.

DATA text LENGTH 2 TYPE c VALUE 'XY'.

PERFORM demo USING text.

FORM demo USING p STRUCTURE line.
cl_demo_output=>display_data( p ).
ENDFORM.

Return to menu