Skip to Content
avatar image
Former Member

Problem when error message in exit Save document prepare(MV50AFZ1) on PGI

Hi,

I am using USER_EXIT_DOCUMENT_PREPARE for throwing error message during PGI. The error triggers properly, but after that if I press enter button, the program ends with an ABEND error "Risk of posting several mat.documents for one delivery->long text".

In the EXIT code no change any data, only check, and when I comment exit code the PGI finish without problems.

when press save and not PGI, message error finish OK.

I have SAP 460c.

Thanks in Adv.

Regards

Matías

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Dec 27, 2014 at 08:52 PM

    Hi,

    Best practice is not to use error messages/avoid them while writing exits.

    Kindly check if you could use below mentioned perform of SAPMV50A for desired error handling

            PERFORM message_handling(SAPMV50A) USING

                                           <item#>

                                           <number>

                                           <type>

                                           <id>

                                           <msgv1>

                                           <msgv2>

                                           <msgv3>

                                           <msgv4> IF FOUND.

    As you said, your  transaction works well when you comment the code hence it has something to do with exit code.

    Thanks

    Mohit

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Matias,

      I have faced same issue with same exit. This message is coming because you are trying to display error message in user exit. If you comment your error message and execute whole procedure, it will work as per standard SAP.

      So, eventually we dropped the requirement of displaying error message through this user exit. We didn't get any resolution for this issue.

  • Dec 28, 2014 at 08:52 AM

    Hi Matias,

    We recently had to do a similar thing in one of our projects. We used the ROLLBACK WORK statement before displaying the error message in USEREXIT_SAVE_DOCUMENT_PREPARE. This worked as required for us. Please try and let us know whether it works for you.

    Note that this will not save the delivery. If you want the logic to execute only when the PGI button is pressed, check the value in the SY-UCOMM variable.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Matias,

      I think values will go in XVBPA only if the partner functions have been updated in the transaction. As such, it may not always have a value. You can check in the debugger which of VBPA, XVBPA and related tables are having values. Depending on the situation, you might need to read data from the appropriate table.

      If you need to execute cancel document after displaying the error message, then you need the DISPLAY LIKE option, as mentioned by Ryan to continue processing after the message display.

  • Dec 27, 2014 at 08:42 PM

    Hi , what does the long text say?

    What is PGI?

    Add comment
    10|10000 characters needed characters exceeded