Skip to Content
-2
Mar 14, 2021 at 07:02 AM

CREATING DYNAMIC INTERNAL TABLE WITHOUT FINAL STRUCTURE

70 Views

Hi friends,

I am making my first dynamic internal table. The issue, is that I need to create a final internal table consisting of vkorg, erdat, material, posnr, menge, kunnr, without creating a user defined structure. How do I do it. please suggest. check the code once. 
REPORT zdynamicoops.
TABLES : vbak.
SELECT-OPTIONS : so_vkorg FOR vbak-vkorg,
                 so_erdat FOR vbak-erdat.
DATA : it_vbak TYPE TABLE OF vbak WITH HEADER LINE,
       it_vbap TYPE TABLE OF vbap WITH HEADER LINE.


DATA : gt_dyn_table TYPE REF TO data,
       gw_line TYPE REF TO data,
       gw_line1 TYPE REF TO data.


SELECT vbeln
       vkorg
       erdat
       kunnr
       FROM vbak
       INTO CORRESPONDING FIELDS OF TABLE it_vbak
       WHERE vkorg IN so_vkorg.

IF NOT it_vbak[] IS INITIAL.
SELECT vbeln
       posnr
       matnr
       zmeng
       FROM vbap
       INTO CORRESPONDING FIELDS OF TABLE it_vbap
       FOR ALL ENTRIES IN it_vbak
       WHERE vbeln EQ it_vbak-vbeln.
ENDIF.


<br>