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: 

Selection screen

Former Member
0 Kudos

Hi,

I have put a search help for a field in a screen.

And i also checked the value using value check addition.

If suppose i enter a value which doesn't matches with the input help,

then error message comes in the screen.

If i press a push button cancel in that screen,

then it has to come out.

How to do that?

7 REPLIES 7

Former Member
0 Kudos

Hi,

Declare a Pushbutton in the Selection screen, if after getting the Error mesage, then in the At selection screen event, you need to write the logic.

IF SY-UCOMM = 'OK_CODE' " OK code is the user command for th e push buton.

Leave program.

ENDIF.

Regards

Sudheer

Former Member
0 Kudos

I have tried this.

But this is not working.

Pls tell me the right way to do this.

Points will be awarded sure...

0 Kudos

hi Shori,

mayb the problem is because ur displaying an error msg i.e TYPE E,

change it to type 'S' OR 'I' and then try the logic.

Former Member
0 Kudos

For doing exit or cancel action with the push button, the function code of the button should be 'E'.

In PAI event, you have to write.

Case Sy-ucomm.

when 'OK_CODE'.

Leave screen.

endcase.

(here OK_CODE is the internal name of the push button)

Hope this will give you the desired result.

Reward if helpful.

Thanks and regards,

Anindita

Former Member
0 Kudos

u need to use at selection-screen event like as below:

at selection-screen.

if not <itabname-fieldname> is initial.

select single <fieldname> from <check_table_name> where <fieldname> = <check_table_name-fieldname>.

if sy-subrc <> 0.

message e001(classname).

endif.

endif.

for leaving the screen, u'll use function code of button in case statement like as follows:

data: ok_code like sy-ucomm.

case ok_code.

when 'LEAVE'.

leave program.

endcase.

0 Kudos

Hi,

I hope the post was made for <b>Screen</b> and not <b>Selection Screen.</b>

Thanks and Regards,

Anindita

Former Member
0 Kudos

The problem is arising because of the value-check addition. The program will not reach to the code written in "AT SELECTION-SCREEN" EVENT to leave the program because a system exception is occuring.

Try out by assigning the function code to function type 'E' and assigned to function key F12

If the above solution does not work then you have to remove the value-check addition with the field and programatically needs to validate the field in AT SELECTION-SCREEN EVENT.