12-21-2007 4:13 PM
hello friends,
I have two internal tables of different structure.
i have filled those two internal tables using join statements.
But one field is common in both the tables, when i try to append both tables into another new internal table.
i cant get the value for the 2nd tables field.
EX.
vbeln is common in vbuk, vbup, vbap, vbak, likp, lips.
but its sale order number in vbak, vbap.
delivery document in likp,lips.
vbup has both sales order and delivery in the vbeln field.
so, i made a join to between vbak, vbup and lips to see the goods movement status in vbup.
for that the vbeln should be delievery number.
and in other table, i have added vbup and vbak and vbep to get the delievery status.
for that the vbeln should be sale order no.
when i append both the tables into the third internal table that has the structure of both internal tables.
i could not get the vbeln of the second table(sale order no) in the third table.
help me guys.
rewards for helpful solutions.
12-24-2007 4:12 PM
hello,
types:
begin of str,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
end of str.
types:
begin of st1,
lfstk like vbuk-vbeln,
end of st1.
types:
begin of st2,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
lfstk like vbuk-lfstk,
end of st2.
selection-screen: s_order for vbak-vbeln,
s_div for vbak-vtweg.
data: it type table of st with header line,
it1 type table of st1 with header line,
it2 type table of st2 with header line.
select vbeln vkorg vtweg from vbak into table it
where vbeln in s_order and
vkorg in s_div.
select lfstk from vbuk into table it1 for all entries in it
where vbeln = it-vbeln.
it2[] = it[].
append it1-lfstk into it2[].
or
move-corresponding it1 to it2.
" when i execute this code with a grid or list display, i m not able to get the values or entries for the 2nd table it1.
the it2 has the lfstk cloumn blank in the final display.
help me for a remedy.
rewards for useful suggestion.
12-21-2007 4:15 PM
loop at i_tab1
v_tabix = sy-tabix.
read table i_tab3 with key <key fields of i_tab1>
if sy-subrc eq 0.
move corresponding fields i_tab1 to i_tab3.
modify i_tab3 index v_tabix..
else.
move corresponding fields i_tab1 to i_tab3.
append i_tab3.
endif.
endloop.
loop at i_tab2
v_tabix = sy-tabix.
read table i_tab3 with key <key fields of i_tab2>
if sy-subrc eq 0.
move corresponding fields i_tab2 to i_tab3.
modify i_tab3 index v_tabix..
else.
move corresponding fields i_tab2 to i_tab3.
append i_tab3.
endif.
endloop.
code of ars.
12-21-2007 4:16 PM
12-24-2007 4:12 PM
hello,
types:
begin of str,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
end of str.
types:
begin of st1,
lfstk like vbuk-vbeln,
end of st1.
types:
begin of st2,
vbeln like vbak-vbeln,
vkorg like vbak-vkorg,
vtweg like vbak-vtweg,
lfstk like vbuk-lfstk,
end of st2.
selection-screen: s_order for vbak-vbeln,
s_div for vbak-vtweg.
data: it type table of st with header line,
it1 type table of st1 with header line,
it2 type table of st2 with header line.
select vbeln vkorg vtweg from vbak into table it
where vbeln in s_order and
vkorg in s_div.
select lfstk from vbuk into table it1 for all entries in it
where vbeln = it-vbeln.
it2[] = it[].
append it1-lfstk into it2[].
or
move-corresponding it1 to it2.
" when i execute this code with a grid or list display, i m not able to get the values or entries for the 2nd table it1.
the it2 has the lfstk cloumn blank in the final display.
help me for a remedy.
rewards for useful suggestion.
12-24-2007 4:50 PM
HI Kumar,
make the following changes in your program.
types:
begin of st1,
************lfstk like vbuk-vbeln,
vbeln like vbuk-vbeln,
lfstk like vbuk-lfstk,
end of st1.
*********it2[ ] = it[ ].
*********append it1-lfstk into it2[].
*********or
*********move-corresponding it1 to it2.
loop at it.
read table it1 with key vbeln = it-vbeln.
move-corresponding it to it2.
it2-lfstk = it1-lfstk.
append it2.
clear it2.
endloop.
Reward if useful
Regards
ANUPAM
12-24-2007 4:59 PM
select vbeln vkorg vtweg from vbak into table it
where vbeln in s_order and
vkorg in s_div.
select vbeln lfstk from vbuk
into table it1
for all entries in it
where vbeln = it-vbeln.
>or
>select vbeln lfstk from vbuk
> into corresponding fields of table it
> for all entries in it
> where vbeln = it-vbeln.
loop at it
read table it1 with key vbeln = it-vbeln.
if sy-subrc eq 0.
move to output table.
endif.
endloop.
hope this should help