*&---------------------------------------------------------------------*
*& Report YTEST1
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ytest1.

TYPES:BEGIN OF ty_tab,
        id    TYPE i,
        value TYPE string,
      END OF ty_tab.
DATA:lt_tab TYPE TABLE OF ty_tab,
     ls_tab TYPE ty_tab.

TYPES:BEGIN OF ty_tab2,
        tabix TYPE i,
        tab   LIKE lt_tab,
      END OF ty_tab2.
DATA:lt_tab2 TYPE TABLE OF ty_tab2,
     ls_tab2 TYPE ty_tab2.

"结构赋值
ls_tab = VALUE #( id = 1 value = `AAA`  ).

"表赋值
lt_tab = VALUE #( ( id = 1 value = `AAA` )
                  ( id = 2 value = `BBB` )
                  ( id = 3 value = `CCC` ) ).

"嵌套结构赋值
ls_tab2 = VALUE #( tabix = 1 tab = VALUE #( ( id = 1 value = 'AAA' )
                                            ( id = 2 value = 'BBB' ) ) ).

"嵌套表赋值
lt_tab2 = VALUE #( ( tabix = 1 tab = VALUE #( ( id = 1 value = 'AAA' )
                                              ( id = 2 value = 'BBB' ) ) )
                   ( tabix = 2 tab = VALUE #( ( id = 3 value = 'CCC' )
                                              ( id = 4 value = 'DDD' ) ) ) ).

【ABAP】7.4 新语法——结构和内表赋值_赋值

  【ABAP】7.4 新语法——结构和内表赋值_新语法_02

 【ABAP】7.4 新语法——结构和内表赋值_JAVA_03

  【ABAP】7.4 新语法——结构和内表赋值_JAVA_04