10-13-2006 11:48 AM
Hi friends,
How to display a <b>popup</b> message if the user enters wrong values.
Thanx in advance,
Regards,
Parvez
10-13-2006 11:54 AM
Hi venu,
1. We should use
a) START-OF-SELECTION command
b) LEAVE LIST-PROCESSING
C) Message of type I (and not E)
2. LIKE THIS
3.
START-OF-SELECTION.
IF CONDITION-OF-WRONG-VALUE.
MESSAGE 'PLS ENTER CORRECT VALUE' TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
regards,
amit m.
10-13-2006 11:54 AM
Hi venu,
1. We should use
a) START-OF-SELECTION command
b) LEAVE LIST-PROCESSING
C) Message of type I (and not E)
2. LIKE THIS
3.
START-OF-SELECTION.
IF CONDITION-OF-WRONG-VALUE.
MESSAGE 'PLS ENTER CORRECT VALUE' TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
regards,
amit m.
10-13-2006 11:55 AM
Hi,
U can make use of the statement
If condition
CALL SELECTION-SCREEN XXX STARTING AT 10 10.
endif.
Hope this helps.
Reward useful answers.
Regards,
Shrita
10-13-2006 11:57 AM
Hi,
You can use function modules like
POPUP_WITH_2_BUTTONS_TO_CHOOSE
to display a message and check if user wants to reenter the values at SELECTION_SCREEN event.
Sample code:
AT SELECTION-SCREEN.
IF sy-ucomm = 'ONLI'
OR sy-ucomm = 'SJOB'.
CALL FUNCTION 'POPUP_WITH_2_BUTTONS_TO_CHOOSE'
EXPORTING
defaultoption = l_default
diagnosetext1 = l_diagnosetext1
diagnosetext2 = l_diagnosetext2
diagnosetext3 = l_diagnosetext3
textline1 = l_textline1
textline2 = l_textline2
textline3 = l_textline3
text_option1 = l_text_option1
text_option2 = l_text_option2
titel = l_titel
IMPORTING
answer = l_answer.
IF l_answer = '2'.
MESSAGE e646.
ENDIF.
ENDIF.
Rgds,
HR
Message was edited by: Hema Rao
10-13-2006 11:57 AM
hi parvez
can u be a bit clear .in the sense wrong value could be either the format wise or the value should be in databse if not then an error message should be there.if so then u need to create a message type using se91
select the value form the databse against the selection screen value if subrc returns a non-zero value display an error message saying "enter the value correclty".hope this could b of ur help
Regards
Zarina
10-13-2006 12:01 PM
Dear Zarina,
The values should be from the data base, pls tell me how to code it.
Regards,
Parvez
10-13-2006 12:05 PM
Hi again,
1. supppose the field on screen is
BUKRS (company code),
whose master table is T001.
2. Then to check, we need to do like this.
3.
START-OF-SELECTION.
DATA : T001 LIKE T001.
SELECT SINGLE * FROM T001
INTO T001
WHERE BUKRS = BUKRS.
IF SY-SUBRC <> 0. "--- MEANS NOT FOUND.
MESSAGE 'COMPANY NOT FOUND' TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
regards,
amit m.
10-13-2006 12:22 PM
hi
suppose p_bukrs is the selection screen field.
select bukrs from table where bukrs = p_bukrs.
if sy-subrc ne 0.
e001(message type) with 'company code not present in databse'.
endif.
10-13-2006 12:27 PM
parvez
this should be in the AT SELECTION SCREEN event as validations at screen level are done there.
Plz mark points if helpful.
Regards
Zarina
10-13-2006 12:32 PM
10-13-2006 1:39 PM
Hi Venu
To display a pop msg when user enters a wrong value we have two ways either you can give msg type as I or you can use call screen (dimension) and display msg there.
For Eg:
CALL SCREEN '0535' STARTING AT 5 1
ENDING AT 70 10.
and in the screen '0535' you can give your text description and button with desired function.
Hope this helps you
Thanks
10-13-2006 1:48 PM
Hi venu
Try my code man..it will satisfy ur requirement....
AT SELECTION-SCREEN.
IF NOT S_PERNR IS INITIAL.
SELECT SINGLE PERNR
FROM PA0001
INTO PA0001-PERNR
WHERE PERNR IN S_PERNR.
IF SY-SUBRC NE 0.
MESSAGE E000(ZMESS).
ENDIF.
ENDIF.
If any wrong value enters,u can see message invalid number below with red color..