Ansicht
Dokumentation

ABENEQUALS_RETURN_VALUES - EQUALS RETURN VALUES

ABENEQUALS_RETURN_VALUES - EQUALS RETURN VALUES

ABAP Short Reference   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

=, Assign Return Values and Results

destination = meth( ) $| func( ) $| constr_expr $| table_expr.

Effect

If one of the following calls or expressions is specified on the right side of the assignment operator =, their return value or result is determined and assigned to the left side, destination. If necessary, type-dependent conversions are performed in accordance with the conversion rules. The following items are possible on the right side:

  • A built-in function func( ). The type of the return value, which can depend on the data type of the argument in some numeric functions, must match the type of the left side.
  • A constructor expression constr_expr. The type of the result is determined by the type specified for the constructor expression and must match the type of the left side.

The following can be specified for destination:

  • A variable that is compatible with the return value or result, or in whose type the return value or result can be converted.
  • An inline declaration DATA(var) or FINAL(var). The data type of the declared variable var is the statically known type of the return value or result. If an offset/length specification is applied to the result of a chaining where a constructor expression or a table expression is involved, the data type of the declared variable is the data type of the result in its full length and not in the length of the substring.

Note

If an arithmetic expression is specified as an argument for one of the overloaded numeric functions, the function itself works like an arithmetic expression and its assignment is one of the assignments of arithmetic expressions, which can cause a different order of conversions.

Example

Assignment of the return value of a method to an internal table declared inline.

METHOD m1.
  DATA(itab) = m2( ).
  ...
ENDMETHOD.

Example

The example shows different results when assigning offset/length specifications to inline declarations. The first offset/length specification is directly applied to a data object and the resulting data object has type n of length 2. The second offset/length specification is applied to the result of a constructor expression and the resulting data object has type n of length 8. The last output shows, that the data type of the substring is used at runtime when passed to a method.






ROGBILLS - Synchronize billing plans   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 4855 Date: 20240329 Time: 020339     sap01-206 ( 97 ms )