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

define event

Former Member
0 Likes
807

hi,

where i can define event and how?

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
665

EVENTS

ABAP program

INITIALIZATION.

pa_date = pa_date - 7.

START-OF-SELECTION.

WRITE pa_date.

The easiest events to understand are those for an executable program (type 1).

The ABAP runtime system calls event blocks in a sequence designed for generating and processing

lists:

First, the INITIALIZATION event block is called

Then a selection screen is sent to the presentation server

After the user leaves the selection screen, START-OF-SELECTION is called

If the START-OF-SELECTION event block contains the ABAP statements WRITE, SKIP or ULINE,

a list buffer is filled.

Event Blocks in Executable Programs

INITIALIZATION.

START-OF-SELECTION.

Default event block:

START-OF-SELECTION

Event blocks are processing blocks that are called by the ABAP runtime system. The sequence if which

they are processed is determined by the runtime system.

In executable programs, there are different event blocks for the various tasks involved in creating lists.

Syntax: Event Blocks

REPORT ...

PARAMETERS: pa_date LIKE sy-datum DEFAULT sy-datum.

INITIALIZATION. " Default values for selection screen

pa_date = pa_date - 7.

START-OF-SELECTION.

" Start of data processing

WRITE pa_date.

The sequence of event blocks in the

source code has no effect on the sequence in

which they are called by the ABAP runtime system.

call

initialization

STARTOFSELECTION..

In an ABAP program, an event block is introduced with an event key word. It ends when the next

processing block starts. There is no ABAP statement that explicitly concludes an event block.

Event blocks are called by the ABAP runtime system. The order in which you arrange the event blocks in

your program is irrelevant - the system always calls them in a particular order.

START-OF-SELECTION is the first event for processing data and generating a list. It is called by the

ABAP runtime system as soon as you have left the standard selection screen.

INITIALIZATION is an event that you can use if you need to set a large number of default values. This

event block allows you to set default values that can only be determined at runtime. In the above

example, the date 'A week ago' is calculated and placed in data object pa_date. The ABAP runtime

system then sends a selection screen to the presentation server containing the calculated value as a

default. The value can, of course, still be changed.

Selection screen processing is event-driven. Events are ABAP processing blocks that are called by the

runtime system in a particular order and processed sequentially. In the program, each event is

introduced by an event keyword. The processing block ends when the next event block starts, or the

definition of a subroutine or dialog module occurs.

AT SELECTION-SCREEN OUTPUT is processed before the selection screen is displayed on the

screen. You can use this event to modify the selection screen dynamically.

AT SELECTION-SCREEN ON HELP-REQUEST FOR <sel_field> and

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <sel_field> allow you to define your own F1

and F4 help.

AT SELECTION-SCREEN is processed when the user presses ENTER or chooses another function on

the selection screen.

-


An ABAP program consists of a sequence of processing blocks (events) that are processed by the

runtime system in a particular order.

LOAD-OF-PROGRAM is triggered directly after the system has loaded a program with type 1, M, F, or S

into an internal session. The processing block is executed once only for each program in each internal

session.

INITIALIZATION is processed in executable (type 1) programs, directly before the selection screen is

displayed. You can use the corresponding processing block to pre-assign values to the parameters and

selection options on the selection screen.

START-OF-SELECTION is processed after the selection screen has been processed. If you are

working with a logical database, the corresponding GET events are triggered after START-OFSELECTION.

END-OF-SELECTION is processed after all of the data has been read, and before the list is displayed.

TOP-OF-PAGE is an event in list processing. The associated processing block is always executed when

you start a new page in the list.

module pool

GET GET ...

You can only assign a report transaction to an executable (type 1) program. In a report transaction,

the system calls particular events in a fixed sequence, and calls a series of standard screens. The

following steps occur when you run a report transaction:

First, the LOAD-OF-PROGRAM event is triggered.

Then the INITIALIZATION event is triggered.

Next, the standard selection screen is called (if you have declared one), and its corresponding events

are triggered: AT SELECTION-SCREEN OUTPUT and AT SELECTION-SCREEN.

Next, the START-OF-SELECTION event is triggered. (This is the default event block. If you omit this

event keyword, all statements that are not assigned to another processing block are treated as though

they belong to it.)

If you have attached a logical database to your program, the system triggers the GET <node> and GET

<node> LATE events.

Then the END-OF-SELECTION event is triggered.

You can also include screen processing (as in module pools) by using the CALL SCREEN statement.

You can start executable (type 1) programs without using a transaction code. You can also run them in

the background.

(C) SAP AG BC402 2-11

SAP AG 1999

WRITE ...

