Inner Join
- With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view.
- Keyword : Inner Join .
- Suppose TABA and TABB are two tables, then
- Inner join result will be
Ex :
Steps
- Go to transaction code SE38.
- Enter the program name Z or Y<program name>
- Select attribute type as Executable program.
- Click on Save.
Source Code
TYPES : BEGIN OF T_STR,
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF T_STR.
DATA : ITAB TYPE TABLE OF T_STR,
WA TYPE T_STR.
SELECT-OPTIONS P_VBELN FOR WA-VBELN.
SELECT VBELN
POSNR
A~MATNR
MAKTX
INTO TABLE ITAB
FROM VBAP AS A INNER JOIN MAKT AS B ON B~MATNR = A~MATNR
WHERE VBELN in P_VBELN AND SPRAS = 'EN'.
LOOP AT ITAB INTO WA.
WRITE : / WA-VBELN , WA-POSNR , WA-MATNR , WA-MAKTX.
ENDLOOP.
VBELN TYPE VBAP-VBELN,
POSNR TYPE VBAP-POSNR,
MATNR TYPE VBAP-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF T_STR.
DATA : ITAB TYPE TABLE OF T_STR,
WA TYPE T_STR.
SELECT-OPTIONS P_VBELN FOR WA-VBELN.
SELECT VBELN
POSNR
A~MATNR
MAKTX
INTO TABLE ITAB
FROM VBAP AS A INNER JOIN MAKT AS B ON B~MATNR = A~MATNR
WHERE VBELN in P_VBELN AND SPRAS = 'EN'.
LOOP AT ITAB INTO WA.
WRITE : / WA-VBELN , WA-POSNR , WA-MATNR , WA-MAKTX.
ENDLOOP.
Save -> Check -> Activate -> Execute.
Comments
Post a Comment