12-27-2014 2:24 PM
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
12-27-2014 8:42 PM
12-27-2014 8: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
12-27-2014 11:42 PM
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.
12-28-2014 4:59 AM
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.
12-28-2014 8: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.
12-29-2014 1:13 PM
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
12-29-2014 1:54 PM
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
12-29-2014 3:35 PM
Hi Ryan,
The problem with this type of message is that not cancel the execution and ends completely.
12-29-2014 3:56 PM
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
12-29-2014 3:59 PM
I need execute transaction VL09 to cancel the document create after display message and execute the rollback.
12-30-2014 1:15 PM
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.
06-03-2020 2:30 PM
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 .
07-16-2020 1:13 PM
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.