ABAP 定義縱深結構的內表
阿新 • • 發佈:2018-12-11
ABAP 定義縱深結構的內表
CLASS DEMO DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
MAIN,
CLASS_CONSTRUCTOR.
PRIVATE SECTION.
CLASS-DATA:
BEGIN OF
A1 TYPE STRING VALUE `a1_XX`,
A2 TYPE STRING VALUE `a2_XX`,
BEGIN OF ISTRUCT,
A1
A2 TYPE STRING VALUE `a2_YY`,
END OF ISTRUCT,
ITAB LIKE STANDARD TABLE OF
END OF STRUCT1.
ENDCLASS.
CLASS DEMO IMPLEMENTATION.
METHOD MAIN.
DATA(OUT) = CL_DEMO_OUTPUT=>NEW( ).
OUT->BEGIN_SECTION( `縱深結構的內表展示`
)->WRITE( STRUCT1-ISTRUCT
)->WRITE( STRUCT1-ITAB ).
OUT->DISPLAY( ).
ENDMETHOD.
METHOD CLASS_CONSTRUCTOR.
STRUCT1-ITAB = VALUE #(
( A1 = `a1_xx` A2 = `a2_xx` )
( A1 = `a1_yy` A2 = `a2_yy` ) ).
ENDMETHOD.
ENDCLASS.
檢視一下內表的結構:
輸出: