Wir wachsen stetig und suchen neue Kollegen (m/w/d)! Schauen Sie sich unsere offenen Position an, um eine passende Herausforderung zu finden!
You can replace the source field in a MOVE statement with a functional method call. Functional methods are methods in
ABAP Objects that can have any number of IMPORTING parameters but have exactly one RETURNING parameter.
Depending on the number of IMPORTING parameters, the following options are available:
In variants 2 and the CALL METHOD statement is used to pass the actual parameters to the method's IMPORTING parameters.
When the system executes the MOVE statement, it calls the method meth and assigns this method's return values to the target field g.
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-METHODS M1 RETURNING VALUE(R) TYPE I.
METHODS: M2 IMPORTING N TYPE I
RETURNING VALUE(R) TYPE I,
M3 IMPORTING N1 TYPE I
N2 TYPE I
RETURNING VALUE(R) TYPE I.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
METHOD m1.
r = 100.
ENDMETHOD.
METHOD m2.
r = 10 * n.
ENDMETHOD.
METHOD m3.
r = n1 + n2.
ENDMETHOD.
ENDCLASS.
DATA: oref TYPE REF TO c1,
number1 TYPE i VALUE 3,
number2 TYPE i VALUE 5,
result TYPE i.
START-OF-SELECTION.
CREATE OBJECT oref TYPE c1.
MOVE C1=>M1( ) TO RESULT.
WRITE / RESULT.
MOVE oref->m2( number1 ) TO result.
WRITE / RESULT.
RESULT = OREF->M3( N1 = NUMBER1 N2 = NUMBER2 ).
WRITE / RESULT.
Wir bieten ganzheitliche SAP-Lösungen aus einer Hand, um den digitalen Wandel zu gestalten und neue Geschäftsfelder zu erschließen.
Schweiz
Schaffhausen
Deutschland
Mannheim, Düsseldorf, München
USA
Haverhill
Griechenland
Thessaloniki