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

Explain the use of insert and append statement in sap abap?

696


Explain about sap fico testing and the tools used? : abap bdc

691


What application areas are you comfortable in?

953


Explain what are the events used in interactive reports?

591


Write the bdc table structure? : abap bdc

687






suppose i want to print sap script output in different printers at a time what are the settings i'll have to make?

1947


What is an abap?

650


Explain different types of attributes of function module?

638


What are the components of selection table?

715


1. If I send 5 entries of table from one system to another system, if the only 4 entries there in the target system what I have to do? 2. If I send the customer master IDOC from one SAP system to another system, if one field is missing in target table what is the steps? 3. If I want to access the 4th row 3rd column in the hashed table how to do it? 4. Whether there is any other statement than MODIFY statement to modify the content of internal table?

1515


How do you activate a function exit?

653


Name some system global variables you can use in abap programs?

636


Double click function on the lists, identifying the line selected by the user on the list?

730


SAP query how to use end users?

1784


What is roles and responsibilities of sap hr consultants? : sap abap hr

694