Skip to Content
avatar image
Former Member

AT NEW problem for each field

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??

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 10, 2008 at 04:42 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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?

  • avatar image
    Former Member
    Sep 10, 2008 at 04:40 AM

    Hello

    Before LOOP write:

    sort i_data by field1 field2 field3.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 10, 2008 at 04:42 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 10, 2008 at 05:04 AM

    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

    Add comment
    10|10000 characters needed characters exceeded