09-18-2008 11:57 AM
hi abap gurus,
I hav 2 internal tables it1,it2.
it2 has the same structure of it1 except it has one additional field(percent).
I hav moved the contents from it1 to it2 using move corresponding.now i want to populate that percent field from the database table X for all the entries in it2.
I used the following query.but it has not given the required output.
select percent
into corresponding fields of table it2
from X
for all entries in it2
where code = it2_code.
pls help me.
09-18-2008 12:08 PM
hi,
use ony it2.
and create another internal table itab3 with code and percent field,
then use select data into itab3 for all entries in itab2
where code = itab2-code.
then
loop at itab2.
read table itab3 with key code = itab2-code.
if sy-subrc = 0.
itab2-percent = itab3-percent.
endif.
modify itab2 transporting percent.
endloop.
hope it will help you...
Regards
Meet
09-18-2008 12:01 PM
09-18-2008 12:06 PM
HI,
change the Query like.
select percent
into corresponding fields of table it2
from X
for all entries in it1
where code = it1_code.
Regards
Sumit Agarwal
09-18-2008 12:07 PM
Hi
Instead of creating 2 tables, you could have made in 1 table itself.
You could have added pecent field in IT1
and using innerjoin you could have joined Table 'X' also
Regards
MD
09-18-2008 12:08 PM
You first retrive data in it1 table for code.
after that you use.
if it1[] is not initial .
select percent
into corresponding fields of table it2
from X
for all entries in it1
where code = it1_code.
endif.
it will work .
Edited by: swati gupta on Sep 18, 2008 1:08 PM
Edited by: swati gupta on Sep 18, 2008 1:29 PM
09-18-2008 12:08 PM
hi,
use ony it2.
and create another internal table itab3 with code and percent field,
then use select data into itab3 for all entries in itab2
where code = itab2-code.
then
loop at itab2.
read table itab3 with key code = itab2-code.
if sy-subrc = 0.
itab2-percent = itab3-percent.
endif.
modify itab2 transporting percent.
endloop.
hope it will help you...
Regards
Meet
09-18-2008 12:11 PM
i used the condition code = it1_code
it s not working
we r populating it1 from some existing function module.
09-18-2008 12:14 PM
>
> i used the condition code = it1_code
> it s not working
.
You need to use it1-code instead.
09-18-2008 12:30 PM
You first retrive data in it1 table for code.
after that you use.
if it1[] is not initial .
select percent
into corresponding fields of table it2
from X
for all entries in it1
where code = it1_code.
endif.
it will work .
09-18-2008 12:35 PM
declare another internal table it3 with fields code and percent...
now,
select code percent
into table it2
from X
for all entries in it2
where code = it2_code.
here...loop at it2.
l_tabix = sy-tabix.
read table it3 with key code = it2-code.
if sy-subrc = 0.
it2-percent = it3-percent.
modify it2 index l_tabix.
endif.
endloop.
09-18-2008 1:47 PM