‎2006 Nov 09 10:24 AM
i want to two internal table data into third internal table.
itab 1: l_t_lipso2_1 field : adqntp
itab 2: l_t_lipso2_2 field : adqntp
o/p itab 3: l_t_lipso2_3 fields : adqntp1, adqntp2.
actually itabl fields fetched different condition wise and itab2 fields fetched different condition.
i want to show my o/p itab3, as the two table datas as same row wise.
‎2006 Nov 09 10:38 AM
As I can understand from your requirement the below soln should help.
Loop at itab1.
move itab1-adqntp to itab3-adqntp1.
read table itab2 index sy-tabix.
if sy-subrc = 0.
move itab2-adqntp to itab3-adqntp2.
append itab3.
endloop.
describe table itab1 lines l1.
describe table itab2 lines l2.
if l2 > l1.
l1 = l1 + 1.
loop at itab2 from l1 to l2.
move space to itab3-adqntp1.
move itab2-adqntp to itab3-adqnpt2.
append itab3.
endloop.
endif.
‎2006 Nov 09 10:28 AM
Dear Santhosh,
PLease expalin the scenario in a little bit detail..like wether the 2 itabs contain records with same key or how they are related etc..
it seems to be more explanatory when u r posting some queries.
Regards
Sandeep
‎2006 Nov 09 10:30 AM
hi,
do u have any common field in both the internal tables itab1 and itab2
‎2006 Nov 09 10:31 AM
assuming that both the tables contain same fields and all the three tables have same structure:
loop at itab1 into wa_itab1.
append wa_itab1 to itab3
endloop.
loop at itab2 into wa_itab2.
append wa_itab2 to itab3
endloop.
‎2006 Nov 09 10:38 AM
As I can understand from your requirement the below soln should help.
Loop at itab1.
move itab1-adqntp to itab3-adqntp1.
read table itab2 index sy-tabix.
if sy-subrc = 0.
move itab2-adqntp to itab3-adqntp2.
append itab3.
endloop.
describe table itab1 lines l1.
describe table itab2 lines l2.
if l2 > l1.
l1 = l1 + 1.
loop at itab2 from l1 to l2.
move space to itab3-adqntp1.
move itab2-adqntp to itab3-adqnpt2.
append itab3.
endloop.
endif.
‎2006 Nov 09 10:56 AM
Hi
Try the following code this is working for me fine.
Tables: lfa1.
Data: begin of itab1 occurs 0,
land1 like lfa1-land1,
end of itab1,
begin of itab2 occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
end of itab2,
begin of itab3 occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1,
end of itab3.
select land1 from lfa1 into table itab1 where land1 = 'IN'.
select lifnr name1 from lfa1 into table itab2 where name1 = 'Rajesh'.
loop at itab1.
write:/ itab1-land1.
endloop.
uline.
loop at itab2.
write:/ itab2-lifnr,itab2-name1.
endloop.
loop at itab1.
move itab1 to itab3.
append itab3.
endloop.
loop at itab2.
move itab2 to itab3.
append itab3.
endloop.
uline.
loop at itab3.
write:/ itab3-lifnr,itab3-name1,itab3-land1.
endloop.
‎2006 Nov 09 11:53 AM