Delete Duplicate entries in itab

Dear Experts,
My code is Below. my requirement is all the work area fields are modify comparing matnr.
but i am use append duplicates entris allowed.only possible to modify.
loop at it_ekpo into wa_ekpo.
read table it_ekpo3 into wa_ekpo3 with key matnr = wa_ekpo-matnr.
if sy-subrc = 0.
wa_ekpo-matnr = wa_ekpo3-matnr.
wa_ekpo-menge = wa_ekpo3-menge.---->count field
modify it_ekpo from wa_ekpo.
endif.
endloop.
sort it_ekpo.
DELETE adjacent DUPLICATES FROM it_ekpo comparing matnr.
(Duplicates entry is not working) so modify is changed.
reference:   -
>it_ekpo  in this way
ebeln      matnr   menge    ecp
10           lo45       1          iiii
10           l045       1          uuy
10           lo77       1          hhj
13           li12.       1          jhjh     [mainly i join one itab ibn it_ekpo]
reference------>it_ekpo3.
ebeln      matnr     menge
10           lo45        2
10           lo77        1
13           li12         1
my final output is --->it_ekpo          in this way.
ebeln      matnr   menge    ecp
10           lo45       2          iiii
10           lo77       1          hhj
13           li12.       1          jhjh      
<removed_by_moderator>
regards,
raj.
Edited by: Julius Bussche on Dec 11, 2008 5:30 PM

sort it_ekpo by matnr.
not
sort it_ekpo.

