Application Development and Automation 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: 

Display an error message without losing the options that user has input

Former Member
0 Kudos
1,920

Hello Everyone,

I have written a Z-function module(performing few validation check) and i'm calling it for t code fb50 on post event.

As requirement i am able display error message of type E and the program is stopped.

but i'm not able to return the screen without losing the user input's.

Currently i have to exit / hit back button from SAP menu and that does not help me to get user input values

Can anyone suggest how i can able to get the screen with user input values.

Thank you Guys

8 REPLIES 8

Former Member
0 Kudos
536

Hi,

You can use this:

MESSAGE "Text of Error Message" TYPE 'S' DISPLAY LIKE 'E'.

Regards,

Priyanka

0 Kudos
536

Hi ,

Add Below

include mm_messages_mac. "useful macros for message handling

if YOur Condition

mmpur_message_forced 'E' 'ME' '083' text-001 '' '' ''. " text-001 is text element => click on it and write your message and activate

endif.

regards

Deepak.

0 Kudos
536

Thank you Priyanka.

but it didnt work for me.

The error msg is displayed on status bar ,but still i have to click back button .

is it possible after display of error msg i hit enter and cursor goes to the filed for which the error has occurred.

Thanks,

DIGVIJAY

Former Member
0 Kudos
536

Hi,

you can give yours error message as information message or else you can use 'leave'

like- MESSAGE I011 WITH 'Please select SSN and Annual Salary field '.

LEAVE.

it will show the message and then will continue the previous functionality.

thanks ,

Khush

0 Kudos
536

Thank you Deepak. well it was new gud thing to learn for me.

but it didnt work for me.

The error msg is displayed on status bar ,but still i have to click back button .

is it possible after display of error msg i hit enter and cursor goes to the filed for which the error has occurred.

Thanks,

DIGVIJAY

0 Kudos
536

hi ,

Can you show code how you have used .

regards

Deepak.

Former Member
0 Kudos
536

Hi,

In the PAI of your screen make use of chain-endchain block and write those fields in 'field' statement which you want to be input ready and not lose the already entered data.

Suppose you had entered data in fields x,y,z and after displaying error message you want these fields to be input ready with already entered values in these fields.

You can refer the below code:

chain.

field x.

field y.

field z.

module input_ready.

endchain.

from inside the module 'input_ready' you can call your Z function module or can display error message.

module input_ready.

call function z....

endmodule.

Former Member
0 Kudos
536

Hi,

Try this code :

1. Before displaying error message just capture the selction field name in memory,like this(in AT SELECTION SCREEN event)

x = 'S_MAKT-LOW'. "x will be chararcter data type,it will have the field name of selction screen.

EXPORT x TO MEMORY ID 'X1X1'.

MESSAGE 'Error' type 'S' DISPLAY LIKE 'E'.

2. At selection screen output event type this code:

AT SELECTION-SCREEN OUTPUT.

IMPORT x FROM MEMORY ID 'X1X1'.

if x = 'S_MAKT-LOW'.

set CURSOR field 'S_MAKT-LOW'.

endif.

Regards,

Priyanka