Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete modularization →  Function Modules 

FUNCTION - LIKE, STRUCTURE

Other versions: 7.31 | 7.40 | 7.54

Obsolete Syntax

...  {LIKE struc-comp} | {LIKE struc STRUCTURE struc} ...

Effect

Typing of interface parameters in the display of the properties of the interface parameters of a function module interface in the source code of function modules, when the type is specified using LIKE in Function Builder. Specifying the type in this way now produces a warning in Function Builder.

  • A typing using LIKE is displayed if an elementary component of a flat structure (or database table or view) struc-comp from ABAP Dictionary is specified after LIKE in Function Builder. The typing check is the same as for the specification of components after TYPE, with the exception that the fractional portion is ignored for packed numbers. No types from a type group can be specified.
  • A typing using STRUCTURE is displayed if a flat structure (or database table) struc from ABAP Dictionary is specified after LIKE in Function Builder. This structure is then forced on the formal parameter (casting), and it is possible to access the individual components. The Unicode fragment view of a structured actual parameter must match that of struc (in table parameters only across the length of struc); an elementary actual parameter must be character-like and flat. No types from a type group can be specified.

If a component of a global program structure in the function group of a function module has exactly the same identity (structure name struc and component comp) as the component of a structure in ABAP Dictionary specified after LIKE, LIKE refers to the component of the structure defined in the function group. This leads to a warning in the syntax check.


Notes

  • Use TYPE instead of LIKE in Function Builder; this is always displayed as TYPE in the source code. Furthermore, TYPE always relates to types in ABAP Dictionary and never to local types of the function group.
  • Formal parameters typed with STRUCTURE can usually be replaced by formal parameters typed with TYPE. If a casting is necessary, generic formal parameters should be used and assigned to field symbols using the statement ASSIGN and the addition CASTING.
  • In obsolete non-Unicode programs, it is enough if an actual parameter is aligned correctly (in pass by reference) and its length matches the length of the defined structure struc exactly (except in the case of table parameters). Problems can be caused here by the missing check for closing alignment gaps, for example when the actual parameter is filled by the content of an alignment gap in a way that is not type-compliant.