SAP CNT ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• cnt ABAP_DATA_OBJECT

cnt( )

ABAP_SYNTAX_OBS
... cnt(field) ....

What does it do?
For the fields field1, field2, ... of the field groups of an extract dataset, data objects named cnt(field1), cnt(field2), ... of data type i are created automatically. These fields can be accessed only within a LOOP and are filled with values for sorted extract datasets using the statements AT END OF and AT LAST.
If field1, field2, ... are fields with a non-numeric data type of the field group header and the extract dataset was sorted by field1, field2, ..., then cnt(field1), cnt(field2), ... contain the number of different values that field1, field2, ... have within the group level or the entire dataset.
If the fields cnt(field1), cnt(field2), ... are accessed without first sorting the extract dataset, an uncatchable exception can be raised.



Latest notes:

No substring access cnt(len) can be made on a data object called cnt without an explicit offset specification. The compiler always interprets an offset specified like this as a field for an extract dataset.