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: 

modify internel table

Former Member
0 Kudos

Dear Experts,

i am modify one internel table.

for eg :

itab name is -->it_ekpo1

MAT NO ADD NO

1 10

2 10

3 10

4 15

I am Passing ADD NO to The ADRC(it_adrc) table. Pick the address.

for eg : 10 -


> should be one address.

15------>should be one address.

I am modify to (it_ekpo).

1---> 10>address(NOT STORED)

2 -- > 10-->address (stored)

3-> 10>address(NOT STORED)

4 > 15>address (stored)

My case same address will be stored in 1,2,3.

my code is.

select ADDRNUMBER name1 street STR_SUPPL1 STR_SUPPL3 location city1 post_code1 from adrc

into corresponding fields of table it_adrc for all entries in it_ekpo1

where ADDRNUMBER = it_ekpo1-adrn2.

loop at it_adrc into wa_adrc.

read table it_ekpo1 into wa_ekpo1 with key adrn2 = wa_adrc-ADDRNUMBER.

if sy-subrc = 0.

wa_ekpo1-adrn2 = wa_adrc-ADDRNUMBER.

wa_ekpo1-STR_SUPPL1 = wa_adrc-STR_SUPPL1.

wa_ekpo1-NAME1 = wa_adrc-NAME1.

wa_ekpo1-Street = wa_adrc-street.

wa_ekpo1-STR_SUPPL3 = wa_adrc-STR_SUPPL3.

wa_ekpo1-Location = wa_adrc-Location.

wa_ekpo1-city1 = wa_adrc-city1.

wa_ekpo1-POST_CODE1 = wa_adrc-POST_CODE1.

modify table it_ekpo1 from wa_ekpo1.

modify it_ekpo1 from wa_ekpo1 index sy-tabix.

endif.

endloop

PLZ HELP ME

regards,

raj

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

Just check this.

loop at it_adrc into wa_adrc.

read table it_ekpo1 into wa_ekpo1 with key adrn2 = wa_adrc-ADDRNUMBER.

if sy-subrc = 0.

wa_ekpo1-adrn2 = wa_adrc-ADDRNUMBER.

wa_ekpo1-STR_SUPPL1 = wa_adrc-STR_SUPPL1.

wa_ekpo1-NAME1 = wa_adrc-NAME1.

wa_ekpo1-Street = wa_adrc-street.

wa_ekpo1-STR_SUPPL3 = wa_adrc-STR_SUPPL3.

wa_ekpo1-Location = wa_adrc-Location.

wa_ekpo1-city1 = wa_adrc-city1.

wa_ekpo1-POST_CODE1 = wa_adrc-POST_CODE1.

modify table it_ekpo1 from wa_ekpo1 where adrn2 = wa_adrc-ADDRNUMBER. "<----


endif.

endloop.

its better to Go for loop at it_ekpo1 and read table it_adrc and perform this action.

3 REPLIES 3

Sm1tje
Active Contributor
0 Kudos

use the LOOP AT ....ASSIGNING variant.

Former Member
0 Kudos

Though your question is not very clear, i think MODIFY with a where clause on addr_number should help you out.

Please if possible just write your problem once more.

kesavadas_thekkillath
Active Contributor
0 Kudos

Just check this.

loop at it_adrc into wa_adrc.

read table it_ekpo1 into wa_ekpo1 with key adrn2 = wa_adrc-ADDRNUMBER.

if sy-subrc = 0.

wa_ekpo1-adrn2 = wa_adrc-ADDRNUMBER.

wa_ekpo1-STR_SUPPL1 = wa_adrc-STR_SUPPL1.

wa_ekpo1-NAME1 = wa_adrc-NAME1.

wa_ekpo1-Street = wa_adrc-street.

wa_ekpo1-STR_SUPPL3 = wa_adrc-STR_SUPPL3.

wa_ekpo1-Location = wa_adrc-Location.

wa_ekpo1-city1 = wa_adrc-city1.

wa_ekpo1-POST_CODE1 = wa_adrc-POST_CODE1.

modify table it_ekpo1 from wa_ekpo1 where adrn2 = wa_adrc-ADDRNUMBER. "<----


endif.

endloop.

its better to Go for loop at it_ekpo1 and read table it_adrc and perform this action.