12-22-2015 7:30 AM
Hi All,
I am validating a parameter on selection screen for which I need to display the error message in a pop-up and I tried doing that with many of the FMs but when I am executing even after the error message the rest of the code is executing this should not happen. Therefore kindly suggest me the FMs by which I can only stay to the selection screen , and do not navigate to the rest of the code.
Thanks,
Tanya Sachan
12-22-2015 7:52 AM
Hi Tanya,
Use statement 'STOP' at the end of the FM.
Check the below code for reference.
PARAMETERS: p_rad TYPE char1.
AT SELECTION-SCREEN.
IF p_rad NE 'A'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Error'
txt1 = 'Incorrect Parameter'
txt2 = ''.
STOP.
ENDIF.
START-OF-SELECTION.
WRITE:/ 'Entered Parameter -', p_rad.
Reward if helpful.
Regards
Abhishek
12-22-2015 7:48 AM
Hi,
it depends of the program. You could use STOP statement in a standard report, you could LEAVE TO SCREEN ...
where are you in your code?
regards
Fred
12-22-2015 8:28 AM
12-22-2015 7:52 AM
Hi Tanya,
Use statement 'STOP' at the end of the FM.
Check the below code for reference.
PARAMETERS: p_rad TYPE char1.
AT SELECTION-SCREEN.
IF p_rad NE 'A'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Error'
txt1 = 'Incorrect Parameter'
txt2 = ''.
STOP.
ENDIF.
START-OF-SELECTION.
WRITE:/ 'Entered Parameter -', p_rad.
Reward if helpful.
Regards
Abhishek
12-22-2015 7:55 AM
Hi ,
If you are calling any function module to display the Pop up, just add the statement Leave screen below that.
Thanks,
Karthikeyan
12-22-2015 7:58 AM
Hi Tanya,
Can you use LEAVE LIST-PROCESSING after the FM.
For Example:
PARAMETERS p_test TYPE char10.
IF p_test = '10'.
MESSAGE 'Stop' TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
WRITE :'Success'.
Still if you failed then please post your code, I will definitely give you some Idea.
Thanks,
Satya
12-22-2015 8:05 AM
Add your validation at 'AT SELECTION SCREEN' event.
Message 'text here' TYPE E' DISPLAY LIKE 'I'.
LEAVE LIST PROCESSING.
Sample Code:
PARAMETERS: p_text TYPE string.
AT SELECTION-SCREEN.
IF p_text NE 'abc'.
MESSAGE 'TEST' TYPE 'E' DISPLAY LIKE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
WRITE: 'A'.
12-22-2015 10:25 AM
Why don't you use simple code like
AT SELECTION-SCREEN ON p_matnr.
SELECT COUNT(*) FROM mara WHERE matnr EQ p_matnr.
IF sy-subrc NE 0.
MESSAGE e305(m3) WITH p_matnr DISPLAY LIKE 'I'.
ENDIF.
No FM and no leave, stop, exotic statement, etc. should be required, this is basic selection-screen logic, isn't it?
Regards,
Raymond