REPORT zsm_innerjoin4.
TYPES: BEGIN OF str,
vbeln TYPE vbeln_vl,
vkorg TYPE vkorg,
lfart TYPE lfart,
posnr TYPE posnr_vl,
matnr TYPE matnr,
matkl TYPE matkl,
END OF str.
TYPES: BEGIN OF str_likp,
vbeln TYPE vbeln_vl,
vkorg TYPE vkorg,
lfart TYPE lfart,
END OF str_likp.
TYPES: BEGIN OF str_lips,
vbeln TYPE vbeln_vl,
posnr TYPE posnr_vl,
matnr TYPE matnr,
matkl TYPE matkl,
END OF str_lips.
DATA: it TYPE STANDARD TABLE OF str,
wa TYPE str.
DATA: it_likp TYPE STANDARD TABLE OF str_likp,
wa_likp TYPE str_likp.
DATA: it_lips TYPE STANDARD TABLE OF str_lips,
wa_lips TYPE str_lips.
data: lv_lines TYPE int4.
*
* select LIKP~VBELN
* LIKP~VKORG
* LIKP~LFART
* LIPS~POSNR
* LIPS~MATNR
* LIPS~MATKL
* FROM LIKP INNER JOIN LIPS
* ON LIKP~VBELN = LIPS~VBELN INTO TABLE it UP TO 50 ROWS.
SELECT vbeln
vkorg
lfart
FROM likp INTO table it_likp.
SELECT posnr
matnr
matkl
FROM lips INTO TABLE it
FOR ALL ENTRIES IN it_likp
WHERE vbeln = it_likp-vbeln.
DESCRIBE TABLE it lines lv_lines.
WRITE:/'Total number of records: ', lv_lines.
LOOP AT it INTO wa.
WRITE:/ wa-vbeln, wa-vkorg, wa-lfart, wa-posnr, wa-matnr, wa-matkl.
ENDLOOP.
0 Comments