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 internal table

Former Member
0 Kudos

here i need to modify the field name v_newqty in it_fg_xvbap-kwmeng.........by using modify or another ...but i need to send the v_newqty value to the it_fg_xvbap-kwmeng...

if not it_zfreegoods[] is initial.

loop at it_fg_xvbap.

read table it_zfreegoods with key matnr = it_fg_xvbap-matnr.

if sy-subrc eq 0.

v_mitem1_qty = it_fg_xvbap-kwmeng.

****

v_quantity = it_zfreegoods-quantity.

****

clear v_lines.

continue.

endif.

v_lines = v_lines + 1.

if it_zfreegoods-zfreemodel eq it_fg_xvbap-matnr.

******

v_newqty = v_quantity - it_fg_xvbap-kwmeng.

******

******

  • v_mitem2_qty = it_fg_xvbap-kwmeng.

    • v_newqty = it_fg_xvbap-kwmeng.

  • v_mixitem_qty = v_mitem1_qty + v_mitem2_qty.

v_quantity = v_mitem1_qty + v_newqty.

******

  • modify xvbap from it_fg_xvbap.

  • if v_mixitem_qty ne it_zfreegoods-quantity.

if v_quantity ne it_zfreegoods-quantity.

if fcode eq 'SICH'.

message e020(zsnd) with it_zfreegoods-quantity .

else.

message s020(zsnd) with it_zfreegoods-quantity .

endif.

endif.

endif.

endloop.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Madhu,

Make the change like this:


if not it_zfreegoods[] is initial.

loop at it_fg_xvbap.

read table it_zfreegoods with key matnr = it_fg_xvbap-matnr.
if sy-subrc eq 0.
v_mitem1_qty = it_fg_xvbap-kwmeng.
****
v_quantity = it_zfreegoods-quantity.
****
clear v_lines.
continue.
endif.
v_lines = v_lines + 1.

if it_zfreegoods-zfreemodel eq it_fg_xvbap-matnr.

******
v_newqty = v_quantity - it_fg_xvbap-kwmeng.

******
******
* v_mitem2_qty = it_fg_xvbap-kwmeng.
** v_newqty = it_fg_xvbap-kwmeng.


* v_mixitem_qty = v_mitem1_qty + v_mitem2_qty.

 it_fg_xvbap-kwmeng = V_NEWQTY . " Check here
v_quantity = v_mitem1_qty + v_newqty.
******
modify xvbap.  " Check here


* if v_mixitem_qty ne it_zfreegoods-quantity.
if v_quantity ne it_zfreegoods-quantity.
if fcode eq 'SICH'.
message e020(zsnd) with it_zfreegoods-quantity .
else.
message s020(zsnd) with it_zfreegoods-quantity .
endif.
endif.

endif.

REgards,
VAsanth
endloop.

2 REPLIES 2

Former Member
0 Kudos

Hello Madhu,

Make the change like this:


if not it_zfreegoods[] is initial.

loop at it_fg_xvbap.

read table it_zfreegoods with key matnr = it_fg_xvbap-matnr.
if sy-subrc eq 0.
v_mitem1_qty = it_fg_xvbap-kwmeng.
****
v_quantity = it_zfreegoods-quantity.
****
clear v_lines.
continue.
endif.
v_lines = v_lines + 1.

if it_zfreegoods-zfreemodel eq it_fg_xvbap-matnr.

******
v_newqty = v_quantity - it_fg_xvbap-kwmeng.

******
******
* v_mitem2_qty = it_fg_xvbap-kwmeng.
** v_newqty = it_fg_xvbap-kwmeng.


* v_mixitem_qty = v_mitem1_qty + v_mitem2_qty.

 it_fg_xvbap-kwmeng = V_NEWQTY . " Check here
v_quantity = v_mitem1_qty + v_newqty.
******
modify xvbap.  " Check here


* if v_mixitem_qty ne it_zfreegoods-quantity.
if v_quantity ne it_zfreegoods-quantity.
if fcode eq 'SICH'.
message e020(zsnd) with it_zfreegoods-quantity .
else.
message s020(zsnd) with it_zfreegoods-quantity .
endif.
endif.

endif.

REgards,
VAsanth
endloop.

Former Member
0 Kudos

first declare a variable

data : cnt like sy-tabix .

2. increment the value in the loop as

cnt = cnt + 1.

3. Modify the internal table first for the value v_newqty

modify it_fg_xvbap index cnt transporting <field> .

4. once all the changes are captured in ur internal table then modify the

table xvbap using this internal table

modify xvbap from it_fg_xvbap.

Regards,

Vijay