10-09-2007 11:13 AM
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?
10-09-2007 11:16 AM
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
10-11-2007 10:10 AM
I have tried this.
But this is not working.
Pls tell me the right way to do this.
Points will be awarded sure...
10-11-2007 10:18 AM
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.
10-11-2007 11:09 AM
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
10-11-2007 11:48 AM
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.
10-11-2007 11:52 AM
Hi,
I hope the post was made for <b>Screen</b> and not <b>Selection Screen.</b>
Thanks and Regards,
Anindita
10-11-2007 12:12 PM
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.