Application Development 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: 

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

Former Member
0 Kudos

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

13 REPLIES 13

paul_bakker2
Active Contributor
0 Kudos

Hi , what does the long text say?

What is PGI?

Former Member
0 Kudos

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

0 Kudos

Hi, thanks for your answer.

The problema continue, if I clear the variable wa_zaehl no display de abend message but not is posible modify the document.

How to cancel the PGI without message type E?

Thank in advance.

0 Kudos

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.

aditya_j
Explorer
0 Kudos

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.

Former Member
0 Kudos

Hi Aditya,

I'm tray this but I have the same problem.

This my code:

  IF ( t180-trtyp EQ 'V' OR    "Change

       t180-trtyp EQ 'H' ) AND "Add

     ( xlikp-lfart EQ 'LF' OR    "Entrega a clientes

       xlikp-lfart EQ 'LR' ) AND "Translados

       xlikp-vkorg  EQ '4000' AND

       sy-ucomm EQ 'WABU_T'.     "Contabilización


    DATA: ls_xvbpa TYPE vbpavb.

    DATA  lt_xvbpa TYPE STANDARD TABLE OF vbpavb.


    lt_xvbpa[] = xvbpa[].


*   Trato de leer los datos del transportista.

    READ TABLE lt_xvbpa WITH KEY parvw = 'SP'

                     INTO  ls_xvbpa.


*   El campo transportista no esta cargado

    IF sy-subrc NE 0 OR ls_xvbpa-lifnr IS INITIAL.

*      CLEAR wa_zaehl.

      ROLLBACK WORK.

      MESSAGE e001 WITH 'Completar el transportista.'.

    ENDIF.


  ENDIF.

In the code i'm copy the table xvbpa to internal table but not work.

Thanks in Adv.


Matías

0 Kudos

Hi Matias,

Did you try this type of message option but keep the ROLLBACK WORK?


MESSAGE i001 WITH 'Completar el transportista.' DISPLAY LIKE 'E'.

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Ryan,

The problem with this type of message is that not cancel the execution and ends completely.

0 Kudos

Hi Matias,

If you execute a ROLLBACK before showing the message though then no changes should be saved just as Aditya has mentioned that they have done before.  You should get your message to display but no changes should be made to the delivery.

Regards,

Ryan Crosby

Former Member
0 Kudos

I need execute transaction VL09 to cancel the document create after display message and execute the rollback.

0 Kudos

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.

former_member681577
Discoverer

I faced the same problem , to resolve this I just used enhancement spot from FM : MB_CREATE_GOODS_ISSUE_ITEM for my code and it is working fine .

venky1
Explorer

Hi,

Just implement the BADI LE_SHP_GOODSMOVEMENT, and populate the ct_log parameter with the error message in the implementation class method IF_EX_LE_SHP_GOODSMOVEMENT~CHANGE_INPUT_HEADER_AND_ITEMS. It perfectly works, without any issues.