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

Stop execution of a function

Former Member
0 Likes
1,522

Hi all

In the user exit MV45AFZZ, I would like to stop the delete processing in some case and throwing a message to the user.

MV45AFZZ:

 
FORM userexit_delete_document.

  if A > B.
    Stop process and throw message.
  endif.

ENDFORM.                    "USEREXIT_DELETE_DOCUMENT

Can someone tell me how to do so?

Thank you.

Olivier D.

6 REPLIES 6
Read only

Former Member
0 Likes
1,036

Can you try this -


 
FORM userexit_delete_document.
 
  if A > B.
"    Stop process and throw message.
 Message E000(YOUR MESSAGE CLASS) WITH TEXT-NNN.  "
  endif.
 
ENDFORM.                    "USEREXIT_DELETE_DOCUMENT


Read only

Former Member
0 Likes
1,036

Use this:

Please find the exceptions in that user exit and assign the value of sy-subrc accordingly.

if A > B.
    sy-subrc = n.
    EXIT.
  endif.

OR

if A > B.
    Message E000(ZMC) with 'your message'.
  endif.

Thanks and Regards

Read only

Former Member
0 Likes
1,036

HI Joskin,

if A > B.

" Stop process and throw message.

message 'Error Occured' type 'E'.

endif.

Try this type logic.

Regards,

Vijay

Read only

Former Member
0 Likes
1,036

HI ,

1) You raise error message at particular condition without terminationg your program , only terminate the Routine .

FORM userexit_delete_document.

if A > B.

message lv_message display like 'E'.

endif.

ENDFORM. "USEREXIT_DELETE_DOCUMENT

2) if u want to terminate the program , then code is...........

FORM userexit_delete_document.

if A > B.

raise message

stop. (keyword)

endif.

ENDFORM. "USEREXIT_DELETE_DOCUMENT

Thanks

Shambhu

Read only

Former Member
0 Likes
1,036

Use CHECK or RETURN.

See F1 help for more details.

Regards

Karthik D

Read only

Former Member
0 Likes
1,036

Hi,

USe the code mentioned below:

FORM userexit_delete_document.

if A > B.

Message E000(MESSAGE CLASS).

endif.

ENDFORM. "USEREXIT_DELETE_DOCUMENT

You can pass message text in SE91 under message classes available with you.

Or just double click on the E000, to create a new message.

Regds,

Anil