Skip to Content
author's profile photo
Former Member

AT END.

I have a problem using the AT END keyword... the program still executes the program statements under AT END eventhough it is still not the end of a field... is there any alternative to this? thanks!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • Best Answer
    author's profile photo
    Former Member
    Sep 30, 2005 at 09:49 AM

    Hi,

    You can use ON CHANGE OF instead of AT END OF.

    It will work with loop also.

    CHEERS

    If your problem is solved reward points and close the thread.

    Message was edited by: Deepak333 k

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 30, 2005 at 09:43 AM

    Hi,

    Check the position of the field in which you are using AT END, if it is a first field in your internal table, then sort the table with that field first before using AT END, but if it is not the first field of internal table then if any of the field contains change for the fields which are left side of this AT END field in internal table then also it will trigger even the AT END field value doesn't change.

    Thansk,

    Rajev

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 30, 2005 at 09:48 AM

    Hi

    The statament AT NEW and AT END of FIELD work if a value of a field at the left of FIELD is changing.

    So if you have

    FIELD1 FIELD2 FIELD3 FIELD4 FIELD5

    A B C D E

    A B C D A

    A D C D A

    A D C D E

    A D C E F

    AT END OF FIELD4 start from record nr. 3 because FIELD2 is changed from B to D

    So or you replace your field at the beginning of table:

    FIELD4 FIELD1 FIELD2 FIELD3 FIELD5

    instead of FIELD1 FIELD2 FIELD3 FIELD4 FIELD5

    or you check the change of value by a variable:

    LOOP AT ITAB.

    IF ITAB-FIELD4 <> WA.

    WA = ITAB-FIELD4.

    ENDIF.

    ENDLOOP.

    Here the problem is you can know when the end of field4 is coming only by the next record.

    You can try to use the statament CHANGE, but I know it works by SELECT, I don't remember if it works by LOOP

    Max

    Message was edited by: max bianchi

    Message was edited by: max bianchi

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 30, 2005 at 10:19 AM

    hi, different from AT LAST, AT END OF XXX is just for the last entry of of a group of entries in the internal table.

    And there is also an important thing you need to do, sort the internal table by the fields XXX, before you use the AT END OF XXX on it.

    thanks

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 30, 2005 at 09:33 AM

    hai,

    check out weather you have done this way.

    first step is you need to sort teh internal table first with the key has what you are going to give in AT end <filedname>

    remember onething always the at end will be eecuted only when the field value is changed . if you have done this way and still not working, pls paste the code

    cheers

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 30, 2005 at 09:42 AM

    Hi Jason,

    You can use AT LAST if there is only one group for which you are sorting.

    Expample:

    Itab contains the following values

    KUNNR MATNR QTY

    -


    600012 22 20

    600012 22 40

    In the above case you can use AT LAST if you are sorting w.r.t. KUNNR.

    KUNNR MATNR QTY

    -


    600012 22 20

    600012 22 40

    600013 25 50

    600014 25 60

    You can Use AT END OF KUNNR in this Case.

    Regards,

    Baburaj

    Add comment
    10|10000 characters needed characters exceeded