SAP AT EXTRACT ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for AT_EXTRACT

AT - Extract

Short Reference
• AT - extract ABAP Statement

ABAP Syntax(Obsolete)LOOP.
[AT FIRST.
...
ENDAT.]
[AT field_groupi [WITH field_groupj]
...
ENDAT.]
[AT NEW field1.
...
ENDAT.
[AT NEW field2.
...
ENDAT.
[...]]]
[ ... ]
[[[...]
AT END OF field2.
...
ENDAT.]
AT END OF field1.
...
ENDAT.]
[AT LAST.
...
ENDAT.]
ENDLOOP.

ABAP Addition
1 ... FIRST
2 ... field_groupi [WITH field_groupj]
3 ... {NEW}|{END OF} fieldi
4 ... LAST

What does it do? The statement block of a LOOP for extracts can contain control structures for control level processing. The corresponding control statement is AT. The statements AT and ENDAT define statement blocks that are executed at control breaks. Within some of these statement blocks, it is possible to access the automatically created data objects sum(field) and cnt(field).

A prerequisite for control level processing is that the extraction dataset is sorted. The row structure and the sorting produce a group structure of the content of the extraction dataset. Its 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. This is not necessarily the order of the fields in the field group header, but it can be determined by the BY addition in the SORT statement.

The statement blocks within the AT-ENDAT control structures are executed if an appropriate control 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.



Latest notes:Extracts are obsolete. Internal tables are
recommended instead.
• FIRST AT - extract (obsolete)

ABAP Addition

What does it do? The control level is defined by the first row of the extract dataset.
• WITH AT - extract (obsolete)

ABAP Addition

What does it do? 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.
• NEW AT - extract (obsolete)
• END OF AT - extract (obsolete)

ABAP Addition

What does it do? The control 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 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.
• LAST AT - extract (obsolete)

ABAP Addition

What does it do? The control level is defined by the last row of the extraction dataset.



Example ABAP Coding
See Extracts, Processing


Return to menu