Skip to Content
0

ME59N - write custom error message to the spool?

Dec 06, 2016 at 08:42 AM

275

avatar image

Dear SAP People,

The change is for ME59N and ME59 transactions.

Problem is with ME59N transaction.

The requirement is to check whether the doc.type at header level and item category of the line item in the purchase requisition go hand in hand or not? If not then the requirement is to stop creating the POs and raise a custom error message. So I found this enhancement: M06E0004, user exit EXIT_SAPLEBND_002 to write the code.

In foreground: When I try to raise a custom error message then, it is being displayed for the ME59 no problem there, but for ME59N the custom error message is going inside the detailed log. The message is there, not problem in foreground.

In background: only the header message " PO could not be created" is being written to the spool, even though I wrote explicitly using the FM GET_PRINT_PARAMS.

is there a way to overwrite the standard PO error mentioned above with the custom ones??

Please let me know.

--

With Regards,

Anirudh Vishwamithra.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Jürgen L
Dec 08, 2016 at 10:00 AM
2

Can it be that you missed to include the detailed log in the variant of your background job:

That is my spool file for example:

and finally the log which has the Z-messages


me59n.png (55.9 kB)
me59nspool.png (35.0 kB)
me59nlog.png (42.9 kB)
Share
10 |10000 characters needed characters left characters exceeded
Jelena Perfiljeva
Dec 06, 2016 at 07:06 PM
0

Messages are shown in the job log, not in spool. And I'd imagine that a GET... function does not write anything. I'm quite confused what you're doing and expecting exactly... Might want to clarify and post the code as well.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Jelena,

My question is when the ME59N transaction gets executed completely in the background. We see output something like this if a error exists:

In the below example I am running the transaction with only one PR.

But in real, The 1st error line has many other error's, we can find it if we execute it in the foreground. It will be something like this.

I want these messages are also to be displayed in the spool. Thats my requirement. Is there any way? Please suggest.

Thanks in advance.

--
With Regards,

Anirudh Vishwamithra.

spool.png (2.0 kB)
foreground.png (9.1 kB)
0

Hi Jelena,

please correct me if I am wrong. Job log displays in the foreground right? But when we execute the transaction ME59N in the background then the output ( error messages ) should be written in the spool. I am getting the print parameters by using the GET.. FM and then using write statement to write it to the spool.

But the custom message is being overwritten with the standard SAP message "PO NOT CREATED".

Please let me know how should I achieve this? What is the approach which needs to be followed? Thanks in advance.

--

With Regards,

Anirudh Vishwamithra.

0
Anirudh Vishwamithra Dec 08, 2016 at 11:13 AM
0

Thank you Jürgen L. This is what I am in need of. Thank you very much. I might have overlooked it. I will let my user base know about this. Thanks again :)

Share
10 |10000 characters needed characters left characters exceeded