‎2007 Jun 06 2:59 PM
‎2007 Jun 06 3:02 PM
Validation on Selection-screen fields ,if user enter some wrong value ,then we have show message ..
you can write simple code
tables mara.
parameters p_matnr like mara-matnr.
at selection-screen on p_matnr.
select single matnr from mara into mara-matnr
where matnr = p_matnr.
if sy-subrc ne 0.
*message
endif.
‎2007 Jun 07 5:41 AM
Hi,
This event is triggered at the screen event PAI of a selection screen if the content of the input field of a parameter para or a line of a selection criterion was passed to the ABAP program. In the event block, the user input can be checked. Sending a warning or an error message in the event block makes the fields para and selcrit ready for input again.
AT SELECTION-SCREEN ON p_ebeln.
IF p_ebeln IS INITIAL.
MESSAGE 'Please enter a value' TYPE 'E'.
ENDIF.
AUTHORITY-CHECK OBJECT 'S_EBELN'
ID 'EBELN' FIELD p_ebeln
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 4.
MESSAGE 'No authorization for PO' TYPE 'E'.
ELSEIF sy-subrc <> 0.
MESSAGE 'Error in authority check' TYPE 'A'.
ELSE.
IF sy-ucomm = 'ONLI'.
CALL SELECTION-SCREEN '0500'.
ENDIF.
ENDIF.
No parameter that is defined as a radio button can be specified. For this purpose, the addition ON RADIOBUTTON GROUP is provided.
If a user action takes place in the dialog box for the multiple selection of a selection criterion selcrit, the entries of the selection table are passed to the program, line by line. For each line, the event AT SELECTION-SCREEN ON selcrit is triggered.
Hope this helps.
Regards,
Richa
‎2007 Jun 07 7:05 AM
hi,
generally it is used to validate selection-screen field.mainly for validations only.for providing error messages also.
ex:
‎2007 Jun 07 7:10 AM
Hi,
In the PAI event of the selection screen, the event AT SELECTION-SCREEN ON <field> is triggered when the contents of each individual input field are passed from the selection screen to the ABAP program. The input field <field> can be checked in the corresponding event block.
If an error message occurs within this event block, the corresponding field is made ready for input again on the selection screen.
Example
REPORT event_demo.
NODES spfli.
AT SELECTION-SCREEN ON city_fr.
IF carrid-low EQ 'AA' AND city_fr NE 'NEW YORK'.
MESSAGE e010(hb).
ENDIF.
If the user enters AA in the first input field, but not NEW YORK for the departure city, an error message is displayed in the status line until the user enters the correct city.
check out the follwing link:
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/at_selec.htm
http://help.sap.com/saphelp_nw04/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/79/34a237d9b511d1950e0000e8353423/content.htm
Regards,
Priyanka.
‎2007 Jun 07 9:49 AM
hi
good
go through this link
http://help.sap.com/saphelp_nw04/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
thanks
mrutyun^
‎2007 Jun 14 6:12 AM
Hi,
One more example scenario
data : it_filetable type filetable with header line,
v_returncod type i.
parameters: p_file(255) type c.
************************************************************************
* A T S E L E C T I O N S C R E E N *
************************************************************************
<b>at selection-screen on value-request for p_file.</b>
call method cl_gui_frontend_services=>file_open_dialog
changing
file_table = it_filetable[]
rc = v_returncod
exceptions
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.Regards, ABY
‎2007 Jun 14 10:36 AM
hey
better if u use the event called
AT SELECTION SCREEN OUTPUT,...
I AM GIVING U A SIMPLE CODE FOR THAT...
REPORT demo_at_selection_screen.
Global data
DATA: sflight_tab TYPE TABLE OF sflight,
sflight_wa LIKE LINE OF sflight_tab.
Selection screens
PARAMETERS p_carrid TYPE spfli-carrid.
SELECTION-SCREEN BEGIN OF SCREEN 500.
SELECT-OPTIONS s_conn FOR sflight_wa-connid.
DATA s_conn_wa LIKE LINE OF s_conn.
SELECTION-SCREEN END OF SCREEN 500.
Handling selection screen events
AT SELECTION-SCREEN ON p_carrid.
IF p_carrid IS INITIAL.
MESSAGE 'Please enter a value' TYPE 'E'.
ENDIF.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'CARRID' FIELD p_carrid
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 4.
MESSAGE 'No authorization for carrier' TYPE 'E'.
ELSEIF sy-subrc <> 0.
MESSAGE 'Error in authority check' TYPE 'A'.
ELSE.
IF sy-ucomm = 'ONLI'.
CALL SELECTION-SCREEN '0500'.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
IF sy-dynnr = '0500'.
IF s_conn IS INITIAL.
MESSAGE 'Please enter values' TYPE 'W'.
ELSE.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid IN s_conn.
IF sy-subrc <> 0.
MESSAGE 'No flights found' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
Main program
START-OF-SELECTION.