difference between at new and on change of

pl its urgent

Answer Posted / suresh kumar

When we use At new for a field, it will trigger whenever
there is any change in all the fields from the left to that
of the particular field. But when we use On change of it
triggers only when there is any change in the particular field.

At new can only be used inside loop. On change of can used
outside the loop.

No logical Expressions can be added with at new. Logical
expression like OR can be used with on change of.

When AT NEW occurs, the alpha-numeric fields have * in their
value, where as in case of On Change, the alphanumeric
fields have their Corresponding value, of that particular
record, where the Event gets fired.

In the below code it matters with structure sequence.
If 1st column to be BUKRS and 2nd column to be F1 in ITAB
Structure then the At New event will show F1 column values
as '*' asterisks.

REPORT ZGSK.
*..........AT NEW Vs ON CHANGE OF EVENTs.............. *

DATA : BEGIN OF ITAB OCCURS 0,
F1(10) TYPE C,
BUKRS LIKE T001-BUKRS,
END OF ITAB.

ITAB-BUKRS = '1000'.
ITAB-F1 = 'ababcbcb'.
APPEND ITAB.

ITAB-BUKRS = '1100'.
ITAB-F1 = '1233333'.
APPEND ITAB.

ITAB-BUKRS = '1100'.
ITAB-F1 = '3333333'.
APPEND ITAB.

ITAB-BUKRS = '1200'.
ITAB-F1 = '555555'.
APPEND ITAB.

*AT NEW
LOOP AT ITAB.
AT NEW BUKRS.
WRITE :/ ITAB-BUKRS , ITAB-F1.
ENDAT.
ENDLOOP.

ULINE.

*AT ONCHANGE
LOOP AT ITAB.
ON CHANGE OF ITAB-BUKRS.
WRITE :/ ITAB-BUKRS , ITAB-F1.
ENDON.
ENDLOOP.

ULINE.

*AT ONCHANGE with Logical Expression "OR"
LOOP AT ITAB.
ON CHANGE OF ITAB-BUKRS or ITAB-F1.
WRITE :/ ITAB-BUKRS , ITAB-F1.
ENDON.
ENDLOOP.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the t-code to link technical and functional operation?

1974


What is processing class, where we do them and why? : sap abap hr

576


Explain the sequences of event block?

558


What is an update task? : abap modularization

592


What is Buffering Concept? When should a Table be buffered?

11800






What are control tables?

678


What is the difference of update types in call transaction method ? : abap bdc

634


A subroutine can contain nested form and endform blocks. State true or false. : abap modularization

778


How can we set the table spaces and extent sizes? : abap data dictionary

744


Is a logical database a requirement/must to write an abap/4 query?

588


WHY CLUSTER TABLE CALLED AS CLUSTER TABLE.

1637


Can we use transfer dataset to transfer data in internal table ?

1648


What is the structure of the bdc table? : abap bdc

732


What are plan versions used for? : sap abap hr

576


In selection screen, I have three fields, plant material number and material group. If I input plant how do I get the material number and material group based on plantdynamically?

604