Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

join two internal tables

Former Member
0 Likes
1,025

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

4 REPLIES 4
Read only

Former Member
0 Likes
729

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

Read only

Former Member
0 Likes
729

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

Read only

Former Member
0 Likes
729

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

Read only

Former Member
0 Likes
729

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