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 are pool tables?

651


Mention what is alv programming in abap?

584


5) How to rereive text elements in SF and script?

1644


What are the different types of parameters? : abap modularization

614


Difference between Read and Get cursor?

1603






Which objects are independent transport objects? : abap data dictionary

576


Difference between sy-tabix and sy-index?

780


How to display if the value entered contains records or not?

587


Can you create an internal table dynamically?(at run time)

1427


What type of user exits have you written ?

1509


singleton class

933


What are data classes? What are the various data classes available for selection? : abap data dictionary

554


What are Pull and Push Methods?

1774


1.why dont use top of page. wat is the use? 2. wat is sub screen? 3. why u select the session method in bdc ? how many records wil be updated on that time? 4.why dont use start form in script? 5.wat is difference b/w dilldown and interactive report? 6. wat is pf status interactine report?

2354


Difference between sap script and report?

746