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: 

field values

Former Member
0 Kudos

Hello,

I need to insert a code which is in bold but it is not consider there.......can you suggest how can i update that field values....it_fg_xvbap-kmpmg into it_fg_xvbap-kwmeng if the material zfreegoods-matnr is not equal to it_fg_xvbap-matnr..

correct the code..

it_fg_xvbap[] = xvbap[].

if not it_fg_xvbap[] is initial.

read table it_fg_xvbap index 1.

select * from zfreegoods into table it_zfreegoods

for all entries in it_fg_xvbap

where matnr eq it_fg_xvbap-matnr

and zpromotype eq '04'.

  • Check if the BOM is completely exploded for mix-match.

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.

<b> if it_zfreegoods-matnr ne it_fg_xvbap-matnr.

it_fg_xvbap-kwmeng = it_fg_xvbap-kmpmg.

clear v_lines.

continue.

endif.</b>

endif.

v_lines = v_lines + 1.

if it_zfreegoods-zfreemodel eq it_fg_xvbap-matnr.

v_newqty = v_quantity - it_fg_xvbap-kwmeng.

it_fg_xvbap-kwmeng = v_newqty.

modify it_fg_xvbap.

3 REPLIES 3

Former Member
0 Kudos

put modify statement inside the if condition also.

if it_zfreegoods-matnr ne it_fg_xvbap-matnr.

it_fg_xvbap-kwmeng = it_fg_xvbap-kmpmg.

modify it_fg_xvbap.

clear v_lines.

continue.

endif.

endif.

Former Member
0 Kudos

Hi,

You didn't give the MODIFY statement to update the internal table..

if it_zfreegoods-matnr ne it_fg_xvbap-matnr.

it_fg_xvbap-kwmeng = it_fg_xvbap-kmpmg.

clear v_lines.

<b>MODIFY it_fg_xvbap transporting kwmeng.</b>

continue.

endif.

endif.

Thanks,

Naren

Former Member
0 Kudos

Hello Madhu,

I think this code will work for ur requirement.


t_fg_xvbap[] = xvbap[].

if not it_fg_xvbap[] is initial.
read table it_fg_xvbap index 1.
select * from zfreegoods into table it_zfreegoods
for all entries in it_fg_xvbap
where matnr eq it_fg_xvbap-matnr
and zpromotype eq '04'.
* Check if the BOM is completely exploded for mix-match.
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.  " Check here. If sy-subrc ne 0 move the field vale and modify the "table
v_mitem1_qty = it_fg_xvbap-kwmeng.
v_quantity = it_zfreegoods-quantity.
* clear v_lines.
* continue.
if it_zfreegoods-matnr ne it_fg_xvbap-matnr.
it_fg_xvbap-kwmeng = it_fg_xvbap-kmpmg.
clear v_lines.
continue.
endif.
endif.
v_lines = v_lines + 1.

REgards,
Vasanth
if it_zfreegoods-zfreemodel eq it_fg_xvbap-matnr.
v_newqty = v_quantity - it_fg_xvbap-kwmeng.
it_fg_xvbap-kwmeng = v_newqty.
modify it_fg_xvbap.