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

Multiple selection gives wrong output

jogeswararao_kavala
Active Contributor
0 Likes
753

Dear Experts,

The following code gives wrong output of field caprq when queried for multiple values of selection parameter.

(More selection values, more reduction in the ourput value of caprq)

The selection field is ARBPL. Working with order tables: (AFKO, AUFK, AFVC, AFVV etc)

clear: wa.

loop at itab into wa.
   clear: wa1.
   read table itab1 into wa1 with key aufnr = wa-aufnr vornr = wa-vornr.

   if sy-subrc = 0.
   wa-vgw01 = wa1-vgw01.
   wa-caprq = wa-remng * wa-vgw01.
   modify itab from wa transporting vgw01 caprq.
   endif.
   endloop.

Any clues?

kind regards

Jogeswara Rao

1 ACCEPTED SOLUTION
Read only

yogendra_bhaskar
Contributor
0 Likes
716

Hi Jogeswara Rao ,

Clear the work area wa inside the loop after modify statement .


loop at itab into wa.
   clear: wa1.
   read table itab1 into wa1 with key aufnr = wa-aufnr vornr = wa-vornr.

   if sy-subrc = 0.
   wa-vgw01 = wa1-vgw01.
   wa-caprq = wa-remng * wa-vgw01.
   modify itab from wa transporting vgw01 caprq.
   endif.

    clear: wa.
   endloop.

Regards ,

Yogendra Bhaskar

5 REPLIES 5
Read only

yogendra_bhaskar
Contributor
0 Likes
717

Hi Jogeswara Rao ,

Clear the work area wa inside the loop after modify statement .


loop at itab into wa.
   clear: wa1.
   read table itab1 into wa1 with key aufnr = wa-aufnr vornr = wa-vornr.

   if sy-subrc = 0.
   wa-vgw01 = wa1-vgw01.
   wa-caprq = wa-remng * wa-vgw01.
   modify itab from wa transporting vgw01 caprq.
   endif.

    clear: wa.
   endloop.

Regards ,

Yogendra Bhaskar

Read only

0 Likes
716

Dear  Jogeswara Rao ,

Write   clear wa after the Modify statement .

loop at itab into wa.
   clear: wa1.
   read table itab1 into wa1 with key aufnr = wa-aufnr vornr = wa-vornr.

   if sy-subrc = 0.
   wa-vgw01 = wa1-vgw01.
   wa-caprq = wa-remng * wa-vgw01.
   modify itab from wa transporting vgw01 caprq.
   endif.

    clear wa.
   endloop.

Regards

Kedar

Read only

Former Member
0 Likes
716

I don't understand your requirement. It will be more helpful if you give example data and expected output.

Regards,

Jake

Read only

0 Likes
716

Thanks for responding everyone.

The issue has been resolved.

Clear wa at suggested place in combination with a change of code at one line 'delete adjacent duplicates'  worked.

Thank you all.

Read only

0 Likes
716

Marvelous