SW/ABAP

ABAP OOP method 호출방법

nucleplant 2017. 8. 8. 11:12
CLASS lcl_test DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      func_meth
        IMPORTING
          i_param TYPE i
        RETURNING
          VALUE(r_res) TYPE char1.
ENDCLASS.

l_res = lcl_test=>func_meth( 1 ).

* you could also call it like this
l_res = lcl_test=>func_meth( i_param = 1 ).

* also this variant is possible
l_res = lcl_test=>func_meth( EXPORTING i_param = 1 ).

* the traditional CALL METHOD syntax would be like this
CALL METHOD lcl_test=>func_meth
  EXPORTING
    i_param = 1
  RECEIVING
    r_res = l_res.