2007 Nov 30 9:40 AM
Hai Experts,
plz check my code, n plz help to inner join all the tables
TYPES : BEGIN OF ITAB,
EBELN TYPE EKKO-EBELN, "P.O.NUMBER
AEDAT TYPE EKKO-AEDAT, "DATE
BPRME TYPE EKPO-BPRME, "UNIT PRICE
MENGE TYPE EKPO-MENGE, "Purchase order quantity
WERKS TYPE EKPO-WERKS, "PLANT
BRTWR TYPE EKPO-BRTWR, "Gross order value in PO
STRAS TYPE LFA1-STRAS, "House number and street
LIFNR TYPE LFA1-LIFNR, "VENDOR NO
NAME1 TYPE LFA1-NAME1, "V NAME
ORT01 TYPE LFA1-ORT01, "CITY
LAND1 TYPE LFA1-LAND1, "LAND
PSTLZ TYPE LFA1-PSTLZ, "POSTAL CODE
MAKTX TYPE MAKT-MAKTX, "DESCRIPTION
END OF ITAB.
<b>and i got stucked here:</b>
<u></u>
SELECT EKKO~EBELN
EKKO~AEDAT
EKPO~BPRME
EKPO~MENGE
EKPO~WERKS
EKPO~BRTWR
LFA1~LIFNR
LFA1~STRAS
LFA1~NAME1
LFA1~ORT01
LFA1~LAND1
LFA1~PSTLZ
MAKT~MAKTX
INTO TABLE ITAB
FROM EKKO
INNER JOIN EKPO LFA1 T001W MAKT
ON EKKOEBELN = EKPOEBELN
EKKO~EBELN
WHERE EKKO~EBELN IN S_EBELN.
2007 Nov 30 9:46 AM
2007 Nov 30 9:49 AM
refer this...
SELECT AMATNR AMTART BWERKS CLABST D~MAKTX FROM
MARA AS A INNER JOIN MARC AS B ON
AMATNR = BMATNR INNER JOIN MARD AS C ON
BMATNR = CMATNR INNER JOIN MAKT AS D ON
CMATNR = DMATNR INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE A~MATNR IN SO_MATNR.
2007 Nov 30 9:51 AM
hi Rajesh,
you have to join the tables one by one:
SELECT ekko~ebeln
ekko~aedat
ekpo~bprme
ekpo~menge
ekpo~werks
ekpo~brtwr
lfa1~lifnr
lfa1~stras
lfa1~name1
lfa1~ort01
lfa1~land1
lfa1~pstlz
makt~maktx
INTO TABLE itab
FROM ekko AS ekko
INNER JOIN ekpo AS ekpo
ON ekkoebeln EQ ekpoebeln
INNER JOIN lfa1 AS lfa1
ON ekkolifnr EQ lfa1lifnr
INNER JOIN t001w AS t001w
ON ekpowerks EQ t001wwerks
INNER JOIN makt AS makt
ON ekpomatnr EQ MAKTmatnr
WHERE ekko~ebeln IN s_ebeln.
This is the complete SELECT. BUT! The performance will be much better if you take out T001W and MAKT from the INNER JOIN. Do select on these tables in separate steps and merge the internal tables afterwards.
hope this helps
ec
2007 Nov 30 9:52 AM
Hi
SELECT EKKO~EBELN
EKKO~AEDAT
EKPO~BPRME
EKPO~MENGE
EKPO~WERKS
EKPO~BRTWR
LFA1~LIFNR
LFA1~STRAS
LFA1~NAME1
LFA1~ORT01
LFA1~LAND1
LFA1~PSTLZ
MAKT~MAKTX
INTO TABLE ITAB
FROM EKKO
INNER JOIN EKPO
ON EKKOEBELN = EKPOEBELN join LFA1 on EKKOlifnr = lfa1lifnr join
T001W on ekpowerks = t001Wwerks join MAKT
EKpOmatnr = maktmatnr
WHERE EKKO~EBELN IN S_EBELN.
regards
anji