Skip to Content
Mar 09 at 04:46 AM

fetch data from 2 table with same field


Hello experts!,

i have this sample program to fetch data from 2 table but with different fields taken, is there a way to make it fetch data from 2 table with the same field and then store the output to my Ztable ?

here's the sample program

REPORT ZGETFBL.<br><br>TABLES : MARA.<br><br>DATA : ITAB TYPE TABLE OF ZDATAGL,<br>       WA TYPE ZDATAGL.<br><br>SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.<br><br>START-OF-SELECTION.<br><br>PERFORM GET_DATA.<br>PERFORM DISPLAY_DATA.<br>*&---------------------------------------------------------------------*<br>*&      Form  GET-DATA<br>*&---------------------------------------------------------------------*<br>*       text<br>*----------------------------------------------------------------------*<br>*  -->  p1        text<br>*  <--  p2        text<br>*----------------------------------------------------------------------*<br>FORM GET_DATA.<br><br>SELECT A~MATNR<br>       ERSDA<br>       ERNAM<br>       B~PSTAT<br>       B~LVORM <br>INTO TABLE ITAB<br>FROM MARA AS A<br>  INNER JOIN MARC AS B<br>ON B~MATNR = A~MATNR<br>  WHERE MATNR IN S_MATNR.<br><br>ENDSELECT.<br>ENDFORM.