-->Requirement :
Sometimes, in a program ,certain set of statements need to be processed conditionally.
For instance,
->at the start of the internal table (at first)
->at the end of the internal table (at end, at last).
->when a field value of internal table changes. In order to format & display the Internal Table data according to the above requirement we use
Control Level Statements , that helps in reducing the lines of code. Also the Internal Table is to be 'Sorted' before using the Control Level Statements.
Following are the Control Level Statements.
- AT FIRST......ENDAT
- AT LAST......ENDAT
- AT NEW <COL>......ENDAT
- AT END OF <COL>......ENDAT
AT FIRST: To display the required data at the beginning of the internal table.
The output is displayed as follows.
-
AT LAST:
To display the required data as LAST line of the internal table.
--> The output is displayed as follows.
AT NEW.*If a group of lines of a particular column have same value, it can be displayed at the beginning only once using the control level statement
At New <column name>.
The columns to the left of <column name> are also considered by the 'At New' condition.
Say internal table contents are as follows:
Carrid connid
AA 0017 385 349
AA 0017 386 432
AB 0017 345 254
AB 0016 243 423
"At New Connid." Works as follows:
Carrid connid
AA 0017
385 349
386 432
AB 0017 345 254
AB 0016 243 423
Ex:
-->The output is displayed as follows:
Ex2:
The columns to the right of the specified column appear as ****** when specified inside the
At New ...Endat loop.
-->The output is displayed as follows:
AT END OF: If a group of lines of a particular column have same value, it can be displayed at the End of the group only
once using the control level statement At End of <column name>.
The columns to the left of <column name> are also considered by the 'At End Of ' condition.
Ex:
The output is displayed as follows: