09-25-2008 8:11 AM
Hi everybody,
I wanted to know how to display error messages if a user enters invalid data at the selection screen in a particular select-options field. Also the selection screen should be redisplayed after the message.
thanks
09-25-2008 12:58 PM
Hi sorry, for not specifying properly
but the problem is that data entered by the user on the screen for the high and low value of the select-option field at the selection screen sould be present in the master table if this is not the case an error message should be displayed asking the user to enter appropriate entry and the selection screen should be redisplayed. There is no problem as far as validating the value entered in parameter is concerned.
09-25-2008 8:13 AM
Hi,
Do the validations in AT SELECTION-SCREEN ON <field> event.
Regards
Abhijeet
09-25-2008 8:18 AM
Hi you use as.
AT SELECTION-SCREEN ON <fieldname>.
if <fieldname> GE 1000.
message e001(zsgclass).
endif.
09-25-2008 8:13 AM
Use the at selection-screen event to perform the validations and it will stay on the selection screen.
To issue the error message use the "message" statement such as
message e600(fr) with 'Error'.
09-25-2008 8:17 AM
HI,
write the code in the
AT Selection-screen on <field>.
<write the Error message there with validation code>
Regards
Sumit Agarwal
09-25-2008 1:04 PM
AT Selection-screen on <selfield>.
***example for mara table.
select single matnr from mara into check_field
where matnr = <selfield>-low.
if sy-subrc NE 0.
message e001(zsgcls).
endif.
Edited by: swati gupta on Sep 25, 2008 2:07 PM
Edited by: swati gupta on Sep 25, 2008 2:07 PM
09-25-2008 8:19 AM
Hi Prem,
Welcome to SDN
try it like this:
At selection-screen on field s_data.
select field
from itab " the table with which u want to validate d data
into w_data
where field in s_data.
if sy-subrc NE 0.
message 'enter a valid data' type 'E'.
endif.
With luck,
Pritam.
09-25-2008 8:21 AM
hi,
AT SELECTION-SCREEN ON <fieldname>.
if <fieldname> NE 1000.
message i000(zfi) display like 'E' .
leave list-processing.
endif.
Rgds.,
subash
09-25-2008 8:25 AM
Hi,
Check this sample code
REPORT z_sdn.
DATA:
BEGIN OF fs_flight,
carrid TYPE sflight-carrid,
END OF fs_flight.
PARAMETERS:
p_carrid TYPE sflight-carrid.
AT SELECTION-SCREEN ON p_carrid.
SELECT carrid
FROM sflight
INTO fs_flight
UP TO 1 ROWS
WHERE carrid = p_carrid.
ENDSELECT.
IF fs_flight IS INITIAL.
MESSAGE 'ENTER A VALID VALUE' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
WRITE: / p_carrid.
Regards
Abhijeet
09-25-2008 8:25 AM
Hi,
Understand my select query where i am validating my password.
If Username and password are wrong then it will trigger a message saying password does not matches.
WHEN 'LOGIN'.
SELECT SINGLE EMPLOGIN
FROM ZPASS INTO L_EMP WHERE EMPLOGIN = ZPASS-EMPLOGIN AND PASSWORD = ZFIR_PASS-PASSWORD.
IF SY-SUBRC <> 0.
MESSAGE I000. "give the error msg in SE91
call screen 900. "it will hold in the same screen
ENDIF.
Cheers!!
09-25-2008 12:58 PM
Hi sorry, for not specifying properly
but the problem is that data entered by the user on the screen for the high and low value of the select-option field at the selection screen sould be present in the master table if this is not the case an error message should be displayed asking the user to enter appropriate entry and the selection screen should be redisplayed. There is no problem as far as validating the value entered in parameter is concerned.
09-25-2008 1:03 PM
Hi ,
try this way...
AT SELECTION-SCREEN .
SELECT MATNR FROM MARA INTO V_MATNR UPTO 1 ROW WHERE MATNR IN S_MATNR.
IF sy-subrc <> 0 .
MESSAGE WHAT EVER U WANT.
ENDIF.
09-25-2008 1:10 PM
Hi,
Check this code
REPORT z_sdn.
TABLES:
vbak.
DATA:
w_vbeln TYPE vbak-vbeln.
SELECT-OPTIONS:
s_vbeln FOR vbak-vbeln. " Sales Document
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN ON s_vbeln EVENT
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON s_vbeln.
* Subroutine to validate the sales document entered by user.
PERFORM f0000_validate_sales_doc.
START-OF-SELECTION.
WRITE: / 'TEST'.
*&---------------------------------------------------------------------*
*& Form f0000_validate_sales_doc
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM f0000_validate_sales_doc .
IF s_vbeln[] IS NOT INITIAL.
* Select query to fetch sales document
SELECT vbeln " Sales Document
FROM vbak
INTO w_vbeln
UP TO 1 ROWS
WHERE vbeln IN s_vbeln.
ENDSELECT. " SELECT vbeln
IF sy-subrc NE 0.
MESSAGE 'The entries you have specified do not exist in master table' TYPE 'E'.
ENDIF. " IF sy-subrc NE 0.
CLEAR w_vbeln.
ENDIF. " IF s_vbeln IS NOT INITIAL
Regards
Abhijeet
09-25-2008 1:04 PM
at selection screen on s_data .
select field
from table
into v_field
where field in s_field .
if sy-subrc ne 0 .
message e000 with 'enter a vaild message'.
endif.
endselect .
this will validate all the messages from low to high