04-11-2007 4:21 PM
Hi ,
I need to bring fields from 2 different tables into a single itab.
Data : begin of itab occurs 0,
F1 type lfa1-regio,
F2 type ekorg,
F3 type wyt3-adrnr,
End of itab.
First I need to check in for the field of LFA1 and fill the itab and then I must check the LIFN2 of LFA1 with WYT3-LIFNR and fill the F3.
How do I write the select statements?
04-11-2007 4:25 PM
Select lfa1regio lfa1ekorg
wyt3~adrnr
FROM ( lfa1
INNER JOIN wyt3
ON wyt3lifnr = lfa1LIFN2 )
INTO TABLE itab
WHERE .....
Regards,
John.
04-11-2007 4:25 PM
Hi,
Use Innerjoin or Forallentry joining statement.
Regards,
Bhaskar
04-11-2007 4:26 PM
HI ramana,
use inner join ........
SELECT LFA1REGIO LFA1EKORG WYT3ADRNR INTO CORRESPONDING FIELDS OF TABLE ITAB FROM LFA1 INNER JOIN WYT3 ON LFA1LIFN2 = WYT3~LIFNR WHERE ( UR CONDITION IF EXISTS ).
Regards
SAB
04-11-2007 4:29 PM
Hi,
Please try this.
SELECT A~REGIO B~EKORG A~ADRNR
INTO TABLE ITAB
FROM LFA1 AS A INNER JOIN WYT3 AS B
ON A~LIFNR = B~LIFN2
WHERE A~LIFNR IN S_LIFNR.
Regards,
Ferry Lianto
04-11-2007 4:34 PM
But Ferry ,
I need to pick somemore fields from ADRC table into field F4.What If I need to write another select stmt for the same ITAB ?
04-11-2007 4:48 PM
04-11-2007 5:53 PM
The logic is that I need to check LIFN2 with the LIFNR of LFA1 again and get NAME1 & ADRNR from LFA1 and then check it with the ADRNR of ADR6
04-11-2007 6:05 PM
Hi,
Please try this.
SELECT A~REGIO B~EKORG A~ADRNR
INTO TABLE ITAB
FROM LFA1 AS A INNER JOIN WYT3 AS B
ON A~LIFNR = B~LIFN2
INNER JOIN ADRC AS C
ON A~ADRNR = C~ADDRNUMBER
WHERE A~LIFNR IN S_LIFNR.
Regards,
Ferry Lianto