SKIP ...

ULINE.

List Processing Events

TOP TOP-OF-PAGE.

EOP END-OF-PAGE.

AT LINE-SELECTION.

WRITE ...

SKIP ...

ULINE.

ALS

List buffer for basic list

AUC AT USER-COMMAND.

List buffer for detail list

If you fill the list buffer of the basic list (using the WRITE, SKIP, and ULINE statements), two further

events are triggered: At the beginning of each new page, the TOP-OF-PAGE event is triggered, and the

END-OF-PAGE event is triggered at the end of each page.

Once the END-OF-SELECTION event block has been processed, interactive list processing starts.

The system displays the formatted basic list . The user can now trigger further events.

If the user double-clicks a line or triggers the function code PICK in some other way, the AT LINESELECTION

event is triggered. In the standard list status, this function code is always assigned to

function key <F2>. In turn, <F2> is always assigned for a mouse double-click.

If you fill the list buffer of the detail list (of which you may have up to twenty) using the WRITE, SKIP,

and ULINE statements, two further events are triggered:

At the beginning of each new page, the TOP-OF-PAGE DURING LINE-SELECTION event is triggered,

and the END-OF-PAGE DURING LINE-SELECTION event is triggered at the end of each page. (These

events are not displayed in the graphic.) Interactive list processing is started again. The system

displays the formatted detail list (screen 120).

Any other function codes that have not been "trapped" by the system trigger the event AT USERCOMMAND.

DONT FORGET TO REWARD IF USEFUL

4 REPLIES 4
Read only

Former Member
0 Likes
666

EVENTS

ABAP program

INITIALIZATION.

pa_date = pa_date - 7.

START-OF-SELECTION.

WRITE pa_date.

The easiest events to understand are those for an executable program (type 1).

The ABAP runtime system calls event blocks in a sequence designed for generating and processing

lists:

First, the INITIALIZATION event block is called

Then a selection screen is sent to the presentation server

After the user leaves the selection screen, START-OF-SELECTION is called

If the START-OF-SELECTION event block contains the ABAP statements WRITE, SKIP or ULINE,

a list buffer is filled.

Event Blocks in Executable Programs

INITIALIZATION.

START-OF-SELECTION.

Default event block:

START-OF-SELECTION

Event blocks are processing blocks that are called by the ABAP runtime system. The sequence if which

they are processed is determined by the runtime system.

In executable programs, there are different event blocks for the various tasks involved in creating lists.

Syntax: Event Blocks

REPORT ...

PARAMETERS: pa_date LIKE sy-datum DEFAULT sy-datum.

INITIALIZATION. " Default values for selection screen

pa_date = pa_date - 7.

START-OF-SELECTION.

" Start of data processing

WRITE pa_date.

The sequence of event blocks in the

source code has no effect on the sequence in

which they are called by the ABAP runtime system.

call

initialization

STARTOFSELECTION..

In an ABAP program, an event block is introduced with an event key word. It ends when the next

processing block starts. There is no ABAP statement that explicitly concludes an event block.

Event blocks are called by the ABAP runtime system. The order in which you arrange the event blocks in

your program is irrelevant - the system always calls them in a particular order.

START-OF-SELECTION is the first event for processing data and generating a list. It is called by the

ABAP runtime system as soon as you have left the standard selection screen.

INITIALIZATION is an event that you can use if you need to set a large number of default values. This

event block allows you to set default values that can only be determined at runtime. In the above

example, the date 'A week ago' is calculated and placed in data object pa_date. The ABAP runtime

system then sends a selection screen to the presentation server containing the calculated value as a

default. The value can, of course, still be changed.

Selection screen processing is event-driven. Events are ABAP processing blocks that are called by the

runtime system in a particular order and processed sequentially. In the program, each event is

introduced by an event keyword. The processing block ends when the next event block starts, or the

definition of a subroutine or dialog module occurs.

AT SELECTION-SCREEN OUTPUT is processed before the selection screen is displayed on the

screen. You can use this event to modify the selection screen dynamically.

AT SELECTION-SCREEN ON HELP-REQUEST FOR <sel_field> and

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <sel_field> allow you to define your own F1

and F4 help.

AT SELECTION-SCREEN is processed when the user presses ENTER or chooses another function on

the selection screen.

-


An ABAP program consists of a sequence of processing blocks (events) that are processed by the

runtime system in a particular order.

LOAD-OF-PROGRAM is triggered directly after the system has loaded a program with type 1, M, F, or S

into an internal session. The processing block is executed once only for each program in each internal

session.

INITIALIZATION is processed in executable (type 1) programs, directly before the selection screen is

