Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!

ABAPMOVE_METHOD_INCLUDE - MOVE METHOD INCLUDE

ABAPMOVE_METHOD_INCLUDE - MOVE METHOD INCLUDE

CL_GUI_FRONTEND_SERVICES - Frontend Services   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.
SAP E-Book

Effect

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:

  • No IMPORTINGparameters: meth( )
  • One IMPORTING parameters: meth( f1 )
    , , , , , ,
  • meth( p1 = f1 )
  • n IMPORTING parameters: meth( p1 = f1 ... pn = fn )

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.



Example

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.






RFUMSV00 - Advance Return for Tax on Sales/Purchases   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 3051 Date: 20230207 Time: 213804     sap01-206 ( 27 ms )