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
712

Is it neccesary to follow the EVENTS sequence in coding?

END-OF-SELECTION.

...........

...........

START-OF-SELECTION.

..........

.........

does it execute in which squence?

=====================

In Sorted internal table it will sort the records automatically.

But in Standard ITAB we have to sort it by using SORT statement.

the why we are still using standard table instead of sorted table?

5 REPLIES 5
Read only

Former Member
0 Likes
666

Hi Siva,

Even though You write all the sequences in any order the system will trigger that particular event when it has to.. Ok .. And Only in Some particular scenarios only we will use the "SORT" Means as and when we want on one particular field we can go. but in Sorted table based on primary keys it will sort. I don't say it disadvantage. but using Standard table is advantageous then Sorted Table

Murthy

Read only

0 Likes
666

This is the sequence

1). Load of Program

2). initialization

3. at selection screen output

4).at selection screen on <field>

5). At selection screen

6). start-of-selection

7). end-of-selection

Triggerd on the first page and the subsequent triggering is only if there is a page break.

8). top-of-page

9). end-of-page

For interactive reporting the sequence depends on the user action. If the user double clicks on a line then At line selection is triggered. If the user clicks on some button then At usercommand is triggerd and when the user clicks on a Function Keys like F5,F6 etc then AT pf status is triggered. If there is any page break in the secondary list then the top-of-page during line selection is triggered.

at line selection

at user command

at pf status

top-of-page- during line selection

http://help.sap.com/saphelp_46c/helpdata/en/9f/db9a2e35c111d1829f0000e829fbfe/frameset.htm

Read only

Former Member
0 Likes
666

hi,

No need to follow the sequence,it automatically trigger

all the events,

if we use the standard table we need not need to select

all the key fields, if we use sorted table we need to

select all key fields

Read only

anversha_s
Active Contributor
0 Likes
666

Hi siva,

you shulf follow the sequesnce.

First event -

Initialization : triggered when the report is loaded in memory.

At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.

At selection-screen : before leaving the selection screen.

start-of-selection : the first event for displaying the report.

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.

In an executable program, all statements that are not declarations,

and are listed before the first explicit processing block, are assigned to this event block.

If the program does not contain an explicitly defined event block START-OF-SELECTION,

these statements form the complete event block START-OF-SELECTION.

If a program contains an explicitly defined event block START-OF-SELECTION,

these statements are added to the beginning of the event block.

If the program contains no explicitly defined event blocks,

these statements form the entire event block START-OF-SELECTION.

end-of-selection : after the start-of-selection is completed.

classiscal report events.

top-of-page : every time a new page is started in the list.

end-of-page : every time the list data reaches the footer region of the page.

interactive report events.

top of page during line selection : top of page event for secondary list.

at line-selection : evey time user dbl-clicks(F2) on the list data.

at pF<key> : function key from F5 to F12 to perform interactive action on the list.

at user-command

http://help.sap.com/saphelp_47x200/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm

*********************

You cannot sort a sorted table using the SORT statement. The system always maintains these

tables automatically by their sort order..

If an internal table is statically recognizable as a sorted table, the SORT statement causes a syntax error...

If the table is a generic sorted table, the

SORT statement causes a runtime error if the sort key is not the same as an extract of the

beginning of the table key, you sort in descending order, or use the AS TEXT addition.. with SORT

In other words, the SORT statement is only allowed for generic internal tables, if it does not violate the

internal sort order..

<b>when you use a SORTED table with A KEY option, it creates a index internally. After that when you use a LOOP or READ on that table, it uses the index, becuase of which the performance improves. Where as in case of STANDARD table, its not that effective, as there are no indexes.

In fact it uses the BINARY SEARCH algorithm while searching a SORTED table.

READ table itab with key = vlaue BINARY SEARCH.</b>

rgds

Anver

if hlped pls mrk points

Read only

Former Member
0 Likes
666

we can write the events in any order. but it executes the events in the following order . but for easy to view and understanding purpose we will follow the order.

INITIALIZATION.

AT SELECTION-SCREEN OUTPUT.

AT SECLECTION-SCREEN.

START-OF-SELECTION.

TOP-OF-PAGE.

END-OF-SELECTION.

AT USER-COMMANAD

AT LINE-SELECTION.

TOP-OF-PAGE DURING LINE SELECTION.

why we are using still standard tables instead of sorted tables means when u add a new record into itab for every record it has check all the records in itab and it takes much time to do that. so after entering the records into standard itab we will do sort.