Similar Messages

  • Delete duplicate entries

    Please go to the following website:-
    http://help.sap.com/saphelp_nw04/helpdata/en/06/aafd54fc4011d195280000e8353423/content.htm
    and please scroll down to find:-
    <b>Deleting Adjacent Duplicate Entries</b>
    To delete adjacent duplicate entries use the following statement:
    DELETE ADJACENT DUPLICATE ENTRIES FROM <itab>
                                      [COMPARING <f1> <f 2> ...
                                                 |ALL FIELDS].
    Then  please go to the last example  where the code is written as :-
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
    IS  THIS CORRECT ?
    Regards
    abaper.learner

    Hi learner,
    <b>Deleting a sequence of lines</b>
    DO 101 TIMES.
    DELETE TAB_DEST INDEX 450.
    ENDDO.
    DELETE TAB_DEST FROM 450 TO 550.
    <b>Deleting a set of lines</b>
    LOOP AT TAB_DEST
      WHERE K = KVAL.
    DELETE TAB_DEST.
    ENDLOOP
    DELETE TAB_DEST WHERE K = KVAL.
    <b>DELETE ADJACENT DUPLICATES</b>
    As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplicate rows.
       LOOP AT TAB1.
        READ TABLE TAB2 INDEX SY-TABIX.
          IF TAB1 <> TAB2.                
          TAB_DIFFERENT = 'X'. EXIT.    
        ENDIF.                          
      ENDLOOP.                          
    ENDIF.                              
    IF TAB_DIFFERENT = SPACE.   " ...                             
    ENDIF.                              
    IF TAB1[] = TAB2[].    " ...              
    ENDIF.               
    Regards,
    Kumar.

  • How to delete duplicate entries in address book

    Is there an easy way to delete duplicate entries in Address Book?

    I have an iPhone where I create new contact details and a MB Air running OX X 10.7.3
    In Address Book I see duplicate entries across the whole book. The other day I was traveling without my MB and needed to urgently reach someone who's number I knew was in my iPhone contact list for sure but searched and search and couldn't find it.
    Turns out that when I had been going through the Adress Book on the MB Air trying to eliminate some of the duplicates I had chosed --without even knowing it or realzing it-- the card that I guess sync with my iPhone. It was gone. Sure enough, when I got back and looked it up on the MB Air it was still there not syncing to my iPhone.
    I have used Address Book / Card / Look for Duplicates ...
    I have also followed the Help suggesting and pressed Control / select to highlight two duplicate cards and even though the First / Last / Company / phone numbers / etc. are all the same I get the message: "The cards could not be merged because they came from different accounts."
    I have checked with guys from the office who have the exact same problem with no idea how to solve the problem.
    Is it that in order to use Address Book on both an iPhone and an OS X machine you've just got to be smarter, more sophisticated, more IT oriented?
    Seems like a pretty easy thing not to be struggling with.
    I should mention that I was a Mobile Me subscriber and now use iCloud which I'm sure has something to do with all of this.
    But it seems pretty basic to me. If I have an Address Book it should synchronize between OX X and IOS.

  • How to delete duplicate entries in match code

    I want to delete duplicate entries in match code.

    If you go down the search exit route, using function module F4_IF_SHLP_EXAMPLE or function module F4_IF_SHLP_EXIT as a template you want it where callcontrol-step = 'DISP'.  You would sort the table: SORT RECORD_TAB BY STRING and then delete adjacent duplicates. If this does not wok because of the fields you have in your search help, you will need to select the data into another internal table and match the relevant entries from your internal table  with the relevant position in field STRING of RECORD_TAB.  The positions in STRING will be as per the order of the parameters  you have defined in the search help.
    Hope this helps.
    Regards
    Larissa

  • Deleting Duplicate entries from Internal tbale

    Hi All,
    I have used this code to delete duplicate entries from an internal table.
      DELETE ADJACENT DUPLICATES FROM IT_KOSTL COMPARING KOSTL hours.
    After this statment, still the internal table will remain with a duplicate row.
    Earlier table content before the delete statement:
    Lno  KOSTL                PRCTR                       hours                      hours1 
    1    2081010205     0000208101                 5525.000          1574.500
    2    2081010105     0000208101       105162.000     73854.750
    3    2081010105     0000208101       105162.000     73854.750
    4    2081010205     0000208101        5525.000     1574.500
    The Table gets modified after execution of DELETE statement as follows.
    Lno  KOSTL                PRCTR                       hours                      hours1 
    1    2081010205     0000208101                 5525.000          1574.500
    2    2081010105     0000208101       105162.000     73854.750
    3    2081010205     0000208101        5525.000     1574.500
    Why the line 3 is still present in the table?
    I hope as per that syntax, this line too should get delete.... Is it right?
    Basically i would like to delete both line 3 and line 4 from....
    How to resolve this issue?
    Please help me out....
    Regards
    Pavan
    What might be the reason?

    >
    Pavan Sanganal wrote:
    >   DELETE ADJACENT DUPLICATES FROM IT_KOSTL COMPARING KOSTL hours.
    > Why the line 3 is still present in the table?
    >
    > I hope as per that syntax, this line too should get delete.... Is it right?
    >
    Let me answer you all doubts.
    Why the line 3 is still present in the table?
    Actually it's not 3rd line, it's 2nd line.3rd line were deleted.
    when delete adjecent duplicates trigger than it would delete lower line(3rd in your case) not upper line.
    I hope as per that syntax, this line too should get delete.... Is it right?
    NO.

  • Deleting duplicate entries

    I have two tables (Accounts, and Accounts_LOAD). The _Load table is a daily feed.
    For my first step, I need to delete all the duplicates from _Load that exist in Accounts. 
    How can I delete duplicate entries which exist in two tables..?

    I think that the Merge will suffice. My apologies.
    But, now (again, sorry) I have a couple questions on the merge.
    Below is similar to what I would use and a few Q's on it....
    line4: can u use multiple "on" ?
    line5:For 'when matched' i only want to update fields from "_load" to "Accounts" that need to be updated. If they are the same, they would be ignored... is that possible...?
    1 MERGE INTO accounts acc
    2 USING (SELECT **ALLFIELDS**
    3 WHERE SOMESTUFF=STUFFS) STF
    4 ON (ACC.ID_USER = STF.ID_USER) AND (ACC.SYSTEM_ID = STF.SYSTEM_ID)
    5 WHEN MATCHED THEN UPDATE SET acc.bonus = D.bonus + S.salary*.01
    6 DELETE WHERE (S.salary > 8000)
    7 WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
    8 VALUES (S.employee_id, S.salary*0.1)
    9 WHERE (S.salary <= 8000);

  • Deleting duplicate entries in iCal?

    How do I delete duplicate entries in iCal (identical entries on the same date)?

    Todd,
    I suspected a more serious problem because the answer was too easy.
    Thousands of duplicate entries...Is this what happened?
    According to, Mac OS X 10.4: Stay away from the SyncServices folder: As if it were a swarm of bees, you should stay away from the SyncServices folder in Mac OS X 10.4. Removing or modifying anything in it—or in subfolders within it—may cause unexpected issues. (This folder is located in your Application Support folder, in your Library folder, in your Home folder.)
    Deleting or modifying things in the SyncServices folder may cause unexpected results such as:
    • Duplicate contacts in Address Book or appointments in iCal.
    • Data loss in Address Book or iCal.
    Important: Any lost or duplicate data could propagate to other devices and computers via iSync and .Mac sync. This means data could be lost on other computers.If that is your problem, I suspect that without a backup, duplicate entry deletion will at best be tedious, and at worst fraught with frustration. You may be better off starting from scratch.
    ;~)

  • Validating Duplicate Entries In itab

    Hi All
       How to approach for restricting duplicate entries in the Database?
    The scene is that I've to enter some data in a table control . and while saving, I've to check whether the same entry already exists in the database or not.
    How to approach for this? Awaiting your valuable response.
    Thanks in advance
    Pradipta

    Hai Mishra
    DELETE ADJACENT DUPLICATES FROM itab.
    Additions
    1. ... COMPARING f1 f2 ...
    2. ... COMPARING ALL FIELDS
    Effect
    Deletes neighboring, duplicate entries from the internal table itab . If there are n duplicate entries, the first entry is retained and the other n - 1 entries are deleted.
    Two lines are considered to be duplicated if their default keys match.
    The return code value is set as follows:
    SY-SUBRC = 0 At least one duplicate exists, at least one entry deleted.
    SY_SUBRC = 4 No duplicates exist, no entry deleted.
    Addition 1
    ... COMPARING f1 f2 ...
    Effect
    Two lines of the internal table itab are considered to be duplicates if the specified fields f1 , f2 , .... match.
    Addition 2
    ... COMPARING ALL FIELDS
    Effect
    Two lines are considered to be duplicates if all fields of the table entries match.
    Notes
    The DELETE ADJACENT DUPLICATES statement is especially useful if the internal table itab is sorted by fields (whether in ascending or descending order) which were compared during duplicate determination. In this case, the deletion of neighbouring duplicates is the same as the deletion of all duplicates.
    If a comparison criterion is only known at runtime, it can be specified dynamically as the content of a field name by using COMPARING ... (name) ... . If name is blank at runtime, the comparison criterion is ignored. If name contains an invalid component name, a runtime error occurs.
    Comparison criteria - statistically or dynamically specified - can be further restriced by specifying the offset and/or length.
    Note
    Performance
    Deleting a line from an internal table incurs index maintenance costs which depend on the index of the line to be deleted. The runtime depends on the line width of the table.
    For example, deleting a line in the middle of an internal table with 200 entries requires about 10 msn (standardized microseconds).
    Deleting a range of entries with " DELETE itab FROM idx1 TO idx2. " deleting a set of entries with " DELETE itab WHERE ... " only incur index maintenance costs once. Compared with a LOOP , which deletes line-by-line, this is much faster.
    To delete neighboring, duplicate entries from an internal table, use the variant " DELETE ADJACENT DUPLICATES FROM itab. " instead of LOOP constructions.
    Thanks & regards
    Sreeni

  • How to delete duplicate entries in table for the object DNL_CUST_BASIS2

    Hi All,
    I am trying to download the object DNL_CUST_BASIS2.
    In the SMQ2 the status is SYSFAIL.
    I checked in the ST22 for dumps.It says about the error while accessing the table T006.
    While analysing this,i found some duplicate entries in the related tables of this object.
    Can somebody help me how to delete these duplicate entries?
    Thanks,
    Senthil.

    Delete them directly from the table using se16:
    select the entries in the classic view (not ALV or grid view).
    activate the debugger.
    press the view button. --> you'll enter in the debugger
    press F7
    locate the sy-ucomm variable & change it to "DELE".
    press F8
    delete the entries.
    Trick-shots
    but it works!
    Michael.

  • Deleting Duplicate Entries in sender JDBC adapter

    Hi i am working on JDBC to IDOC scenario.
    When i am fetching the records from the Oracle database table using select query, i am getting the records but its getting duplicated many a times and hence its failing at an idoc processing at ECC side..
    Could someone help me in deleting the Duplicate entries and passing only the required entries from Oracle databse to IDOC.
    Here is my select query.:
    Select a.order_num, a.sap_delivery_number, a.sap_delivery_line_number, a.warehouse, a.product, a.product_size, a.order_qty, a.ship_qty from XXX_h a,tr_log t where a.Prod_id = 101..
    Appreciate your help.
    Regards

    >> Its not picking up the old data instead, it is repeating the same set of data multiple times.
    The below suggestion might be helpful
    a) First do your select statement
    b) Second , Use update statement and here set some flag in that table that these records are already queried.  say boolean read = true for the above queried records.
    That's it. When you query next time, you will not reread the same data. You will read the new data.
    Duplicate Entries:  Check with db client tool like Toad or sqlplus and see whether duplicate entries exists in the table. If so, then fix the data first.
    Edited by: Baskar Gopal on Feb 22, 2011 1:02 PM

  • How can you EASILY delete duplicate entries

    For some reason, I have duplicate entries of most everyone on my iPhone 5S - is there an easy way to delete these instead of going into each duplication and scrolling to the bottom to delete????

    I am responding to your reply to davidfrommonterey (Jul9,2011).  To quote: "If these are seen in iPhoto it would be good to figure out how they got there since it is typical that iPhoto will not import duplicates.
    LarryHN wrote:
    If these are seen in iPhoto it would be good to figure out how they got there since it is typical that iPhoto will not import duplicates
    Duplicate annihilator is a good tool for finding duplicates - http://www.brattoo.com/propaganda/
    If you are seeing them in the finder then don't - you should never go into the iPhoto library using the finder
    LN
    I have a similar problem.  My point is my photos are not importing as duplicates, they are  duplicating and moving  from one album to another, sometimes bumping the contents of said  folder to another location.  I cannot find a logical explanation.  I tried the trial version of Duplicate Annihilator, but that was a bust since it could locate only five (5) dups.  Any suggestions?          BRENDA Sfrom Charleston

  • Deleting duplicate entries based on one column

    Guys,
    I have two internal tables i_tab1 and i_tab2.
    I want to copy contents of i_tab1 into i_tab2 while removing any duplicate entry.
    i am comparing on just one column in i_tab1.

    Hi,
        Try this way
    LOOP AT itab2 INTO wa_itab2.
    READ TABLE itab1 INTO wa_itab1 WITH KEY field = wa_itab1-field BINARY SEARCH.
    IF sy-subrc = 0.
    code
    MODIFY itab2 INDEX sy-tabix FROM wa_itab2 TRANSPORTING field. " field is modified field
    ENDIF.
    ENDLOOP.
    Regards
    Bala Krishna

  • How to delete duplicate entries in iTunes on iPad 2

    I noticed a few duplicated songs in iTunes on my iPad 2 iOS 8.3 and there doesn't seem to be a way for me to delete them. I synced with iTunes on my PC desktop hoping this would fix it, but no go. Help!

    Nevermind, I just bloody discovered that if you swipe the right area (the album area) towards the left side, a delete option reveals. iTunes doesn't seem to like it much because sometimes selecting that delete button boots you out of the program!

  • Deleting Duplicate from ITAB without sorting????

    Hi,
    A challenging and interesting problem please help. I want to delete duplicates from an ITAB without sorting (so cant use delete adjacent duplicates)
    data:  begin of dpp occurs 0,
            val type i,
            end of dpp.
            dpp-val = 13.
            append dpp.
            dpp-val = 15.
            append dpp.
            dpp-val = 26.
            append dpp.
            dpp-val = 15.
            append dpp.
            dpp-val = 27
            append dpp.
            dpp-val = 15.
            append dpp.
    As you see 15 is duplicated in DPP,,,how can duplicated 15 entries be deleted without sorting
                       VAL
         13
         15
         26
         15
         27
         15
    thhnx
    Edited by: Salman Akram on Oct 12, 2010 3:54 PM

    Hi,
    Loop through your DPP itab then append to another. try this:
    DATA: BEGIN OF dpp OCCURS 0,
    val TYPE i,
    END OF dpp.
    dpp-val = 13.
    APPEND dpp.
    dpp-val = 15.
    APPEND dpp.
    dpp-val = 26.
    APPEND dpp.
    dpp-val = 15.
    APPEND dpp.
    dpp-val = 27.
    APPEND dpp.
    dpp-val = 15.
    APPEND dpp.
    DATA: BEGIN OF dpp1 OCCURS 0.
            INCLUDE STRUCTURE dpp.
    DATA: END OF dpp1.
    LOOP AT dpp.
      READ TABLE dpp1 WITH KEY val = dpp-val.
      IF sy-subrc NE 0.
        APPEND dpp TO dpp1.
      ELSE.
        CONTINUE.
      ENDIF.
    ENDLOOP.
    REFRESH dpp.
    dpp[] = dpp1[].
    thanks.

  • Counting the duplicate entries without looping itab.

    Hi ,
    I want to count the duplicate entries in  itab without looping
    the itab.
    can any one help me....

    If you just want to know the number of duplicate entries:
    DATA:
      zlt_itab1 TYPE ....
      zlt_itab2 LIKE itab1,
      zlv_lines TYPE i,
    *-Copy table
    zlt_itab2 = zlt_itab1
    *-Sort on field to count duplicates:
    SORT zlt_itab2 BY <field for counting duplicates>
    *-Total number of lines:
    zlv_lines = LINES( zlt_itab2).
    *-Remove duplicates:
    DELETE ADJACENT DUPLICATES FROM zlt_itab2.
    *-Calculate number of duplicates:
    zlv_lines = zlv_lines - LINES(zlt_itab1).
    Regards,
    John.