displayed. You can use the corresponding processing block to pre-assign values to the parameters and

selection options on the selection screen.

START-OF-SELECTION is processed after the selection screen has been processed. If you are

working with a logical database, the corresponding GET events are triggered after START-OFSELECTION.

END-OF-SELECTION is processed after all of the data has been read, and before the list is displayed.

TOP-OF-PAGE is an event in list processing. The associated processing block is always executed when

you start a new page in the list.

module pool

GET GET ...

You can only assign a report transaction to an executable (type 1) program. In a report transaction,

the system calls particular events in a fixed sequence, and calls a series of standard screens. The

following steps occur when you run a report transaction:

First, the LOAD-OF-PROGRAM event is triggered.

Then the INITIALIZATION event is triggered.

Next, the standard selection screen is called (if you have declared one), and its corresponding events

are triggered: AT SELECTION-SCREEN OUTPUT and AT SELECTION-SCREEN.

Next, the START-OF-SELECTION event is triggered. (This is the default event block. If you omit this

event keyword, all statements that are not assigned to another processing block are treated as though

they belong to it.)

If you have attached a logical database to your program, the system triggers the GET <node> and GET

<node> LATE events.

Then the END-OF-SELECTION event is triggered.

You can also include screen processing (as in module pools) by using the CALL SCREEN statement.

You can start executable (type 1) programs without using a transaction code. You can also run them in

the background.

(C) SAP AG BC402 2-11

SAP AG 1999

WRITE ...

SKIP ...

ULINE.

List Processing Events

TOP TOP-OF-PAGE.

EOP END-OF-PAGE.

AT LINE-SELECTION.

WRITE ...

SKIP ...

ULINE.

ALS

List buffer for basic list

AUC AT USER-COMMAND.

List buffer for detail list

If you fill the list buffer of the basic list (using the WRITE, SKIP, and ULINE statements), two further

events are triggered: At the beginning of each new page, the TOP-OF-PAGE event is triggered, and the

END-OF-PAGE event is triggered at the end of each page.

Once the END-OF-SELECTION event block has been processed, interactive list processing starts.

The system displays the formatted basic list . The user can now trigger further events.

If the user double-clicks a line or triggers the function code PICK in some other way, the AT LINESELECTION

event is triggered. In the standard list status, this function code is always assigned to

function key <F2>. In turn, <F2> is always assigned for a mouse double-click.

If you fill the list buffer of the detail list (of which you may have up to twenty) using the WRITE, SKIP,

and ULINE statements, two further events are triggered:

At the beginning of each new page, the TOP-OF-PAGE DURING LINE-SELECTION event is triggered,

and the END-OF-PAGE DURING LINE-SELECTION event is triggered at the end of each page. (These

events are not displayed in the graphic.) Interactive list processing is started again. The system

displays the formatted detail list (screen 120).

Any other function codes that have not been "trapped" by the system trigger the event AT USERCOMMAND.

DONT FORGET TO REWARD IF USEFUL

Read only

Former Member
0 Likes
665

Hi,

Please see the link below for step by step procedure for creating events.

[http://sapabapnotes.blogspot.com/|http://sapabapnotes.blogspot.com/]

Regards,

Gaurav

Read only

Former Member
0 Likes
665

hi,

When you run an executable program, the program flow is controlled by the external events in the ABAP runtime environment. The following diagram shows the sequence of the events:

INITIALIZATION

Before the standard selection screen is displayed

AT SELECTION-SCREEN

After user input on a selection screen has been processed, but while the selection screen is still active

START-OF-SELECTION

After the standard selection screen has been processed, before data is read from the logical database

GET <table>

After the logical database has read an entry from the node <table>

GET <table> LATE

After all of the nodes of the logical database have been processed that are below <table> in the database hierarchy

END-OF-SELECTION

After all data has been read by the logical database

TOP-OF-PAGE

In list processing when a new page starts

END-OF-PAGE

In list processing when a page ends

AT LINE-SELECTION

When the user triggers the predefined function code PICK

AT PF<nn>

When the user triggers the predefined function code PF<nn>

AT USER-COMMAND

When the user triggers a function code defined in the program

Read only

Former Member
0 Likes
665

Hi

Event in ABAP report determine process flow of a program. The events are triggered depended on the way the output is generated

these are the events available in SAP

Initialization, At selection-screen, Start-of-selection, end-of-selection, top-of-page, end-of-page, At line-selection, At user-command, At PF, Get, At New, At LAST, AT END, AT FIRST

you can define an event at any place depending up on the action the corresponding EVENt will be triggers

the order of events can be any order , that will be triggerd by the action which the user done