Skip to Content

How to remove value for Duplicate record

Dear All,

I am having following scenario.

I

INVOICE NUMBER item
Deliverynumber Delivery value 50001 10 DEL10001 50 50002 20 DEL10001 50 50003 10 DEL10001 50

i want to delete the value for "Delivery Value" on the basis of Delivery number which is repeating and not entire row.How can i routine for same.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Jun 01, 2015 at 12:50 PM

    Hi Tushar,

    I think you can achieve this by writing delete statement in end routine level. I am just giving hint here, based on your requirement do necessary declaration part.

    Delete adjacent duplicates from <itab>  comparing < Delivery number>.

    Thanks & Regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 01, 2015 at 02:03 PM

    Hi,

    sort the internal table,

    SORT lt_test

          DELETE ADJACENT DUPLICATES FROM <lt_test>

          COMPARING <delivary number>.

    Thanks,

    Phani.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 31, 2015 at 05:18 PM

    Hi

    If you want to achieve this at report level , create a customer exit variable on Delivery Number and delete the unwanted/duplicate record in exit. Do not make this variable input ready and include this in your report design .

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 01, 2015 at 02:45 PM

    Hi,

    Can you show your DESIRED OUTPUT for your example above?

    Regards,

    Loed

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 01, 2015 at 03:40 PM

    Hi Tushar,

    If I understand your issue correctly

    As is

    INVOICE NUMBERitem
    DeliverynumberDelivery value5000110DEL10001505000220DEL10001505000310DEL10001

    50

    To be

    INVOICE NUMBERitem
    DeliverynumberDelivery value5000110DEL10001505000220DEL100015000310DEL10001

    The problem your facing at present , you may be using Delivery number either report or another

    while using delivery number it repeating three times here because of 10,20 and 10  items based on this "Delivery value" aggregating 150 which is wrong your expecting delivery value 50.

    For goto maintenance of delivery value key figure->Aggregation Tab-->Exception Aggregation--> first value  and

    Reference char of exp aggre "Delivery number"

    in report it will only 50 instead of 150.

    And if you want do with code , here is code.

    Data wa_dn type data element of delivery number.

    loop at source_package assigning <source_fields>.

    if sy-tabix eq 1.

    clear : wa_dn.

    wa_dn = <source_fields>-delivery_num.

    endif.

    if sy-tabix gt 1.

    if wa_dn = <source_fields>-delivery_num.

    <source_fields>-delivery value = 0.

    else.

    clear : wa_dn.

    wa_dn = <source_fields>-delivery_num.

    endif


    endif.

    endloop.

    Thank you,

    Nanda

    Add comment
    10|10000 characters needed characters exceeded