REPORT ZSM_INNERJOIN5.
TYPES: BEGIN OF str,
vbeln TYPE vbeln, 'Creation of Structure'
erdat type erdat,
erzet type erzet,
ernam TYPE ernam,
matnr TYPE matnr,
matwa TYPE matwa,
pmatn TYPE pmatn,
end of str.
data: it TYPE STANDARD TABLE OF str, 'Creation of internal table and work area'
wa type str.
select vbak~vbeln 'Query to inner join'
vbak~erdat
vbak~erzet
vbak~ernam
vbap~matnr
vbap~matwa
vbap~pmatn
FROM vbak INNER JOIN vbap ON vbak~vbeln = vbap~vbeln INTO TABLE it.
if sy-subrc = 0. 'to check whether the select query is correct or not'
LOOP at it into wa.
write:/ wa-vbeln, wa-erdat, wa-erzet, wa-ernam, wa-matnr, wa-matwa, wa-pmatn.
ENDLOOP.
ENDIF. 'Output'
0 Comments