Custom error message in user exit is giving Short dump
We have a scenario where in if any user try to create/Change/Delete particular types of contract in SAP system we have to issue error message
saying ZIN/ZIR contract creation/Change/Deletion is blocked in SAP. This has to be done from the web application. So we are putting below code
in user exit MV45AFZZ in the form USEREXIT_SAVE_DOCUMENT_PREPARE.
CONSTANTS: lc_vbcpic01 TYPE sy-uname VALUE u2018VBCPIC01u2019, u201CWeb application user ID lc_zin TYPE vbak-auart VALUE u2018ZINu2019, lc_zir TYPE vbak-auart VALUE u2018ZIRu2019, lc_text(32) TYPE c VALUE u2018Check long text for more detailsu2019. DATA: l_uname TYPE sy-uname. CLEAR: l_uname. MOVE sy-uname TO l_uname. *If user ID is not the Web application ID then block the creation/Change/Deletion IF l_uname NE lc_vbcpic01 AND ( vbak-auart EQ lc_zin OR vbak-auart EQ lc_zir ). MESSAGE e830(zv) WITH lc_text. ENDIF.
This code is working fine while creating/Changing the contract i.e. Giving us error message so that user wonu2019t be able to create/change the contract.
But when we delete the contract from VA42, Control is coming to this message statement and is giving Short dump. Below is the error analysis of the dump.
During "Exit Command" processing, the program tried to send a " " message.
This is not allowed at this point in processing.
The program had to be terminated.
Screen name.............. "SAPMV45A"
Screen number............ 4001
If any one has come across such scenario/any work around for this problem please let me know your inputs. Your inputs are highly appreciated.
I am working on 4.6C version of SAP.
Note: When i issue information/Warning message contract is getting deleted after displaying the message.
I exactly replicated the same in DELETE_DOCUMENT also
I am getting the Dump. I tried with exit also , but it continued and deleted. To avoid deletion we have to use Leave program or LEAVE TO CURRENT TRANSACTION.
Delete Function is Defined as EXIT command. so it is not possible to give error message. To convice you i just copied demo program and raised the error message.
it is also giving the dump.
copy the demo program DEMO_DYNPRO_AT_EXIT_COMMAND and make this change , information to error .
MODULE cancel INPUT. MESSAGE e888(sabapdocu) WITH text-001 ok_code input1 input2. IF ok_code = 'CANCEL'. CLEAR ok_code. LEAVE PROGRAM. ENDIF. ENDMODULE.