‎2008 Feb 27 7:29 AM
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
‎2008 Feb 27 7:34 AM
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
‎2008 Feb 27 7:34 AM
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
‎2008 Feb 27 9:52 AM
Hi Aditya,
It is working fine,thank you very much..