Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

difference between At-new and on change of

Former Member
0 Kudos

Hi,

Can anyone send me the exact difference between At-new and On change of

Thank You

Santosh

8 REPLIES 8

ferry_lianto
Active Contributor
0 Kudos

Hi,

at new - > means inside the loop, the new value.

eg :

1

1

2

3

4

5

5

loop at itab

at new matnr

write matnr.

end at.

end loop.

1

2

3

4

5

On change -> chnage of particular value inside the loop.

Regards,

Ferry Lianto

Former Member
0 Kudos

hi Santosh,

Why don't you loggin with your ID and post the questions rather than using other's ID ...

anywayz

refer these threads to know the difference

Regards,

Santosh

0 Kudos

Hi,

Thanks for the reply .. But i could't get what you have written..

Any way thanks once again.. i just copied the answers you have sent in the previous post and unknowingly just pasted your name sorry..

Thanks and Regards

Anjali

mailid : sapcovet@yahoo.co.in

0 Kudos

Hi ,

Here's the difference between At-new and On-change of...

At-New will trigger for every change in the values of the fields to the left of the field and the field it self where as On-change of will trigger only when there is change of the field value for that field.

For eg:

ITAB -- FLD1 FLD2 FLD3 FLD4

A B C D

A BB C D

A BB CC D

AA BB C D

AA BB CC DD

AA BBB CC DD

In the above example, On change of FLD2 is triggered for 3 times i.e

for ROW 1 --- when value of FLD2 is 'B',

ROW 2 --- when the value of FLD2 is 'BB' ( The field value for FLD2

was changed in this case)

ROW 6 - when the value of FLD2 was again changed to 'BBB'

Always, On-change of triggers whenever there is a change in the field value.

Coming to At-New of FLD2... this is triggered 4 times . At-New considers the change in the field FLD2 as well as the change in the FLD1 value. At new considers any changes to that field and any field to the left of it i.e..

ROW1 -- FLD1 = 'A' , FLD2 = 'B'

ROW2 -- FLD1 = 'A', FLD2 = 'BB',

ROW4 -- FLD1 = 'AA', FLD2 = 'BB',

ROW6 -- FLD1 = 'AA', FLD2 = 'BBB'

To understand in a better way , you can consider all the fields to the left of the AT-NEW field and the AT-NEW field as a string and can compare the value.

Hope this helps you in understanding the difference between AT-NEW and ON CHANGE..

Regards,

Kavitha

0 Kudos

Hi Kavitha,

Thank you very much...

I understood the difference .. but if possible can you send me source code related to this question.

Thanks and regards

Anjali

gastn_jareo
Active Participant
0 Kudos

AT NEW works only inside a loop and for a FIELD of an INTERNAL TABLE. Like this:

LOOP AT it_table.

AT NEW field.

....

ENDAT.

ENDLOOP.

ON CHANGE OF works for every VARIABLE, including a FIELD of an INTERNAL TABLE:

ON CHANGE OF variable.

or

ON CHANGE OF it_table-field.

But for ON CHANGE OF you don't have the AT END, AT FIRST or AT LAST equivalents because the system doesn't have a list of value, then there aren't a known next value, or if there are a next value.

TIP: If you use AT NEW you have to know that every field on right of the checked one is blancked between AT NEW and ENDAT. Be carefull with this. If you need the other values inside the AT NEW construction do that:

DATA: it_table TYPE STANDARD TABLE OF t_type WITH HEADER LINE,

line TYPE t_type.

LOOP AT it_table.

line = it_table

AT NEW field.

....

ENDAT.

ENDLOOP.

Then you can access LINE inside AT NEW construction with all values of actual IT_TABLE record.

Hope it helps.

Gastó

Former Member
0 Kudos

hi santhosh,

here i have mentioned some of the differences between at new and on change of statements.

on change of differs from at new in the following points.

1.on change of can be used in any loop such as select and end select, do-enddo,while-endwhile.

2.else can be used between on change of and endon.

3.on change of can be use with loop at itab where....

4.you can use sum with on change of. It sums all numeric field except the one named after of.

5. when used with in a loop, fields to the right still contain their original values.

Regards...

Arun.

Reward points if helpful.

Clemenss
Active Contributor
0 Kudos

Hi anjali,

I just entered your subject "difference between At-new and on change of" as search terms in the SEARCH FORUM input field.

Please check the results and come back after.

  1. Difference between At new and On change of?

Posted on: 28.09.2006 19:01, by user: subhash soni -- Relevance: 100% -- Show all results within this thread

Hi What is the difference between At new and On change of? Thank You

  1. difference between At-new and on change of

Posted on: 09.03.2007 20:16, by user: anjali nalluri -- Relevance: 89% -- Show all results within this thread

Hi, Can anyone send me the exact difference between At-new and On change of Thank You Santosh

  1. Diff between AT new and on change of

Posted on: 30.11.2006 16:06, by user: Pavan Ravikanti -- Relevance: 53% -- Show all results within this thread

hi, can any one tell me what is the exact difference between <b>AT new</b> and <b>on change of</b> thanks pavan ...

  1. Diff. between At New and On Change Of

Posted on: 05.10.2005 08:58, by user: surya mamtha -- Relevance: 48% -- Show all results within this thread

Hi, Could anybody exlain the difference between At New event and On Change Of event in detail? And how can we avoid the inner loops ...

  1. Major Diff. Between On change of and At New

Posted on: 24.05.2006 12:48, by user: IFF -- Relevance: 46% -- Show all results within this thread

Hi Experts, Could you please let me know that what is the major difference between the control break statements On change of and At new. Which one is best to used ...

  1. diff between at new and on change of

Posted on: 08.03.2007 16:27, by user: saroja ponnam -- Relevance: 44% -- Show all results within this thread

Hi all, what is the main diff between at new and on change of statements. Regards Saroja.

  1. Differnce between AT NEW AND ON CHANGE OF

Posted on: 06.05.2006 10:55, by user: Raja Sekhar T -- Relevance: 44% -- Show all results within this thread

Hi, Differnce between AT NEW AND ON CHANGE OF Iam waiting foryour reply Thanks & Regards Raja Sekhar.T ...

Regards,

Clemens