Getting structure of any table in sap ABAP programming language dynamic table

in this programming language, some time requirement to getting table type run time below code help the getting the code dynamic table

  DATA lv_name   TYPE char4,
         comp_tab  TYPE cl_abap_structdescr=>component_table,
         itab_type TYPE REF TO cl_abap_tabledescr,
         dref      TYPE REF TO data.

  FIELD-SYMBOLS <lt_outtab> TYPE ANY TABLE,
                  <ls_outtab> TYPE any,
                  <l_fld>     TYPE any.



 lv_name 'A' && gs_t682i-kotabnr.
    struct_type ?= cl_abap_typedescr=>describe_by_namelv_name ).
    comp_tab struct_type->get_components).

    struct_type cl_abap_structdescr=>createcomp_tab ).
    itab_type   cl_abap_tabledescr=>createstruct_type ).

    CREATE DATA dref TYPE HANDLE itab_type.
    ASSIGN dref->TO <lt_outtab>.


          ASSIGN COMPONENT 'MATNR' OF STRUCTURE <ls_outtab> TO <l_fld>.
          gs_final-material <l_fld>.
          gs_final-amount gs_konp-kbetr.
          ASSIGN COMPONENT 'VTWEG' OF STRUCTURE <ls_outtab> TO <l_fld>.
          READ TABLE gt_knvv INTO gs_knvv WITH KEY kunnr i_kunnr
                           vtweg <l_fld>.



 lv_vwerk `'` && gs_knvv-vwerk && `'`.
          lv_kunwe `'` && gs_knvp-kunn2 && `'`.
          lv_datum `'` && sy-datum && `'`.





Comments

Popular posts from this blog

all user exit mv45afzz (implicit user exit )

MB_MIGO_BADI THIS BADI USED TO POSTING DATA IN MIGO

Long Text in input and output field in module pool