Application Development 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: 

problem in for all entries

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

10 REPLIES 10

Former Member
0 Kudos

you use

for all entries in it1 .

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

i used the condition code = it1_code

it s not working

we r populating it1 from some existing function module.

0 Kudos

>

> i used the condition code = it1_code

> it s not working

.

You need to use it1-code instead.

0 Kudos

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 .

Former Member
0 Kudos

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.

Former Member
0 Kudos

Thanks to every one .Problem solved.