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

Code for select

Former Member
0 Likes
858

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?

8 REPLIES 8
Read only

Former Member
0 Likes
732

Select lfa1regio lfa1ekorg

wyt3~adrnr

FROM ( lfa1

INNER JOIN wyt3

ON wyt3lifnr = lfa1LIFN2 )

INTO TABLE itab

WHERE .....

Regards,

John.

Read only

Former Member
0 Likes
732

Hi,

Use Innerjoin or Forallentry joining statement.

Regards,

Bhaskar

Read only

Former Member
0 Likes
732

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

Read only

Former Member
0 Likes
732

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

Read only

0 Likes
732

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 ?

Read only

Former Member
0 Likes
732

Hi,

What is the field from ADRC?

Regards,

Ferry Lianto

Read only

0 Likes
732

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

Read only

Former Member
0 Likes
732

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