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 for each field

Former Member
0 Kudos

Hi All,

i have data with following field:

field1

field2

field3

i want every new of each field will perform difference function

so i'm use

LOOP AT i_data INTO wa_data.

AT NEW field1.

PERFORM func1.

ENDAT.

AT NEW field2.

PERFORM func2.

ENDAT.

ENDLOOP.

but if i'm used that code, func2 will executed every at new of field2 and field1.

how to fix this problem??

1 ACCEPTED SOLUTION

Former Member
0 Kudos

LOOP AT i_data INTO wa_data.

AT NEW field1.

PERFORM func1.

exit.

ENDAT.

AT NEW field2.

PERFORM func2.

ENDAT.

ENDLOOP.

are give some flag .

Regards

Anbu B

5 REPLIES 5

Former Member
0 Kudos

Hello

Before LOOP write:

sort i_data by field1 field2 field3.

Former Member
0 Kudos

As per my understanding you want to perform difference function on new field1,field2,field3 combination.

first sort i_data on field1,field2,field3 asceding.

LOOP AT it_data into wa_data.

AT NEW field3.

PERFORM func2.

ENDAT.

ENDLOOP.

Regards,

Aparna Gaikwad

Former Member
0 Kudos

LOOP AT i_data INTO wa_data.

AT NEW field1.

PERFORM func1.

exit.

ENDAT.

AT NEW field2.

PERFORM func2.

ENDAT.

ENDLOOP.

are give some flag .

Regards

Anbu B

0 Kudos

thanks Anbu B.

but maybe we wan use CONTINUE better than EXIT.

and place at new field 1 before of field 2.

any other better answer?

Former Member
0 Kudos

Hi,

From what i get from your query the code would be something like that:

LOOP AT i_data INTO wa_data.

AT NEW field1.

PERFORM func1.

AT NEW field2.

PERFORM func2.

ENDAT.

ENDAT.

ENDLOOP.

before this loop, do sort your internal table.

Regards,

Surinder