cancel
Showing results for 
Search instead for 
Did you mean: 

ME59N - write custom error message to the spool?

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

JL23
Active Contributor

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

Answers (2)

Answers (2)

Jelena
Active Contributor

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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 🙂