‎2007 Mar 13 8:20 PM
HELLO,
I need to make exit if the v_newqty is graterthan 6 or lessthan 0 message should come and not allow me to create the order........please correct the code in bold...
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.
if it_zfreegoods-matnr ne it_fg_xvbap-matnr.
it_fg_xvbap-kwmeng = it_fg_xvbap-kmpmg.
modify it_fg_xvbap.
endif.
v_lines = v_lines + 1.
if it_zfreegoods-zfreemodel eq it_fg_xvbap-matnr.
v_newqty = v_quantity - it_fg_xvbap-lsmeng.
<b> if v_newqty < 0.
exit.
else.
endif.</b>
it_fg_xvbap-kwmeng = v_newqty.
modify 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.
xvbap[] = it_fg_xvbap[].
endif. " it_zfreegoods table
‎2007 Mar 13 8:24 PM
Hi,
Please try something like this.
...
if v_newqty > 6 or v_newqty < 0.
message E899(BD) with 'incorrect new quantity'.
endif.
...
Regards,
Ferry Lianto
‎2007 Mar 13 9:15 PM
Hi Madhu,
'Exit' statement will take you back to the called statement of subroutine. To terminate the transation, You have to write an error message . (STOP. statement is not permitted by SAP and abend is also not expected)
-Audy