Maybe you are looking for

  • New Mini (HDMI) with CRT Big Screen TV (RP)

    Is anyone using the new Mini with a CRT TV. I have a Mitsubishi WS-65813 rear projection TV that I'd like to connect to the New Mini using HDMI to DVI. I had one of the older Mini's and the problem was the screen on the TV was not full screen or it w

  • Catch 22!

    I bought 3rd gen Apple TV in France. I also have an iPad and use my Apple id to access aps: but on the Apple TV it keeps responding that iTunes is not available and to try back later; later never comes. When I call tech support in US because I do not

  • Geotagging - how can I edit new places that I have previously created but with typos, errors etc?  How do I delete a place I have set up?

    Geotagging - how can I edit new places that I have previously created but with typos, errors etc?  How do I delete a place I have set up?  Then I could create a new, correct entry.  I'm using iPhoto '09.

  • Button rollover issue

    Download zipped FLA If anyone is bored, I'm having a problem with a rollover issue in the above movie that I have been creating. It is an interactive, navigable map of city parks. Rollover of the individual dots marking park locations on the map work

  • NEED HELP PLEASE / GREEN LIGHT LINE IN EDITING TIME LINE

    Hello, I am editing a video using premier 6.5. When I render the video edited the red line in the work space pass to dark green what is normal, but also appears a smal portion of the video with a light green line in the rendered area. When i play the