Application Development and Automation 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: 
Read only

select

Former Member
0 Likes
1,300

hi to all,

in this the values of saknr and wrbtr were coming in header line they were not inserted to the body

can any one help me in solving this issue

loop at it_bseg2.

move it_bseg2-saknr1 to it_final-saknr1.

move it_bseg2-wrbtr to it_final-wrbtr1.

append it_final.(it-final already containing other values)

clear it_final.

endloop

thanks in advance

kiran kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,275

Hello Kiran if the it_final is already containing some values ..you need to read the table it_final and modify it.

loop at it_bseg2.

Read table it_final with key {key fields-document number}

move it_bseg2-saknr1 to it_final-saknr1.

move it_bseg2-wrbtr to it_final-wrbtr1.

modify it_final index sy-tabix.

clear it_final.

endloop

Message was edited by: Anurag Bankley

10 REPLIES 10
Read only

Former Member
0 Likes
1,275

Hi,

I think you are trying to fill the SAKNR and WRBTR from bseg in the final internal table which is already having some other fields. In that case read the final internal table in the Loop at it_bseg and then after populating the values modify the Final internal table instead of appending.

Hope this helps.

Read only

Former Member
0 Likes
1,276

Hello Kiran if the it_final is already containing some values ..you need to read the table it_final and modify it.

loop at it_bseg2.

Read table it_final with key {key fields-document number}

move it_bseg2-saknr1 to it_final-saknr1.

move it_bseg2-wrbtr to it_final-wrbtr1.

modify it_final index sy-tabix.

clear it_final.

endloop

Message was edited by: Anurag Bankley

Read only

0 Likes
1,275

Do it like this -:)


Data: w_tabix type sy-tabix.

loop at it_bseg2.
w_tabix = sy-tabix.
Read table it_final with key {key fields-document number}
move it_bseg2-saknr1 to it_final-saknr1.
move it_bseg2-wrbtr to it_final-wrbtr1.
modify it_final index w_tabix
transporting saknr1 wrbtr1.
clear it_final.
endloop

Using transporting, you don't mess with the exiting values -;)

Greetings,

Blag.

Read only

0 Likes
1,275

HI Kiran,

Use collect it_final statement instead of append.

hope it works.

regards

Read only

0 Likes
1,275

hi anurag

i have done this but it is transporting the wrbtr which is there in it_final before and keeping it here.

there is any option in modify statemnt that transporting no fields like

Read only

0 Likes
1,275

Yes there is a variation in MODIFY statement for the same.

Example->

MODIFY it_zwms FROM p_is_zwms TRANSPORTING menge zerfm5

WHERE zwmsc = work-wmsc

AND matnr = p_is_zwms-matnr.

Read only

Former Member
0 Likes
1,275

hi Kiran,

Read table statement is missing..

i.e,

loop at it_bseg2.
<b>read table it_final with key ..</b>
move it_bseg2-saknr1 to it_final-saknr1.
move it_bseg2-wrbtr to it_final-wrbtr1.
append it_final.(it-final already containing other values)
clear it_final.
endloop

Read only

Former Member
0 Likes
1,275

hi,

Instead of appending the data to the final internal table first you need to read that particular row with key field and then modify that row with the fields saknr1 and wrbtr.

loop at it_bseg2.
 read table it_final with key {key-field}
 move it_bseg2-saknr1 to it_final-saknr1.
 move it_bseg2-wrbtr to it_final-wrbtr1.
 <b>modify it_final index sy-tabix</b>.: You should not append, use modify
 clear it_final.
endloop

Regards,

Richa

Read only

Former Member
0 Likes
1,275

Hi,

Follwo below logic

loop at it_bseg2.

read table it_final with key bukrs = it_bseg-bukrs

belnr = it_bseg2-belnr.

if sy-subrc eq 0.

lv_index = sy-tabix.

move it_bseg2-saknr1 to it_final-saknr1.

move it_bseg2-wrbtr to it_final-wrbtr1.

modify it_final index lv_index.

clear lv_index.

endif.

endloop

Regards

Amole

Read only

Former Member
0 Likes
1,275

hi,

Remove the code in bold italics. Insert the code which is in bold.

loop at it_bseg2.

<b> clear it_final.

read table it_final with key fld = it_bseg2-fld1.

if sy-subrc = 0.</b>

move it_bseg2-saknr1 to it_final-saknr1.

move it_bseg2-wrbtr to it_final-wrbtr1.

<b> modify it_final index sy-tabix.</b>

<b><i>append it_final.(it-final already containing other values)

clear it_final.

</i></b>

endif.

endloop

Regards,

Sailaja.