cancel
Showing results for 
Search instead for 
Did you mean: 

Adding an Exception to EXIT_SAPLV56U_004

Former Member
0 Kudos

We have a requirement to exit out of EXIT_SAPLV56U_004 without saving under certain circumstances.  However, there is not an exception defined for FM EXIT_SAPLV56U_004.  We have tested out adding an exception to the FM and it does give us the functionality we need, but has anyone else tried to do this and encountered any issues we should be aware of before we adopt this as our final solution?   We have simply modified EXIT_SAPLV56U_004 to have the exception OTHERS and then added the RAISE OTHERS command in the userexit code. 

We appreciate any feedback from anyone who has either successfully implemented this same modification, or who has encountered issues after doing so.

Accepted Solutions (0)

Answers (1)

Answers (1)

shashi_thakur
Contributor
0 Kudos

Hi Erin,

Instead of adding an exception to the EXIT, would it not be better to instead move your code inside the Exit between an IF..ELSE..ENDIF block and add your specific logic to either the IF or the ELSE part.

Regards,

Shashi

Former Member
0 Kudos

Hi Shashi,

Thank you for your reply.  However, we did try a number of different ways of generating an error message within the userexit code. We found that, while it did send an error message, it would not stop the changes made to the order from actually saving as it progressed through the code past the call to the userexit. The only way we found to actually stop the save functionality and still have the transaction end cleanly was to add the exception.

Erin

shashi_thakur
Contributor
0 Kudos

Hi Erin,

If the requirement is to stop any further processing and make a clean exit then I understand that IF..ELSE..ENDIF won't work. Did you try setting sy-subrc = 1-as there is a check on the sy-subrc after the Exit where the processing gets stopped.

Regards,

Shashi

Former Member
0 Kudos

Hi Shashi,

Yes, we thought the same, but we found that any change to SY-SUBRC within the userexit was not retained when it returned to the main program. The only way we could get it to be retained is by raising the exception.

Erin

Shiva_Ram
Active Contributor
0 Kudos

I recommend you to post in ABAP development forum, where in you may get more responses/options.

Regards,

Former Member
0 Kudos

Also, I should say that we are fine with having made the modification to enable the exception, we were just concerned about any potential negative impacts to doing so. But it does appear to be working for our requirements, so if no one responds saying they encountered issues attempting to do the same, then we are happy.

Former Member
0 Kudos

Thank you for the suggestion Shiva!

shashi_thakur
Contributor
0 Kudos

Hi Erin,

I do not think you will face any negative impact due to the same as it is fairly straightforward change. Just keep a watch out during Patch upgrades, etc to ensure the changes are not lost. Although normally it shouldn't.

Regards,

Shashi