Application Development 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: 

wat is the diff. between at first and top of page

aarif_baig
Active Participant
1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos

If you want to Display the Heading, then use EVENT TOP-OF-PAGE.

This event would be triggered only once for every Page.

6 REPLIES 6

former_member188827
Active Contributor
0 Kudos

at first is event used in control level processing in internal tables where as top of page is used in formatting output...

0 Kudos

tell me atleast 3

former_member223537
Active Contributor
0 Kudos

If you want to Display the Heading, then use EVENT TOP-OF-PAGE.

This event would be triggered only once for every Page.

Former Member
0 Kudos

Hi

At-FIRST is used with in the Internal table loop to write something for the first time like some heading before the data is displayed.

It is a control break statement in internal table

Top-of-page is used to Write the report headings/column headings etc for the report.

This will displayed only once and is visible for all the pages thoguh the data is for more pages.

A WRITE statement in this event fires the output of a report

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos

Hi Aarif,

<b>At first:</b> This a control statement event used for a particular field when looped for a internal table .

Eg: Loop at it_tab into wa_tab.

at first <field-name>.

......

......

endat.

endloop.

<b>Top-of-page:</b> This is an event which will be triggered for the whole report at every page break based upon the number of records displayed using internal table.

Eg: top-of-page.

write: 'This is a test code'.

This text is displayed at the top of the page whenever we do page down.

regards,

Thasneem

Former Member
0 Kudos

<b>AT - itab </b>

Syntax

LOOP AT itab result ...

[AT FIRST.

...

ENDAT.]

[AT NEW comp1.

...

ENDAT.

[AT NEW comp2.

...

ENDAT.

[...]]]

[ ... ]

[[[...]

AT END OF comp2.

...

ENDAT.]

AT END OF comp1.

...

ENDAT.]

[AT LAST.

...

ENDAT.]

ENDLOOP.

Extras:

1. ... FIRST

2. ... |{END OF} comp 3. ... LAST Effect The statement block of a LOOP loop can contain control structures for control level processing. The respective control statement is AT. The statements AT and ENDAT define statement blocks that are executed at control breaks. Within these statement blocks, the statement SUM can be specified to total numeric components of a group level. In the case of output behavior result, the same applies as for LOOP AT. So that group level processing can be executed correctly, the following rules should be noted: After LOOP there should be no limiting condition cond specified. The internal table must not be modified within the LOOP loop. The work area wa specified in the LOOP statement after the INTO addition must be compatible with the line type of the table. The content of a work area wa specified in the LOOP statement after the INTO addition must not be modified. The prerequisite for control level processing is that the internal table is sorted in exactly the same sequence as the component of its line type - that is, first in accordance with the first component, then in accordance with the second component, and so on. The line structure and the corresponding sorting sequence gives a group structure of the content of the internal table, whose levels can be evaluated using AT statements. The AT-ENDAT control structures must be aligned one after the other, in accordance with the group structure. The statement blocks within the AT-ENDAT control structures are listed if an appropriate control break is made in the current table line. Statements in the LOOP-ENDLOOP control structure that are not executed within an AT-ENDAT control structure are executed each time the loop is run through. If the INTO addition is used in the LOOP statement to assign the content of the current line to a work area wa, its content is changed upon entry into the AT-ENDAT control structure as follows: The components of the current group key will remain unchanged. All components with a character-type, flat data type to the right of the current group key are set to character "*" at that position. All the other components to the right of the current group key are set to their initial value. When the AT-ENDAT control structure is exited, the content of the current table line is assigned to the entire work area wa. Note If the INTO addition is used in the LOOP statement, a field symbol can be specified outside of the classes after AT |{END OF}. The appropriate component of the work area wa is assigned to this field symbol.

Addition 1

... FIRST

Effect

First line of the internal table.

Addition 2

... |{END OF} comp

Effect

Beginning or end of a group of lines with the same content in the component comp1 comp2 ... and in the components to the left of comp1 comp2 .... The components comp1 comp2 ... can be specified, as described in the section Specification of Components, with the limitation that access to object attributes is not possible here.

Addition 3

... LAST

Effect

The last line of the internal table.

<b>TOP-OF-PAGE </b>

Syntax

TOP-OF-PAGE [DURING LINE-SELECTION].

Addition:

... DURING LINE-SELECTION

Effect

This statement defines an event block whose event is triggered by the ABAP runtime environment during the creation of a list. This occurs when a new page is started - that is, immediately before the first line in a new page is to be output. All list outputs that take place in the event block are placed below the standard page header of the list. You cannot output more lines than are available in the page within the event block. The NEW-PAGE statement is ignored within this event block.

The entire output written to the list in the event block belongs to the page header of the current list page. The top page header cannot be moved when you scroll vertically in a list displayed on the screen.

Addition

... DURING LINE-SELECTION

Effect

If you do not use an addition, an event block is triggered for event TOP-OF-PAGE during the creation of a basic list. If you use the addition DURING LINE-SELECTION, an event block is triggered for the corresponding events during the creation of details lists. You have to use system fields like sy-lsind to distinguish between the individual details lists.

Regards,

Pavan