Showing posts with label #innerjoin. Show all posts
Showing posts with label #innerjoin. Show all posts

Tuesday, 31 May 2016

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

  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 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.

Input



Output