Page 1 of 1

Runtime error in USEREXIT_CHECK_XVBAP_FOR_DELET

PostPosted: Fri Jun 27, 2014 6:15 am
by bart jongen
Dear,

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.

This goes well;
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.

Re: Runtime error in USEREXIT_CHECK_XVBAP_FOR_DELET

PostPosted: Fri Jun 27, 2014 8:16 am
by Gothmog
You can't use a type 'E' (or 'W' message) when deleting a sales order.
either:
- use an 'I' message (us_exit = charx is sufficient to prevent the item deletion)
- first check if the whole order is deleted before issuing your message (not sure how, as the update indicator are not set yet - maybe FCODE = LOES)

You can also try to only send the message if US_ERROR = X.

Re: Runtime error in USEREXIT_CHECK_XVBAP_FOR_DELET

PostPosted: Mon Jun 30, 2014 4:03 am
by bart jongen
Hello Gothmog,

Thanks so much for your reply;
I made the e(rror) and i(nformation) message and that was the solution.
Thanks!