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
What are the relational operations that can be performed on view in sap? : abap data dictionary
What is exception class and test class. How to use it?
How can a lock object be called in the transaction?
Explain the difference between domain and data element? What are aggregate object?
Difference between domain and data element? What are aggregate object?
What is the purpose of creating symbolic a/c, what is transaction code for same? Can we assign one symbolic a/c to multiple wage types? : sap abap hr
Did you create any joins?
What two statements are required in an abap program to output an icon using a write statement?
Can we include customizing include or an append structure with pooled or cluster tables? : abap data dictionary
How do you document abap/4 programs? Do you use program documentation menu option?
What is roles and responsibilities of sap hr consultants? : sap abap hr
Explain what are the different functions used in sap script?
What are the domains and data element?
What is the project you are currently working and work that you are doing
What kind of financial periods exist in sap? What is the relavent table for that?