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

events

Former Member
0 Likes
1,129

Start-of-selection is default event.

Then what is the porpose of this event ?

Where we use end-of-selection event ?

Start-of-selection is default event.

Then what is the porpose of this event ?

Where we use end-of-selection event ?

7 REPLIES 7
Read only

Former Member
0 Likes
1,092

Hi,

wen u dont mention any events, then start-of -selection is default.

suppose say in ur report u have used INitialization, at slection-screen,topof page....

say u didnt use "START_OF-selection".

In this case it wont recognise start-of selection, as the select statements which u have written will come under th events u have mentioned previously (INitialization, at slection-screen,topof page....)

so wen ever u use other events, then u must use START_OF-SELECTION explicitly.

END-OF SELECTIOn.

if u want to perform some operetians after all the events, then u can codeunder this statement.

Revert back if any issues.

Reward with points if helpful

Regards,

Naveen

Read only

Former Member
0 Likes
1,092

Hi Swapna ,

Start of selection is not a default event , we can write program without start of selection.

As per its definition it is an event which is trigred after the selection screen is displayed and before the data selection is perofrmed.

As far of end of selection is concerned , it is not much of use in case of normal reports , it is significant when we are using logical databases , in that case this event is trigrred when all the data selection from LDB is over and we want to display the output.

Regards

Arun

Read only

Former Member
Read only

Former Member
0 Likes
1,092

Hi,

End-of-selection.

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.

In this event block, all data read by the logical data base , can be processed summarically. In an executable program without logical data base, there is no need to implement the event block END-OF-SELECTION.

Jogdand M B

Read only

Former Member
0 Likes
1,092

ABAP/4 offers three types of modularization units:

Events

Subroutines

Function modules

A modularization unit is a like a shell into which you can put code. It allows you to segregate a group of lines of code from the rest, and then execute them at a specific time. The lines of code within a modularization unit act very much like a mini-program that can be called from another program.

An event is a tag that identifies a section of code. The section of code associated with an event begins with an event name and ends when the next event name is encountered. The event names are initialization, start-of-selection, and end-of-selection. Event names are reserved words. You cannot create new events-you can only use existing ones.

A driver program is one program that controls another (driven) program. SAP supplies driver programs with the R/3 system. You supply the driven program. When you start your program, a driver program always starts first, and then it calls the events in your program. To reiterate, a driver program starts first and then controls when your program gets control. This has always been the case for all of the programs you have written so far; you just have not been aware of it until now. To repeat once more, when you start your program, a driver program starts first and controls your program by calling events within it.

It triggers the initialization event, causing the code belonging to initialization to be executed. If you have not coded an initialization event in your program, the driver program skips this step.

It shows the selection screen for your program. (A selection screen is the screen that contains the input fields for your parameter statements.) If your program doesn't have a selection screen, it skips this step.

It triggers the start-of-selection event, causing the code belonging to that event to be executed. If you have not coded a start-of-selection event in your program, it skips this step.

It triggers the end-of-selection event in your program, executing all of the code belonging to it. If you haven't coded an end-of-selection, it skips this step.

It shows the output list to the user.

The order of execution for events is determined by the driver program, not by your program. Therefore, you can code the events in any order and the execution order will still be the same. The order of events in your program doesn't matter; they will always be triggered in the same sequence by the driver program.

There are eleven different events in ABAP/4, categorized in Table 17.1 according to how they are triggered.

Table 17.1 ABAP/4 Events

Category Events

<b>Driver initialization</b>

at selection-screen

start-of-selection

get

end-of-selection

<b>User</b>

at line-selection

at pfn

at user-command

<b>Program</b>

top-of-page

end-of-page

If you don't see any events in a program, always remember that one still exists-start-of-selection

if we use the statement <b>stop </b> immediately control leaves the current event and goes directly to the end-of-selection event. Executing stop within end-of-selection leaves the event. It doesn't cause an infinite loop.

Read only

Former Member
0 Likes
1,092

hi swapna,

start-of-selection u should write whenever u use at slection-screen or initiliaztion events in report though this is a default event,

end-of-selection: this can trigger after the 'STOP' keyword trigger,

that means if u write 'STOP' keyword in the start-of-selection event after this cursor directly goes to end-of-selection event , then it process the loop or output statements, if u dont write end-of-selection event after the 'STOP' keyword then it comes out from the report,

see the sample code below and debugg the same for the better understanding,

REPORT yjust_seshu MESSAGE-ID zct.

TABLES: marc.

DATA: g_tab TYPE STANDARD TABLE OF marc,

g_wa TYPE marc.

*selcetion screen

PARAMETERS p_plant LIKE marc-werks.

SELECT-OPTIONS s_matnr FOR marc-matnr OBLIGATORY.

INITIALIZATION.

p_plant = 1000.

AT SELECTION-SCREEN OUTPUT.

p_plant = 1000.

AT SELECTION-SCREEN.

DATA: l_plant TYPE werks.

SELECT SINGLE werks FROM marc INTO l_plant WHERE werks EQ p_plant.

IF sy-subrc NE 0.

MESSAGE i010(zct).

EXIT.

ENDIF.

START-OF-SELECTION.

SELECT werks

matnr

FROM marc

INTO TABLE g_tab

WHERE werks EQ p_plant

AND matnr IN s_matnr.

PERFORM SELECT_NEW.

STOP.

END-OF-SELECTION.

LOOP AT g_tab INTO g_wa.

WRITE:/ g_wa-matnr.

ENDLOOP.

regards,

seshu.

Read only

Former Member
0 Likes
1,092

hi swapna

if you want to process some action(like Database data retriving) in List then u should use

Start-of-selection.

After complition of all process then u should use End-of-selection for next process like top-of-page and End-of-page.

need ur reward points.

Regards

Ravi.