CLASS DEMO DEFINITION.
PUBLIC SECTION.
CLASS-METHODS MAIN.
ENDCLASS.
CLASS DEMO IMPLEMENTATION.
METHOD MAIN.
DATA:
BEGIN OF STRUC,
COMP1 TYPE I,
COMP2 TYPE I,
COMP3 TYPE I,
END OF STRUC,
NAME TYPE STRING.
FIELD-SYMBOLS: <STRUC> TYPE ANY,
<COMP> TYPE ANY.
ASSIGN STRUC TO <STRUC>.
NAME = `<STRUC>-COMP1`.
ASSIGN (name) TO <comp>. "Assign 이후 아무값도 셋팅하지않음
* ASSIGN name TO <COMP>. "Assign 이후 Assign된 변수명을 셋팅
<COMP> = 10.
CL_DEMO_OUTPUT=>DISPLAY( |{ <COMP> }| ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DEMO=>MAIN( ).
PUBLIC SECTION.
CLASS-METHODS MAIN.
ENDCLASS.
CLASS DEMO IMPLEMENTATION.
METHOD MAIN.
DATA:
BEGIN OF STRUC,
COMP1 TYPE I,
COMP2 TYPE I,
COMP3 TYPE I,
END OF STRUC,
NAME TYPE STRING.
FIELD-SYMBOLS: <STRUC> TYPE ANY,
<COMP> TYPE ANY.
ASSIGN STRUC TO <STRUC>.
NAME = `<STRUC>-COMP1`.
ASSIGN (name) TO <comp>. "Assign 이후 아무값도 셋팅하지않음
* ASSIGN name TO <COMP>. "Assign 이후 Assign된 변수명을 셋팅
<COMP> = 10.
CL_DEMO_OUTPUT=>DISPLAY( |{ <COMP> }| ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DEMO=>MAIN( ).