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

Retrive data from two tables into one internal table.

Former Member
0 Likes
899

Hi SDN,

I am downloading the Assets data from two tables ANLA,ANLZ.

there is a common field ANL1in both tables and i have to retrive the data by using anl1 into the internal table.

can you please send me the SELECT Syntax for this probl.....

Thank you & Regards,

Manoj

Hi SDN,

I am downloading the Assets data from two tables ANLA,ANLZ.

there is a common field ANL1in both tables and i have to retrive the data by using anl1 into the internal table.

can you please send me the SELECT Syntax for this probl.....

Thank you & Regards,

Manoj

5 REPLIES 5
Read only

Former Member
0 Likes
871

hI

FIRST RETRIVE THE DATA FROM ANLA TABLE.

select fields from anla into tabl1 itab1.

now

if itab1[] is not initial.

select fields from anlz into table itab2 for all entries in itab1 where anl1 eq itab1-anl1.

endselect.

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
871

Hi,

Use a join and select directly into one internal table if possible.

Else you will have to loop at each table individually using a nested loop and move the data to the common internal table.

regards,

Omkar.

Read only

Former Member
0 Likes
871

Hi manoj,

Please see the following sample code. But kindly don't use join as it may hamper ur performance. No trouble in using two select query.

data: begin of itab occurs 0,

BUKRS like anla-BUKRS,

ANLN1 like anla-ANLN1,

BDATU like anlz-BDATU,

end of itab.

select anlabukrs anlaANLN1 anlzBDATU into corresponding fields of table itab from anla inner join anlz on anlaanl1 eq anlz~anl1 where (logexp).

Please come back for any clarification.

Thanks and Regards,

saurabh

Read only

Former Member
0 Likes
871

Hi Manoj,

Select data from ANLA and place the data in first internal table

Select data from ANLZ and place the data in other internal table.

Loop through the 2nd internal table

Read the first internal table and

place these data in third internal table

Endloop

Regards

Arun

Read only

Former Member
0 Likes
871

Thank you for every one.... i got the answer