2007 Feb 23 12:45 PM
friends can u tell me the difference between atselection-screen and at selection-screen on field?
2007 Feb 23 12:49 PM
The event <b>AT SELECTION-SCREEN</b> is the basic form of a whole series of events that occur while the selection screen is being processed.
The standard selection screen in an executable program or in the logical database linked to it is automatically called between the INITIALIZATION and START-OF-SELECTION events. When you call the selection screen, and when users interact with it, the ABAP runtime environment generates selection screen events, which occur between INITIALIZATION and START-OFSELECTION.
You can define event blocks for these events in your program to change the selection screen or process user input.
In the PAI event of the selection screen, the event <b>AT SELECTION-SCREEN ON <field></b> 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.
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers
2007 Feb 23 12:53 PM
Hi,
The only difference is that at selection-screen on field is used for single field.
http://help.sap.com/saphelp_nw04/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/79/34a237d9b511d1950e0000e8353423/content.htm
Please reward points.
2007 Feb 23 12:55 PM
Hello,
Effect
This event only makes sense in reports, i.e. in programs set to type 1 in the attributes. Type 1 programs are started via a logical database and always have a selection screen where the user can specify the database selections.
The event is processed when the selection screen has been processed (at the end of PAI).
If an error message (MESSAGE Emnr) is sent during the event, all fields on the selection screen become ready for input.
After further user input, AT SELECTION-SCREEN is executed again.
Note
You should only perform very expensive checks with AT SELECTION-SCREEN if the program is then started (not every time the user presses ENTER). Here, you can read the system field SSCRFIELDS-UCOMM (provided a statement TABLES SSCRFIELDS exists). If the field has one of the values 'ONLI' (= Execute) or 'PRIN' (= Execute and Print), the report is then started, i.e. the selection screen is closed and the processing continues with START-OF-SELECTION. Remember that the selection screen (and thus also AT SELECTION-SCREE N) is also processed in variant maintenance and with SUBMIT VIA JOB. You can determine which of these applies by calling the function module RS_SUBMIT_INFO.
The AT SELECTION SCREEN ... events are implemented internally as FORM routines. All data objects created using DATA are therefore local - only recognized and addressable within the event. This also applies to GET events.
Addition 1
... ON psel
Effect
This event is assigned to the selection screen fields corresponding to the report parameter or selection criterion psel.
If the report starts an error dialog at this point, precisely these fields become ready for input.
Vasanth
2007 Feb 23 12:55 PM
Hi,
At selection-screen : is the basic form of a whole series of events that occur while the selection screen is being processed.
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.
check out the follwing link:
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/at_selec.htm
Ashvender
2007 Feb 23 1:01 PM
<b>AT SELECTION-SCREEN event is triggered in the PAI of the selection screen once the ABAP runtime environment has passed all of the input data from the selection screen to the ABAP program. If an error message occurs in this processing block, the selection screen is redisplayed with all of its fields ready for input. This allows you to check input values for consistency.</b>
Example
REPORT demo_at_selection_screen .
NODES spfli.
AT SELECTION-SCREEN.
IF carrid-low IS INITIAL
OR airp_fr-low IS INITIAL
OR airp_to-low IS INITIAL.
MESSAGE e888(sabapdocu) WITH text-001.
ENDIF.
<b>In the PAI event of the selection screen, the event
AT SELECTION-SCREEN ON field
event is triggered. 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.</b>
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.
2007 Feb 23 1:54 PM
at selection-screen would be triggered at the end of the at selection-screen events.
I mean to say at selection-screen on field would be triggered before at selection-screen.
2007 Feb 24 11:58 AM
First of all the actual order of events
INITIALIZATION
AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN ON <field>
AT SELECTION-SCREEN
START-OF-SELECTION
*********************************************************
INITIALIZATION
This event occurs before the standard selection screen is called. You can use it, for example, to initialize the input fields of the standard selection screen or you can assign your own default values.
REPORT EVENT_DEMO.
PARAMETERS DATUM TYPE SY-DATUM DEFAULT SY-DATUM.
NODES SPFLI.
INITIALIZATION.
CITY_FR = 'NEW YORK'.
CITY_TO = 'FRANKFURT'.
CARRID-SIGN = 'I'.
CARRID-OPTION = 'EQ'.
CARRID-LOW = 'AA'.
APPEND CARRID.
DATUM+6(2) = '01'.
***********************************************************
In the PBO of the selection screen, the
AT SELECTION-SCREEN OUTPUT
event is triggered. This event block allows you to modify the selection screen directly before it is displayed.
PARAMETERS: TEST1(10) MODIF ID SC1,
TEST2(10) MODIF ID SC2,
TEST3(10) MODIF ID SC1,
TEST4(10) MODIF ID SC2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'SC1'.
SCREEN-INTENSIFIED = '1'.
MODIFY SCREEN.
CONTINUE.
ENDIF.
IF SCREEN-GROUP1 = 'SC2'.
SCREEN-INTENSIFIED = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
The parameters TEST1 and TEST3 are assigned to the modification group SC1, while TEST2 and TEST4 are assigned to group SC2. During the AT SELECTION-SCREEN OUTPUT event, the INTENSIFIED field of internal table SCREEN is set to 1 or 0, depending on the contents of the GROUP1 field. On the selection screen, the lines for TEST1 and TEST3 are highlighted while those for TEST2 and TEST4 are not.
*********************************************************************
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.
The program below is connected to the logical database F1S:
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.
************************************************************************
The AT SELECTION-SCREEN event is triggered in the PAI of the selection screen once the ABAP runtime environment has passed all of the input data from the selection screen to the ABAP program. If an error message occurs in this processing block, the selection screen is redisplayed with all of its fields ready for input. This allows you to check input values for consistency.
The program below is connected to the logical database F1S:
REPORT EVENT_DEMO.
NODES SPFLI.
AT SELECTION-SCREEN.
IF CARRID-LOW IS INITIAL
OR CITY_FR IS INITIAL
OR CITY_TO IS INITIAL.
MESSAGE E000(HB).
ENDIF.
If the user does not enter values in all of the fields on the selection screen, an error message appears in the status line. This makes all of the input fields mandatory, even though they are not defined as such in the logical database.
***************************************************************************
Reward points, if the issue is resolved.
Regards,
Raman
Message was edited by:
Raman Vinocha
2007 Feb 24 12:04 PM
Hi raja,
AT SELECTON-SCREEN:in this event what must be done after the user enters the values on selection-screen will be specified.
AT SELECTION-SCREEN ON FIELD:in this event it will check the validations on particular field,that is what must be done after entering the value for specific field will be specified under this event.
2007 Feb 24 12:24 PM
Hi Kudala,
At selection-screen on FIELD can be used to validate the field specified. As soon as the user enters some value in that field, this even is triggered and the used can write his/her validation codes here.
At selction-screen is on more higher level, you can validate the whole screen here..
Thanks and regards,
Ravi :).
NOTE: Please reward points if you are satisfied with the solution. It keeps me moving ahead on SDN .
2007 Feb 24 1:53 PM
The AT SELECTION-SCREEN event is triggered in the PAI of the selection screen once the ABAP runtime environment has passed all of the input data from the selection screen to the ABAP program. If an error message occurs in this processing block, the selection screen is redisplayed with all of its fields ready for input. This allows you to check input values for consistency.
Example
The following executable program is connected to the logical database F1S.
REPORT demo_at_selection_screen .
NODES spfli.
AT SELECTION-SCREEN.
IF carrid-low IS INITIAL
OR airp_fr-low IS INITIAL
OR airp_to-low IS INITIAL.
MESSAGE e888(sabapdocu) WITH text-001.
ENDIF.
If the user does not enter values in all of the fields on the selection screen, an error message appears in the status line. This makes all of the input fields mandatory, even though they are not defined as such in the logical database.
Processing Single Fields
In the PAI event of the selection screen, the event
AT SELECTION-SCREEN ON field
event is triggered. 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
The following executable program is connected to the logical database F1S.
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.