10-21-2009 2:55 AM
Hello frnds,
I need to display a error msg on selection screen if no data is found for the inputs on the selection screen.
If i give the error msg in START-OF-SELECTION then after error msg the screen does not remain on the selection screen bt comes back to sap start screen.
N if i display my error msg in AT SELECTION SCREEN event den the msg is called even when the user presses enter on the selection screen.
I need to display error msg n also the selection screen to be displayed bt nt when user presses enter.
Currently im checking sy-ucomm in AT LINE SELECTION and running it only when its ONLI i.e execute.... Kindly suggest some other ways of doing it
10-21-2009 4:19 AM
Hi,
This is always a fun one to work with. I would remove your message from the selection scree and in your program after start of selection when you figure out there is no data you can use this FM to pop up a message. POPUP_TO_DISPLAY_VALUE. Once closed it should go back to the selection scree.
thanks.
JB
10-21-2009 5:06 AM
Hi,
Use the display like E addition to a success message. It will come back to the selection screen
MESSAGE 'Error Message' TYPE 'S' display like 'E'.
Vikranth
10-21-2009 6:09 AM
Hi,
Try using
1. AT SELECTION-SCREEN ON ,variable name> OR
2.Message s000(zmsg) with "gfgbhgbn" display like E. Will definetly help you out.
Pooja
10-21-2009 6:20 AM
Hi,
An alternative approach is to use an INFORMATION MESSAGE
Refer:-
In the START-OF-SELECTION i put a select query and if no data is found i need to display a message and come back to selection scren.
START-OF-SELECTION
SELECT <field1, field2, ....>
FROM mara
INTO it_material
WHERE <condition>.
IF sy-subrc NE 0.
MESSAGE 'No Data Found' TYPE 'I'. "<--display you message here
STOP. "<--this will take you to END-OF-SELECTION
ENDIF.
IF NOT it_material[] IS INITIAL.
"other code
ENDIF.
END-OF-SELECTION.
IF NOT it_material[] IS INITIAL.
"other code
ENDIF.
Since conditions are used in END-OF-SELECTION as well so no code will be executed when no data is found.
So an information message is displayed to user and no further code is executed and the selection screen is returned after user clicks on the information message.
Hope this helps you.
Let me know in case of confusion.
Regards,
Tarun
10-21-2009 6:24 AM
Hi Amit,
just code the following into your code:
while performing select in the perform:
select f1 f2
from DB
into table itab
where f1 in so_f1.
if itab[] is not initial.
coding....
else.
MESSAGE S000(DB) WITH TEXT-010.
endif.
this would solve the problem....
Thanks
10-21-2009 6:31 AM
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'ONLI'..
if < condiction > true.
SSCRFIELDS-UCOMM = ' ' .
message 'error' type 'E'.
endif.
endif.
Edited by: Pramoth CG on Oct 21, 2009 11:15 AM
10-21-2009 6:40 AM
hi Amit,
Try this
AT SELECTION-SCREEN.
PERFORM TESTRUN_CHECK USING TESTRUN .
FORM TESTRUN_CHECK USING P_TESTRUN.
if p_testrun ne 'X' .
message w999(zm) with text-503 ."#EC *
endif.
ENDFORM.
or
AT SELECTION-SCREEN.
-
-
etc
SELECT SINGLE * FROM T001 WHERE BUKRS = P_BUKRS.
IF SY-SUBRC NE 0 .
MESSAGE E999(ZM) WITH TEXT-500 .
ENDIF.
-
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INPUT
from kallam
10-21-2009 12:50 PM
Hi Amit,
As per your requirement, you can use the below code at the Event START-OF-SELECTION.
Have a look at the below code snippet and you will have an idea.
1) SELECTION-SCREEN begin of block b1.
PARAMETER: p_input TYPE text100.
PARAMETER: p_input1 TYPE text100.
SELECTION-SCREEN end of block b1.
START-OF-SELECTION.
IF p_input IS INITIAL OR p_input1 IS INITIAL.
MESSAGE 'NO VALUES IN SELECTION SCREEN' TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
END-OF-SELECTION.
Suppose, if you are ought to achieve this requirement in a report program and if a T-Code is assigned to it, then you can use the below one too.
2) SELECTION-SCREEN begin of block b1.
PARAMETER: p_input TYPE text100.
PARAMETER: p_input1 TYPE text100.
SELECTION-SCREEN end of block b1.
START-OF-SELECTION.
IF p_input IS INITIAL OR p_input1 IS INITIAL.
MESSAGE 'NO VALUES IN SELECTION SCREEN' TYPE 'I'.
LEAVE TO CURRENT TRANSACTION.
ENDIF.
END-OF-SELECTION.
In both the cases you will be back to the selection screen after displaying the message.
Thanks,
Sudha.
02-28-2022 11:25 AM
Message 'Error Message' type 'S' display like 'E'.
EXIT.
Type S will process the next line but exit will take you out from current processing. Display like 'E' will show the error like message on screen.