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

exit.

Former Member
0 Likes
400

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

2 REPLIES 2
Read only

ferry_lianto
Active Contributor
0 Likes
380

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

Read only

Former Member
0 Likes
380

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