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
Types 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 afterLIKE
in Function Builder. The typing check is the same as when specifying components afterTYPE
, with the exception that the decimal places are 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. In the case of a structured actual parameter, this parameter must be at least as long as the formal parameter:
- In the case of a structured actual parameter, its
fragment view must match the fragment view of the corresponding initial part of
struc
.
- An elementary actual parameter must be character-like and flat and the corresponding initial part of
struc
can contain only components of this type.
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
-
Only TYPE should be used 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 withTYPE
. If a casting is necessary, generic formal parameters should be used and assigned to field symbols using the statementASSIGN
and the additionCASTING
.