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

Select stmt into corresponding

Former Member
0 Likes
465

Hi Experts,

I am having a structure with 3 fields from different tables and iam selecting and passing to itab by using into corresponding fields of table itab,but it not taking the value in the first select statement. plz help....

TYPES: BEGIN OF ST_KNA1,

kunnr type kna1-kunnr,

nam1 type kna1-name1,

lifnr type lfa1-lifnr,

end of ST_KNA1.

DATA : itab type st_kna1 initial size 0.

DATA : wa_itab type st_kna1.

select kunnr name1 from kna1into corresponding fileds of table itab .

select lifnr from lfa1 into corresponding fileds of table itab .

Loop at itab into wa_itab.

write:/ wa_itab-kunnr

wa_itab-name1,

wa_itab-lifnr,

endloop.

It is selecting kunnr name1 & lifnr but in table in having only lifnr field value....& printing only lifnr value so plz help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
445

Hi,

When you use INTO TABLE or INTO CORRESPONDING FIELDS OF TABLE clause for SELECT it refreshes the target internal table and replaces all entries witht he current select.

So when the second SELECT runs, it refreses itab and replaced it with entries from second select.

Change it as follows:

select kunnr name1 from kna1into corresponding fileds of table itab .

select lifnr from lfa1 appending corresponding fileds of table itab .

However, note, that the :LFA1 entries would get added under KNA1 entries in table itab.

Cheers.

Edited by: Aditya Laud on Feb 27, 2008 2:34 AM

2 REPLIES 2
Read only

Former Member
0 Likes
446

Hi,

When you use INTO TABLE or INTO CORRESPONDING FIELDS OF TABLE clause for SELECT it refreshes the target internal table and replaces all entries witht he current select.

So when the second SELECT runs, it refreses itab and replaced it with entries from second select.

Change it as follows:

select kunnr name1 from kna1into corresponding fileds of table itab .

select lifnr from lfa1 appending corresponding fileds of table itab .

However, note, that the :LFA1 entries would get added under KNA1 entries in table itab.

Cheers.

Edited by: Aditya Laud on Feb 27, 2008 2:34 AM

Read only

0 Likes
445

Hi Aditya,

It is working fine,thank you very much..