Inner join is used to join two or more than two tables which are having common fields. Inner join actually joins with the data which are common in both table. In the following example one purchase order is having the unique entry in EKKO table and it has 24 items in the EKPO table based on the different items. Since we have selected EKPO table as INNER JOIN we are having all records of that PO in item table EKPO. In this way we have joined further two tables MAKT & MARA.
PARAMETERS p_ebeln TYPE ekko-ebeln.
SELECT a~ebeln, a~bukrs, a~bsart,
b~ebelp, b~matnr, b~menge,
c~maktx,
d~mtart
FROM ekko AS a
INNER JOIN ekpo AS b ON b~ebeln = a~ebeln
INNER JOIN makt AS c ON c~matnr = b~matnr AND
c~spras = @sy-langu
INNER JOIN mara AS d ON d~matnr = b~matnr
INTO TABLE @DATA(itab)
WHERE a~ebeln = @p_ebeln.
cl_demo_output=>display( itab ).
PARAMETERS p_ebeln TYPE ekko-ebeln.
SELECT a~ebeln, a~bukrs, a~bsart,
b~ebelp, b~matnr, b~menge,
c~maktx,
d~mtart
FROM ekko AS a
INNER JOIN ekpo AS b ON b~ebeln = a~ebeln
INNER JOIN makt AS c ON c~matnr = b~matnr AND
c~spras = @sy-langu
INNER JOIN mara AS d ON d~matnr = b~matnr
INTO TABLE @DATA(itab)
WHERE a~ebeln = @p_ebeln.
cl_demo_output=>display( itab ).
No comments:
Post a Comment