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: 

AT NEW problem

Former Member
0 Kudos

Hi experts,

i want to use at new for 7th field of the table.

i have sorted the table. i have the three records with

opno 10,20,30....

i want to save the data after opno = 30.

see the following code.

but the first loop itself the control is trigging AT END OF event.

where i am doing wrong.

Please help me.

sort itab by opno.

Loop at itab.

at first.

first_flag = 'x'

.....

.....

endat.

AT END OF opno.

last_flag = 'x'.

END AT.

if last flag = 'x'.

....

...

endif.

where i am doing wrong.

Please help me.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Ramesh,

Change as follows in BOLD.

Loop at itab.

at first.

.....

.....

endat.

AT END OF opno.

<b>if opno > 30....

  • DO WHAT EVER U WANT...

endif.</b>

END AT.

endloop.

Thanks

Kam

9 REPLIES 9

Former Member
0 Kudos

Ramesh,

Change as follows in BOLD.

Loop at itab.

at first.

.....

.....

endat.

AT END OF opno.

<b>if opno > 30....

  • DO WHAT EVER U WANT...

endif.</b>

END AT.

endloop.

Thanks

Kam

0 Kudos

thanks for your reply.

my opno will be changed on order number.

for example:

orderno subordno fieldx fieldy opno

900123 10054 xxx yyyy 10

900123 10053 xxx yyyy 20

900123 10057 xxx yyyy 30

900124 10052 xxx yyyy 10

900124 10059 xxx yyyy 20

900126 10053 xxx yyyy 10

900127 10051 xxx yyyy 10

900343 10335 xxx yyyy 10

900345 10334 xxx yyyy 20

900345 10033 xxx yyyy 30

0 Kudos

sorry

it shoud be like this

900123 10054 xxx yyyy 10

900123 10053 xxx yyyy 20

900123 10057 xxx yyyy 30

900124 10052 xxx yyyy 10

900124 10059 xxx yyyy 20

900126 10053 xxx yyyy 10

900127 10051 xxx yyyy 10

900345 10335 xxx yyyy 10

900345 10334 xxx yyyy 20

900345 10033 xxx yyyy 30

0 Kudos

So do you want to do something at the last record per order? Or only when the operation is 30.

Regards,

Rich Heilman

0 Kudos

You should try AT END OF ordernum, because, I think that is what you are trying to do.

Srinivas

0 Kudos

I was thinking the same.

Regards,

RIch Heilman

0 Kudos

hi,

I guess your problem is that, if any field before the 7th have changed, it will get in the "at new" statement.

You got it ?

Alexandre Nogueira.

0 Kudos

Ramesh,

Rich, I gave him the same idea in my first posting!!!

Loop at itab.

at first.

.....

.....

endat.

<b>AT END OF opno.

if opno > 30....

  • DO WHAT EVER U WANT...

endif.

END AT.</b>

endloop.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Can you put the 7th field as the first field of the internal table?

Please consider closing your other posts if your question has been answered.

Regards,

Rich Heilman