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

Can a domain, assigned to a data element be changed? : abap data dictionary

713


Explain how is batch input process different from processing on line?

702


What is the differences between structure and table in the data dictionary in abap?

790


What are base tables of an aggregate object?

779


Explain the differences between interactive and drill down reports?

677






please any one can tell me How to validate the data in Table maintinance generator?how can u validate the table field values if u r entering the data into fields .it shows record is wrong?wher we can done validation in table maitenance generator before getting the data as out ?

1740


Explain the call transaction method? : abap bdc

745


1 . how do u design technical documentation in abap ? 2 . what u currently devloped in sap abap ?

2718


How do you take care of performance issues in your ABAP programs?

821


What is at exit-command:?

703


How many primary keys can be created for a table?

752


Explain the data types of internal tables?

781


how 2 create the normal form by using functional module

2289


How do you Export a session ?

1755


What is singleton pattern in OOPS?

1104