I have programmed USEREXIT_CHECK_XVBAP_FOR_DELET in include MV45AFZB, but run into a runtime error.
Source code is as follows:
Code: Select all
DATA: lv_auart TYPE auart. SELECT SINGLE auart FROM zzordertype INTO lv_auart. IF xvbak-auart EQ lv_auart. us_exit = charx. ENDIF. IF us_exit NE space. MESSAGE e001(zbj4). ENDIF.
I have maintained with SM31 (just/only) an Order type Z123 in table ZZORDERTYPE.
When I create a Sales order with Order type TA (so <> Z123), I can delete the Sales order item (in debugging, us_exit does not become X, it stays blank).
If I do the same with an Order type Z123, in debugging, us_exit becomes X, and accordingly I cannot delete the item.
In that latter case, also the Message appears, all good so far.
There is only one problem: when I try to delete an Order (of type Z123) as a whole, so via VA02 > Sales document > Delete (Do you really want to delete Order xxx ?, I clicked YES), then I get the following runtime error:
DYNPRO_MSG_IN_HELP, Short text: Screen: Illegal message, Error analysis: The program attempted to issue a “ “message during “Exit Command” processing. This is an illegal operation. This is probably due to an error in the ABAP program or in the current screen.
Does anyone know how I can change my code in order to prevent the runtime error from happening?
Thanks so much in advance for your replies.