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 problem.

aris_hidalgo
Contributor
0 Likes
639

Hello experts,

I am currently having a problem with my At New statement. It is treating every field of the itab as a new record even though it is the same. for example, on the first loop the field tdline has a value of A then the at new will trigger. then on the second loop tdline has a value of B then again, At New will trigger.that is correct. But on the third loop, the field tdline will have a value again of B - the same as that of the second loop. So it must not trigger the At New statement but it does. Any solutions guys? Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
545

hi,

first you should sort the internal table.

second B is different from b.- please check this in your case.

third the field what your using AT NEW is first column or not. if it is not then it will consider the combination of all the coumns before that as value.

For EX

col1 col2 are in internal table, contain values

A A

A A

A B

C B

at new col2.

this statment will trigger 3 times.

Hope you understand.

3 REPLIES 3
Read only

Former Member
0 Likes
546

hi,

first you should sort the internal table.

second B is different from b.- please check this in your case.

third the field what your using AT NEW is first column or not. if it is not then it will consider the combination of all the coumns before that as value.

For EX

col1 col2 are in internal table, contain values

A A

A A

A B

C B

at new col2.

this statment will trigger 3 times.

Hope you understand.

Read only

Former Member
0 Likes
545

Hi

You haven't given the sample code of your report,anyway here i am giving a simple code of the At New statement.Try your report accordingly i hope this will help you to solve your problem.

DATA: BEGIN OF COMPANIES OCCURS 20,

NAME(30),

PRODUCT(20),

SALES TYPE I,

END OF COMPANIES.

...

LOOP AT COMPANIES.

AT NEW NAME.

NEW-PAGE.

WRITE / COMPANIES-NAME.

ENDAT.

WRITE: / COMPANIES-PRODUCT, COMPANIES-SALES.

AT END OF NAME.

SUM.

WRITE: / COMPANIES-NAME, COMPANIES-SALES.

ENDAT.

Thanks

Mrutyunjaya Tripathy

Read only

Former Member
0 Likes
545

hi,

You've got to specify the key field on which u want the event to be triggered. Also make sure tht ur intenal table is sorted.

For eg.

LOOP AT I_MARA.

AT NEW MATNR.

........

ENDAT.

ENDLOOP.

an alternative to the AT NEW event is

ON CHANGE OF (SPECIFY KEY FEILD).

ENDON.

Pls reward points if found useful.