- In Left Outer Join , we can fetch similar records from 2 or more tables as well as all the records from the left hand side table.
- Keyword : Left Outer Join
- Suppose TABA and TABB are two tables, then
- Left outer 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 LEFT OUTER JOIN MAKT AS B ON B~MATNR = A~MATNR
WHERE VBELN in P_VBELN .
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 LEFT OUTER JOIN MAKT AS B ON B~MATNR = A~MATNR
WHERE VBELN in P_VBELN .
LOOP AT ITAB INTO WA.
WRITE : / WA-VBELN , WA-POSNR , WA-MATNR , WA-MAKTX.
ENDLOOP.
Save -> Check->Activate ->Execute.
No comments:
Post a Comment