2006 Sep 28 11:52 AM
hi all
please give a query for joining of three internal tables and store into another table,and we should retrive data from that third table
please take those fields as material number,plant,storage location,stock,units
hi all
please give a query for joining of three internal tables and store into another table,and we should retrive data from that third table
please take those fields as material number,plant,storage location,stock,units
2006 Sep 28 11:57 AM
Hello Raja,
SELECT EKKNEBELN EKKNEBELP EKKNKOSTL EKKNPS_PSP_PNR EKKN~SAKTO
EKETWEMNG EKETETENR EKETBEDAT EKPOKNTTP EKPOLOEKZ EKPOMATNR
EKPOWERKS EKPOMATKL EKPOMENGE EKPOMEINS EKPONETPR EKPOPEINH
EKPONETWR EKPOMTART EKPOEFFWR EKKOBUKRS EKKOBSART EKKOERNAM
EKKOLIFNR EKKOEKORG EKKOEKGRP EKKOWAERS EKKO~BEDAT
EKKO~MEMORY INTO TABLE G_T_OUTTAB
FROM ( EKKN
INNER JOIN EKET
ON EKETEBELN = EKKNEBELN
AND EKETEBELP = EKKNEBELP
INNER JOIN EKPO
ON EKPOEBELN = EKETEBELN
AND EKPOEBELP = EKETEBELP
INNER JOIN EKKO
ON EKKOEBELN = EKPOEBELN )
WHERE EKKN~EBELN IN S_EBELN
AND EKKN~EBELP IN S_EBELP
AND EKKN~KOSTL IN S_KOSTL
AND EKKN~PS_PSP_PNR IN S_WBS
AND EKKN~SAKTO IN S_SAKTO
AND EKPO~KNTTP IN S_KNTTP
AND EKPO~LOEKZ IN S_LOEKZ
AND EKPO~MATKL IN S_MATKL
AND EKPO~MATNR IN S_MATNR
AND EKPO~WERKS IN S_WERKS
AND EKKO~BEDAT IN S_BEDAT
AND EKKO~BSART IN S_BSART
AND EKKO~BUKRS IN S_BUKRS
AND EKKO~EKGRP IN S_EKGRP
AND EKKO~EKORG IN S_EKORG
AND EKKO~ERNAM IN S_ERNAM
AND EKKO~LIFNR IN S_LIFNR
AND EKPO~MTART IN S_MTART
AND EKKO~MEMORY IN S_MEMORY
AND EKET~BEDAT IN S_DAT_ET.
Try with this code.
If useful reward.
Vasanth
2006 Sep 28 12:08 PM
Hi,
find this,
SELECT DISTINCT aherkunft amatnr aprueflos acharg
bvorglfnr bmerknr bverwmerkm bkurztext
bsollwert btoleranzun btoleranzob " cprobenr
bsollwni btolunni b~tolobni
FROM ( qals AS a INNER JOIN qamv AS b
ON aprueflos = bprueflos )
INNER JOIN qapp AS c
ON bprueflos = cprueflos
AND bvorglfnr = cvorglfnr
INTO CORRESPONDING FIELDS OF itab
WHERE a~aufnr = order
AND b~verwmerkm IN mic_code
AND c~userc1 IN mc_no
AND c~userc2 IN mc_type
AND c~usern1 IN l_no
AND a~herkunft = '03'.
2006 Sep 28 12:19 PM
Hi,
please take those fields as material
SELECT MARDWERKS MARDLGORT MARDMATNR MARDLABST
INTO TABLE IT_MARD
FROM MARD
INNER JOIN MARA
ON MARAMATNR = MARDMATNR
WHERE MARD~MATNR IN S_MATNR AND
MARD~WERKS IN R_WERKS.
regards
Amole
2006 Sep 28 1:41 PM
Hi Raja Gopal,
i got u r point,
let us consider
itab1 with a1 a2 a3 contains 100 records
itab2 with b1 b2 b3 contains 30 reocrds
itab3 with c1 c2 c3 contains 30 records
and a1 = b1 and b2 = c2
u want to fill itab4 with a1 a2 a3 b2 b3 c1 c3
now follow this
loop at itab1.
itab4-a1 = itab1-a1.
itab4-a2 = itab1-a2.
itab4-a3 = itab1-a3.
now read table itab2 by comparing a1 and b1 on these tables and append to itab4.
read table itab2 with key b1 = itab1-a1.
itab4-b2 = itab2-b2.
itab4-b3 = itab2-b3.
now read table itab3 by comparing b2 from retrieved itab2 and with c2 in itab3, on these tables and append to itab4.
read table itab3 with key c2 = itab2-b2.
itab4-c1 = itab3-c1.
itab4-c3 = itab3-c3.
append itab4.
endloop.
now in final internal table itab4 u will have all data from all internal tables.
<b>NOTE: while joining two internal table.</b>
use <b>loop statement</b> for one internal table. and use <b>read statement</b> for one intenaltable.
<b>NOTE: while using read and loop.</b>
Use LOOP for a table that has large no of records
Use READ for a table that has small no of records
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |