SAP® Documentation

Single view


Fill RESBD Structure from EBP Component Structure   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

AT - Extract

Short Reference

Obsolete Syntax

  $[AT field_groupi $[WITH field_groupj$]
    $[AT NEW field1.
      $[AT NEW field2.
           $[ ... $]
        AT END OF field2.
     AT END OF field1.
  $[AT LAST.


1. ... FIRST

2. ... field_groupi $[WITH field_groupj$]

3. ... ${NEW$}$|${END OF$} fieldi

4. ... LAST


The statement block of a LOOP for extracts can contain control structures for group level processing. The corresponding control statement is AT. The statements AT and ENDAT define statement blocks that are executed at group breaks. Group breaks between group levels are a result of the row structure and the processing order in which the LOOP reads the rows of the extract dataset. Within some of the statement blocks, it is possible to access the automatically created data objects sum(field) and cnt(field).

Apart from the special variants AT FIRST, AT field_group, and AT LAST, group levels are defined using the variant AT NEW and the sequence of rows in the extract. These are the rows that have the same content in a group key defined in their initial parts. It is possible, from a syntax point of view, to arrange AT control structures in any order and to nest them, however effective group level processing is usually only achieved by the arrangement above. Here, the control structures are specified in accordance with the arrangement of the components in the group key and are not nested.

The statement blocks within the AT-ENDAT control structures are executed if an appropriate group break is made in the current row. Statements in the LOOP-ENDLOOP control structure that are not executed within an AT-ENDAT control structure are executed in each pass of the loop.


  • In one very common case, the extract dataset is sorted exactly in accordance with the group key.
  • Extracts are obsolete. Internal tables are recommended instead.

Addition 1

...  FIRST


The control level is defined by the first row of the extract dataset.

Addition 2

... field_groupi $[WITH field_groupj$]


A row that is attached to the extract dataset using the statement EXTRACT field_groupi. If the WITH addition is specified, the next row must be defined by the field group field_groupj.

Addition 3

... ${NEW$}$|${END OF$} fieldi


The group level is defined by the beginning or end of a group of rows with the same content in the component fieldi and in the component links of fieldi. The content of these components determines the control key. The component field must be part of the field group header. Components whose content is hexadecimal 0 are not included as a control break criterion.

For fieldi, a field symbol can also be specified. If a component of field group header is assigned to the field symbol when the statement is executed, this has the same effect as specifying the respective component. If no data object is assigned to the field symbol, the specification is ignored. If another data object is assigned to the field symbol, a non-handleable exception is raised.

Addition 4

... LAST


The control level is defined by the last row of the extraction dataset.

Extracts, Processing

BAL_S_LOG - Application Log: Log header data   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 6988 Date: 20191215 Time: 085303     sap01-206 ( 40 ms )

Our Service

Looking for Support? Questions?




Leave us your contact details and we will call you back. Panels marked with * are mandatory.