‎2008 Jun 02 12:22 PM
Hi folks,
I have few doubts.
1.If I don't give start-of-selection event explicitly after initialization & At selection-screen output events,whether it will work?
2.What happens when I validate selection-screen fields in start-of-selection event?
I tried these but got mixed solutions?
Kindly reply......
‎2008 Jun 02 12:23 PM
>Its not mandatory to write START_OF -selection event explicitly
even if u dont write d selection of data and all calculations...n even simle write statements
i.e.all statements implicitly fall under start-of selection only
>now at selection screen event is needed when your requirement is to do some validations event. This event occurs after the runtime environment has passed all input data from the selection screen to the ABAP program. The other selection screen events allow programmers to modify the selection screen before it is sent and specifically check user input.
so if u dont give it in this event 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.the screen will be called and after dat validation will be done...that would obviosly be of not that much use
>validations are not goin to work in start of selection event
thanks
Edited by: Richa Khosla on Jun 2, 2008 1:23 PM
Edited by: Richa Khosla on Jun 2, 2008 1:24 PM
Edited by: Richa Khosla on Jun 2, 2008 1:26 PM
Edited by: Richa Khosla on Jun 2, 2008 1:30 PM
Edited by: Richa Khosla on Jun 2, 2008 1:31 PM
Edited by: Richa Khosla on Jun 2, 2008 1:34 PM
‎2008 Jun 02 12:25 PM
1) if u write any event then start of selection is compulsory otherwise it does not work. if we do not mention any event in the program then no need to write start of selection, but if u mention it is must to write the start of selection.
2) validations cannot be done in the start of selection. it will not work.
‎2008 Jun 02 12:28 PM
1. This depends on the order of your events ..
If initialization is the second event .. then the program executes
in just one go .. (will not stop to show the selection screen) ..
2.U can validate .. But these are executed only after U press
F8 for the second time .. (first time U'll get the screen ... )
‎2008 Jun 02 12:31 PM
HI.
START-OF-SELECTION.
Effect:
This event keyword defines an event block for which the event is triggered by the ABAP runtime environment during the flow of an executable program and before any selection screens are processed.
In an executable program, all statements that are not declarations and that are listed before the first explicit processing block, or if the program does not contain any explicit processing blocks, then all functional statements of the program, are assigned to an implicit event block START-OF-SELECTION, which is inserted before any START-OF-SELECTION event blocks.
If the program is linked to a logical database, preparatory tasks can be performed at START-OF-SELECTION before the logical database imports the data. If the program is not linked to a logical database, this event block becomes a type of "main program" from which procedures or screens are called.
Example
The following are three executable programs with exactly the same functionality:
The first program contains an explicit event block START-OF-SELECTION and shows the recommended spelling.
REPORT test_start_of_selection.
DATA text TYPE string.
START-OF-SELECTION.
text = `Hello World!`.
WRITE text.
In the second program, an assignment is inserted before the first processing block, which forms a second implicit event block START-OF-SELECTION before the explicit event block.
REPORT test_start_of_selection.
DATA text TYPE string.
text = `Hello World!`.
START-OF-SELECTION.
WRITE text.
In the third program, there is no explicit processing block. All statements implicitly form the event block START-OF-SELECTION.
REPORT test_start_of_selection.
DATA text TYPE string.
text = `Hello World!`.
WRITE text.
The third program has exactly the same meaning as the first program. The second program, in contrast, would have the following form if expressed explicitly:
REPORT test_start_of_selection.
DATA text TYPE string.
START-OF-SELECTION.
text = `Hello World!`.
START-OF-SELECTION.
WRITE text.
This means that if the second program contained a WRITE statement before the explicit event block, it would behave differently to the first or third programs with the same WRITE statement, as the statement NEW-LINE is executed at the end of the implicit event block.
Reward all helpfull answers.
Regards.
Jay
‎2008 Jun 02 12:32 PM
Hi,
If you dont write START-OF-SELECTION explicitely, the complier can not distinguish between AT SELECTION-screen output and START-OF-SELECTION. So there will be a problem.
and output list /alv will not be displayed, but codes will be executed..
If you validate screen fields in start-of-selection event, and you give error message, that will be displayed in the second screen and not in the selection screen.