Skip to Content
author's profile photo
Former Member

control breaks

Hi all,

I have the data in internal table with order number,

date and other fields.

If i have the order number with more than one date

I have to delete one .

ex:

order no date

10010414 29102001

10010414 06092005

10010415 25102001

10010415 06092005

10010418 16112001

10010418 06092005

I have to delete the hich has higher date for ex for

order 10010414 i have to delete 06092005.

Please help me regarding this matter

regards,

chandu.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • author's profile photo
    Former Member
    Oct 07, 2005 at 02:28 PM

    Declare two tables itab1 and itab2.

    itab1 holds the data as you mentioned.

    itab2 will hold the data as you required.

    sort itab1 by order number ascending

    order date descending.

    loop at itab1.

    at new order number.

    clear itab2.

    itab2 = itab1.

    append itab2.

    endat.

    endloop.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 07, 2005 at 02:32 PM

    Hi,

    SORT itab DESCENDING BY order_no date.

    DELETE ADJACENT DUPLICATES FROM itab COMPARING order_no.

    Svetlin

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 07, 2005 at 03:41 PM

    You should sort your internal table by order number and then use DELETE ADJACENT DUPLICATES FROM itab COMPARING ordernumber. You should not sort it descending as that will bring 06092005 to the top and 29102001 next and 29102001 record will get deleted. Make sure your date field is in internal format that is YYYYMMDD not like in your example DDMMYYYY.

    Srinivas

    Add comment
    10|10000 characters needed characters exceeded