2020-06-01 abap区分表还是结构

CREATE DATA dref TYPE (ls_fields-tabname).

  ASSIGN dref->* TO FIELD-SYMBOL().

  lo_datatype = cl_abap_typedescr=>describe_by_data( ).

  CASE lo_datatype->type_kind.

    WHEN cl_abap_typedescr=>typekind_struct1

      OR cl_abap_typedescr=>typekind_struct2.

      CREATE DATA dyn_table TYPE TABLE OF (ls_fields-tabname).

      ASSIGN dyn_table->* TO .

      CREATE DATA dyn_wa LIKE LINE OF .

      ASSIGN dyn_wa->* TO .

    WHEN cl_abap_typedescr=>typekind_table.

      CREATE DATA dyn_table TYPE (ls_fields-tabname).

      ASSIGN dyn_table->* TO .

      CREATE DATA dyn_wa LIKE LINE OF .

      ASSIGN dyn_wa->* TO .

  ENDCASE.

你可能感兴趣的:(2020-06-01 abap区分表还是结构)