Application Development and Automation 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: 
Read only

at new

Former Member
0 Likes
446

hi,

can we give multiple fields in at new statement

regards,

siri.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
416

Hi

No!

U can assign only one field, anyway remember that AT NEW <FIELD> is triggered if a value of a field at the left of <FIELD> is changing and not only if <FIELD> is changing.

Max

hi,

can we give multiple fields in at new statement

regards,

siri.

2 REPLIES 2
Read only

Former Member
0 Likes
417

Hi

No!

U can assign only one field, anyway remember that AT NEW <FIELD> is triggered if a value of a field at the left of <FIELD> is changing and not only if <FIELD> is changing.

Max

Read only

aris_hidalgo
Contributor
0 Likes
416

Hi Sireesha,

As Max have said, you cannot declare multiple fields in at new statement. Also, when you declare AT NEW statement, it is best that you sort first your itab. Here is what will happen if you dont sort your itab:

contents of your itab:

FIELD1 | FIELD2

apple | carrot

banana | carrot

apple | delta

apple | delta

apple | delta

so when you loop at your itab:

loop at itab.

at new field2.

write: 'values of field2 changed.'.

endat.

endloop.

So logically the at new statement must trigger at the 3rd loop since your value of field2 changed from carrot to delta but it will triggeron the second loop since the value of field1 changed from apple to banana.

Hope this helps...

P.S. Please award points for useful answers.