Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

simple question.........

Former Member
0 Likes
1,135

when to use start-of-selection and end-of-selection both and when only start-of-selection?

9 REPLIES 9
Read only

Former Member
0 Likes
1,045

hi,

Start-of-selection is used to retrieve the data.

End-of-selection is used to display the data.

Read only

0 Likes
1,045

is their any loop case........?

Read only

Former Member
0 Likes
1,045

hi..

<b>Start-of-selection</b> is the event where you will code ur sql statements, this is the event which will be triggered automatically even for normal programs, not only for reports even if you dont specify this event in the program.

At Selection screen is the event to validate the input values given in the selection screen using initialization event.

First in the sequence AT SELECTION SCREEN event will be triggered and then START-OF-SELECTION.

<b>END-OF-SELECTION</b>, will fire only when you actually write it after the selection of the data is over. Usually between the START and END OF SELECTION you fetch the data and after the END OF SELECTION, you process the data and write that as output as display the same as ALV.

<b>START-OF-SELECTION</b> event is triggered after the selection screen has been processed.

You can use this event for generating list for eg.

<b>END-OF-SELECTION</b> event is triggered after all the records have been read from the logical

database and before the list processor is started.You can use this event block to process

and format the data the program has stored in the internal tables or extraced during various GET Events..

You can ignore END-OF-SELECTION if you dont use LDB in your program..

<b>Reward points if useful</b>

Regards

Ashu

Read only

0 Likes
1,045

in loop case we can use start-of-selection but in simple case we use start-of-selection and end-of-selection both.Is it correct?

Read only

0 Likes
1,045

Hi,

START OF SELECTION you need to use to execute your code after data selectio and validation.

Everything that is not there in any event block will be concidered under this event bloc.

END-OF-SELECTION Is optional for normal reports and is only required for reports with Logical Database.

Regards,

Sesh

Read only

Former Member
0 Likes
1,045

<b>START-OF-SELECTION. </b>

Effect

This event keyword defines an event block whose event is triggered by the ABAP runtime environment when calling the executable program selection screen processing of a selection screen.

<b>Example..</b>

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, there is an assignment before the first processing block, which is inserted in the event block START-OF-SELECTION.

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 form the event block START-OF-SELECTION.

REPORT test_start_of_selection.

DATA text TYPE string.

text = `Hello World!`.

WRITE text.

<b>

END-OF-SELECTION. </b>

Effect

This statement defines an event block, whose event is raised by the ABAP-runtime environment during the calling of an executable program , if the logical database, with which the program is linked, has completely finished its work.

<b>Example...</b>

REPORT demo_get.

NODES: spfli, sflight, sbook.

DATA: weight TYPE p DECIMALS 4,

total_weight TYPE p DECIMALS 4.

INITIALIZATION.

carrid-sign = 'I'.

carrid-option = 'EQ'.

carrid-low = 'AA'.

carrid-high = 'LH'.

APPEND carrid TO carrid.

START-OF-SELECTION.

WRITE 'Luggage weight of flights'.

GET spfli FIELDS carrid connid cityfrom cityto.

SKIP.

ULINE.

WRITE: / 'Carrid:', spfli-carrid,

'Connid:', spfli-connid,

/ 'From: ', spfli-cityfrom,

'To: ', spfli-cityto.

ULINE.

GET sflight FIELDS fldate.

SKIP.

WRITE: / 'Date:', sflight-fldate.

GET sbook FIELDS luggweight.

weight = weight + sbook-luggweight.

GET sflight LATE FIELDS carrid .

WRITE: / 'Luggage weight =', weight.

total_weight = total_weight + weight.

weight = 0.

END-OF-SELECTION.

ULINE.

WRITE: / 'Sum of luggage weights =', total_weight.

Regards,

Pavan

Read only

Former Member
0 Likes
1,045

Hi,

START-OF-SELECTION is default event even without mentioning when u r not using any event before.

If ur using any event like AT SELECTION-SCREEN, INITIALIZATION then u have to specify the START-OF-SELECTION. Any event block will end with another event keyword.

END-OF-SELECTION is mainly used when the LDB finishes all its work.

In an executable program without logical data base, there is no need to implement the event block END-OF-SELECTION.

Thanks & Regards

Santhosh

Read only

Former Member
0 Likes
1,045

hi Praveen,

<b>START-OF-SELECTION.</b>

Event keyword:

In an executable program, the corresponding event is processed

after the selection screen has been displayed and before data

is read using a logical database.

The REPORT statement always executes a START-OF-SELECTION

implcitly. Consequently all processing logic between the

REPORT statement and the next event keyword is automatically

processed in the START-OF-SELECTION event.

Immediately afterwards, the system processes the statements

that belong to an explicit START-OF-SELECTION block.

<b>END-OF-SELECTION.</b>

The END-OF-SELECTION event is triggered in type 1 programs once the logical database has finished reading all data and before the list processor is started.

If used in non Logical Database reports, It may trigger after the processing of START-OF-SELECTION is complete.

Reward points if contents are useful....

Regards,

Mandeep.

Read only

Former Member
0 Likes
1,045

Answered.