Skip to Content
0
Feb 15, 2006 at 10:38 AM

"AT NEW" problem

25 Views

I have tried the following:

SORT ITAB BY FIELD1 FIELD2 FIELD3.

LOOP AT ITAB.

AT NEW FIELD1.

WRITE :/ FIELD1.

ENDAT.

(other fields are output here)

ENDLOOP.

However, FIELD1 is output for every record in itab.

When I tried,

LOOP AT ITAB.

IF ITAB-FIELD1 <> PREVIOUS_FIELD1_VALUE.

WRITE :/ FIELD1.

ENDIF.

(other fields are output here)

PREVIOUS_FIELD1_VALUE = ITAB-FIELD1.

ENDLOOP.

field1 is written only when there is a change in value of field1.

I wonder the field value comparison in "AT NEW" will be interrupt by my logic that output other field values...

Are there any functions that I need to avoid to use in order to have "AT NEW" works properly?

P.S. my codes under "AT NEW" are mainly "WRITE AT ..." and some logicial comparison like (IF...ENDIF)