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: 

Custom error message in user exit is giving Short dump

vinod_vemuru2
Active Contributor
0 Kudos

Hi All,

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.

Error Analysis:

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.

Thanks,

Vinod.

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

you can differentiate with TRTYP for Delete it is 'V' so give information/warning message and leave program.

if t180-trtyp = 'V'.
 message i000(zz) with 'warning/information message'.
 leave program.
 
endif.

5 REPLIES 5

Former Member

0 Kudos

Hi Aparna,

Thanks for the reply. But in my case i want to stop deletion as well. So i can't put such check in this case. Also it is dumping when i press F5 at the message statement while the same statement is working in creation or change part. Any more inputs?

What i heard is SAP won't support error message while deleting the document. Is it true? If yes then is there any work around?

Thanks,

Vinod.

former_member188685
Active Contributor
0 Kudos

you can differentiate with TRTYP for Delete it is 'V' so give information/warning message and leave program.

if t180-trtyp = 'V'.
 message i000(zz) with 'warning/information message'.
 leave program.
 
endif.

0 Kudos

HI Vijay,

Thanks for the reply.

Is it safe to use LEAVE PROGRAM statement in user exit?

I feel it may cause inconsistencies. Any idea on why this strange scenario is happening/Any OSS notes?

Thanks,

Vinod.

0 Kudos

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.

and see...