Tuesday, 31 May 2016

Left Outer Join


  • 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
           



Ex :

Steps:

  1. Go to transaction code SE38.
  2. Enter the program name Z or Y<program name>
  3. Select attribute type as Executable program.
  4. 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 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.

Input


Output




No comments:

Post a Comment