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.

Similar Messages

  • To eliminate the duplicate entries while looping into final internal table

    Hi friends,
    IAam facing the follwoing problem.
    Get Shipment for the Delivery number
          SELECT tknum
                 vbeln
                 INTO TABLE lt_vttp
                 FROM vttp
                 FOR ALL ENTRIES IN lt_vbfa
                 WHERE vbeln = lt_vbfa-vbelv.
        IF sy-subrc EQ 0.
          SELECT vbeln kunnr
                 FROM likp
                 INTO TABLE lt_likp
                 FOR ALL ENTRIES IN lt_vttp
                 WHERE vbeln = lt_vttp-vbeln.
      endif.
    now iam my internal table lt_vttp i have following values
       shipment             delivery
          1000                  2000
          1000                 2001
    in my internal table lt_likp i have the follwoing values
          delivery              shipto
           2000                  ABC
           2001                  ABC
    now iam looping those values in a final internal table.
      LOOP AT lt_likp INTO ls_likp.
        CHECK sy-subrc EQ 0.
         READ TABLE lt_vttp INTO ls_vttp WITH KEY vbeln = ls_likp-vbeln BINARY SEARCH.
        CHECK sy-subrc EQ 0.
             SELECT SINGLE * FROM vttk INTO ls_vttk
                    WHERE tknum = ls_vttp-tknum.
                  CHECK sy-subrc EQ 0.
                APPEND ls_vttk TO lt_vttk.
       endloop.
    Now my problem is if the shipment is same and the shipto is same then need to eliminate the duplicate records.
            in internal table iam getting 2records with same shipment and shipto combination.
           but instead if both the shipment and shipto are same then i should elimate the duplicate entries.
    and for the same shipment if i have differnt shipto then i neeed those 2 value.
    can any body tell me how can i get that.
    Regards
    Priyanka.

    Hi Priyanka,
    In your code you are using seelct statement inside the loop which will affect the performance.
    So, declare a another internal table which contains your both shipment and shipto elements with other required fields, say the name is lt_new.
    sort lt_new by shipment shipto.
    delete adjacent duplicates from lt_new comparing shipment shipto.
    "then use for all entries to choose values from VTTK.
    Hope this helps you.
    Regards,
    Manoj Kumar P

  • Abap Code to Delete the Duplicate Entries in Datasource

    hI Friends I have a code that I am writing to delete the duplicate entries from CRM Custom Datasource  but it is throwing me error that INVERNO The specified type has no structure and therefore no component called INVERNO Should i define the structure please correct my code below so that it will work to delete the duplicate entries          
    Please help
    Data: l_s_ZOXD530051 like ZOXD530051. ***Extract Structure of Data source
    Case i_DATASOURCE.
    when 'ZZ_DS_CUSTOM_CRM_VALUES'.
    Sort C_T_DATA by INVERNO ZMKT_TYP.
    *write this Statement.
    DELETE ADJACENT DUPLICATES FROM C_T_DATA COMPARING INVERNO ZMKT_TYP.
    endcase.
    Thanks
    Soniya
    null

    Hi
    It means there's no field called INVERNO:
    Data: l_s_ZOXD530051 like ZOXD530051. ***Extract Structure of Data source
    Case i_DATASOURCE.
    when 'ZZ_DS_CUSTOM_CRM_VALUES'.
    <b>*Sort C_T_DATA by INVERNO ZMKT_TYP. <------</b>
    Sort C_T_DATA by INTRENO ZINS_TYP.
    *write this Statement.
    DELETE ADJACENT DUPLICATES FROM C_T_DATA COMPARING INTRENO ZINS_TYP.
    endcase.
    Max

  • How can I get rid of the duplicate entries in icalendar?

    How can I get rid of the duplicate entries in icalendar?

    Please take a look here http://webaim.org/blog/plague-of-outline-0/
    If, after reading the above, you still want the outline removed the add the following style rule to your document.
    ul.MenuBarHorizontal a {
        outline: none;

  • Check Duplicate Entries in Dynamic itab.

    Hi,
    I have a dynamic internal table populated with some records.
    This internal table refers to different DDIC structures dynamically.
    I'm trying for a logic to check the duplicate entries that exists in this internal table and also to check whether these entries are already existing in another internal table, but i cant reach upto it.
    I tried many options but failed.
    So please help me in this logic ( just a hint or pseudocode would be enough ) to check the duplicate entries in a dynamic internal table comparing the key fields.
    I have the key fields of the internal table for each different structure.
    Regards,
    Keshav

    1. Sort table
    2. Access to Table line 1 and 2
    And now:
    clear lv_error.
    do.
      assign component sy-index of wa1 to <fs1>.
      assign component sy-index of wa2 to <fs2>.
      "exit if not successfull
      if <fs1> ne <fs2>.
        lv_error = abap-true.
        exit.
      endif.
    enddo.
    if lv_error is initial.
    ==> duplicate lines
    And then do this for line 2 and 3 and so on ....
    Regards
    André Witt

  • Duplicate entries in loop browser

    Have just bought a new iMac and running GB '08. When I moved my old loops over from my old machine via an external hard drive, I now have duplicate entries of all the loops in the browser. Any ideas on a fix?

    so next question: where do i find the factory loops that are in gb if i want to delete them?
    http://www.bulletsandbones.com/GB/GBFAQ.html#looplocation
    or is that even possible?
    as long as you reindex the browser to get rid of the links to them.
    if i now want to bring in some of my own loops from the other computer, do i need to trash the indexes again and drag the new loops in
    as long as they're not dupes, no.
    or can i just drag them in now?
    yes

  • To count the repeated entries in a XML document.

    HOW TO COUNT THE REPEATED  NUMBER OF ENTRIES IN A XML DOCUMENT USING THE SAP REPORT PROGRAM?
      <?xml version="1.0" encoding="utf-16" ?>
    - <ROOT>
    - <SYSTEMDETAILS>
    - <item>
      <SYSDETAILSNAME>CODE</SYSDETAILSNAME>
      <SYSDETAILS>00</SYSDETAILS>
      </item>
    - <item>
      <SYSDETAILSNAME>LICENSE</SYSDETAILSNAME>
      <SYSDETAILS>INITIAL</SYSDETAILS>
      </item>
    - <item>
      <SYSDETAILSNAME>BASIS RELEASE</SYSDETAILSNAME>
      <SYSDETAILS>700</SYSDETAILS>
      </item>
    - <item>
      <SYSDETAILSNAME>SYSTEM NAME</SYSDETAILSNAME>
      <SYSDETAILS>IS3</SYSDETAILS>
      </item>
    - <item>
      <SYSDETAILSNAME>CLIENT</SYSDETAILSNAME>
      <SYSDETAILS>800</SYSDETAILS>
      </item>
    - <item>
      <SYSDETAILSNAME>LOCLANG</SYSDETAILSNAME>
      <SYSDETAILS>English</SYSDETAILS>
      </item>
      </SYSTEMDETAILS>
    - <ACH>
    - <item>
      <NAME>HLA0009999</NAME>
      <TLEVEL>01</TLEVEL>
      <TEXT>SAP</TEXT>
      <TEXT4>Application Components</TEXT4>
      <TEXTLOC>Application Components</TEXTLOC>
      </item>
    <item>
      <NAME>ABA0000311</NAME>
      <TLEVEL>02</TLEVEL>
      <TEXT>AP</TEXT>
      <TEXT4>Application Platform</TEXT4>
      <TEXTLOC>Application Platform</TEXTLOC>
      </item>
    - <item>
      <NAME>KPE0000001</NAME>
      <TLEVEL>03</TLEVEL>
      <TEXT>AP-PPE</TEXT>
      <TEXT4>Integrated Product and Process Engineering</TEXT4>
      <TEXTLOC>Integrated Product and Process Engineering</TEXTLOC>
      </item>
    SAY THE  BOLD PART SHOWS 1 USER ,SO HOW MANY TIMES THE SAME USER APPEARS IN THE DOCUMENT.
    HOW CAN I FIND THAT?

    If the same content of file already thr in the Internal table as 1 STRING/LINE then you can loop the internal table count the entries which one you want like
    Kanagaraja L

  • How to find the duplicate entries in column

    clolum name descripitoin ex:
    CLIENT_NAME | Last Name | First Name | Middle Name |suffix | Tendulkar Sachin Ramesh Jr.Sachin
    | | Sachin Tendulkar Ramesh Jr.Sachin
    | | Ramesh Sachin Tendulkar Jr.Sachin
    PANno | no | AUBIU1966E
    Address | Address of clint | Any address
    Insert multiple records as per the e.g. shown in table. Write a oracle procedure in database schema to input the string and identify the possible duplicates from above table.

    942919 wrote:
    HI
    but clint name is like
    CLINT_NAME
    Sachin Tendulkar Ramesh
    Sachin Ramesh Tendulkar
    Tendulkar Sachin Ramesh
    in this senario clint name column show diffrent names
    your query is not working
    above three entries are same we need to find aboue three entries are duplicate1. Have one other column called Name2 in the table
    2. scan the table and run the "combined" (means you combined every row from below separated by a space) the below output into name2 column
    with t as (
         select 'Sachin Tendulkar Ramesh' col from dual
         select TRIM(substr (splitted,
              instr (splitted, ' ', 1, level ) + 1,
              instr (splitted, ' ', 1, level+1) - instr (splitted, ' ', 1, level) -1 )) as ret_row
         from (select ' '||col||' ' splitted
         from t)
         connect by level <= length(splitted)-length(replace(splitted,' ',''))+1
         and instr (splitted, ' ', 1, level+1) - instr (splitted, ' ', 1, level) -1 > 0 order by 1;
    3. now run this
    select name2,count(*)
    the same like above but group by name2, then you will see it

  • Identfying the Duplicate Entries

    Hi All,
    As per my requirement
    1.  The internal table is the input.
    2.  I need the duplicate records of the internal table with the combination of 2 key fields.
    3. I should not use SORT because i need the  index number in order as per in the table .
    EX :           Take Table MSEG.
                      Take key fields as MBLNR and WERKS.
                      I want the duplicate records of the combination of these 2 key fields.
                      The *Index Number * should not to be changed as per the table entry.  ( So i avoided sorting the internal table)
    Kindly give some solutions.
    Thanks,
    Pradeep.
    Moderator message : Requirements dumping not allowed, show the work you have already done.  Thread locked.
    Edited by: Vinod Kumar on Mar 1, 2012 4:19 PM

    Use DELETE ADJACENT DUPLICATES COMPARING MBLNR AND WERKS
    For this we need a sorted table on MBLNR and WERKS...
    Why not sort the table on MBLNR and WERKS, do the DELETE and sort the table back to the index field?
    Kr,
    Manu.
    Edited by: Manu D'Haeyer on Mar 1, 2012 11:49 AM

  • To count the number of while loops, do you just have to attach a DBL indicator to the little i box in the while loop of the program?

    I have just followed an example in a book to count while loops and was just want to make sure I havent missed something simple. My program is attached
    Solved!
    Go to Solution.
    Attachments:
    second attempt.vi ‏45 KB

    Hi Ssteel,
    Just some additional observations/tips on your code...
    1. I notice that you have a standard stop button going into a "run if true" stop condition of the while loop. In this cercumstance it is common to have the stop condition set as "stop if true". You can change this by right clicking the stop terminal and enabling the "stop if true" property. Obviously, it somewhat depends on your design preferences.
    2. If you have any issues with the application, perhaps you notice that it is taking over your processor resources, you should add some execution timing into the while loop. You will find the timing functions in the block diagrams functions palette (programming > timing). The Wait (or "wait until next ms") functions will provide your application with "down time", which means that the processor can execute other tasks.
    3. To elaborate what MikeS81 correctly stated, insert an incriment before the numeric indicator as shown below to get the actual number of cycles (i.e. the count terminal of the "while" and "for" loops are 0 indexed). Also note that I have changed the representation of the count to interger (blue). You do not need floating point precion when displaying the inciment count, at a while loop can only execute a "whole number" of times.
    I hope this has been useful to you Ssteel.
    Thanks for your post,
    Rich R
    Applications Engineer
    National Instruments UK & Ireland

  • How do I get rid of the duplicate songs without getting rid of the mp3 version of the song?

    I have a library of CDs in several years back I downloaded them into my hard drive on another computer into Windows media player. For whatever reason Windows media player continued to duplicate songs and there's a great deal of space being taken up on my hard drive by songs that I want to identify as duplicated and remove while at the same time keeping at least one copy in MP3 format. Any help will be greatly appreciated.

    First see this thread on getting Windows Media Player to play nicely with iTunes.
    Next use iTunes Folder Watch to add in any disconnected media files that are still in your media folders.
    Now use my script DeDuper to remove all but one copy of each duplicated file.
    tt2

  • How to validate the table entries without zprogam

    Hi Guru's
        I'm having a table in that table have 4 fields ie pernr, name, date and time.
         if entered the pernr nand name the remaining 2 fields is automatically populated in SM30.
         i added one include in the function group.
    Thanks & Regards,
    Vallamuthu.M

    tried searching in SDN its a nice forum to search things... look what i found though searching..
    [table maintenance events|http://help.sap.com/saphelp_470/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/frameset.htm]
    [wiki one|http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=93454609]
    [wiki2|http://wiki.sdn.sap.com/wiki/display/ABAP/ExtendedTableMaintenance+Events]

  • Duplicate Entries in Library

    In the process of trying to move my itunes library to an external drive, I've ended up with duplicate entries for each file. Both entries play the same file, but when one entry is deleted from the library, the file gets deleted, and the remaining entry does not play. How do I remove one of the duplicate entries without deleting the file?

    It seems there's only one library - on the external drive. Before I moved my library, I looked in itunes help to figure out how to do it properly, and never really got a clear answer, so I just copied and pasted my files onto the external drive, then deleted the original library off the internal drive, and things went from bad to worse from there. Everytime I consolidate the library, it just seems to duplicate everything, not really solving the problem. It's not a question of duplicate files - it's more a question of duplicate listings/entries for the same single file so that if I delete the wrong entry/listing from the library, the remaining listing can't find the file to play, because I've just unwittingly deleted the music file.

  • Duplicate entries in table & email count

    hi,,
    In my selection screen i have 3 fields-
    billing doc--vbeln
    customer no--kunnr
    email id -
    when i give inputs in this selection screen fields and execute it mail is sent and
    the inputs given for the fields are stored in a ZTABLE.
    my requirement is if user is entering 90073336,66789 and daniel
    once it gets stored in the ztable. if once again i am giving the
    same input, it doesnot get stored in my ztable.
    can i get duplicate entries in my ztable. if yes how?
    and if my receiver mail id is daniel
    no of times email count should be one.if again daniel then two.
    if harry.the one.
    thnx..

    Hi,
    please help me in that counter loop code..how to do this!!
    and how to code for duplicate entries.
    DATA:  ITAB21 TYPE hashed TABLE OF zmailhist WITH UNIQUE key mandt vbeln kunnr,
           WA LIKE LINE OF ITAB21.
    WA-VBELN = P_VBELN.
          INSERT WA INTO TABLE ITAB21.
          WA-KUNNR = P_KUNNR.
          INSERT WA INTO TABLE ITAB21.
          TRANSLATE V_ID TO LOWER CASE.
          CONCATENATE V_ID '@cadence.com'  INTO CHAR1.
          WA-UNAME = CHAR1.
          INSERT WA INTO TABLE ITAB21.
          WA-VSURA = SY-UZEIT.
          INSERT WA INTO TABLE ITAB21.
          WA-ERDAT = SY-DATUM.
          INSERT WA INTO TABLE ITAB21.
              IF SY-SUBRC = 0.
                 V_VSTAT = '0'.
              ELSE.
                 V_VSTAT = '1'.
              ENDIF.
          WA-VSTAT = V_VSTAT.
          INSERT WA INTO TABLE ITAB21.
          WA-NAME1 = I_TAB1-EMAIL.
          INSERT WA INTO TABLE ITAB21.
    INSERT zmailhist FROM TABLE ITAB21 ACCEPTING DUPLICATE KEYS.
    its not picking the duplicate entries..pls help

  • Every time I sync my iCal computer with my iPhone 4 or iPad, duplicate entries are generated on both systems. What am I doing wrong or how can I avoid the duplications?

    Every time I sync my iCal on my computer through iTunes with my iPhone 4 or iPad, duplicate entries are generated on both systems. What am I doing wrong or how can I avoid the duplications? I have been doing this for several years and this problem is a more recent issue, like in the last 6 months. I have been deleting the duplicate entries, on both systems, but some duplicates reappear through "general" entries that are connected to the correct color for a Calendar, but not the name. I am going nuts and wasting tons of hours trying to get the 3 calendars to sync without generating duplicate entries.

    Choose one of the Calenders on ONE of the computers OR the MobileMe as the Master / correct account.
    The REINITAILISE the data of MobileMe within preferences on the computer defining the datatransfer correctly (in the advanced box of preferences). The synchronise iphone contacts and calender directly on-line to MobileMe.
    I posted a question on this today, and gave my own reply !
    Regards,
    Kevin

Maybe you are looking for

  • Just switched over to Firefox; not enabling me to send out in messages since switching over..

    While in Internet Explorer; my yahoo internet account was compromised and I wasn't able to open any emails. I decided to give up on Internet Explorer and moved over to Mozilla Firefox for the added protection it offered. Now that I moved I am not abl

  • Maxtor One Touch II Won't Mount

    I'm running 10.6.8 and my maxtor one touch II won't mount all of a sudden? I've tried fire wire 400 and fire 400to800, restarting etc. The drive won't show up? The driver update on the Maxtor/Seagate site opens up as code in a text edit file, it does

  • How to solve this race condition

    Hi there, the following code was taken from an official Java Tutorial at http://java.sun.com/docs/books/tutorial/essential/threads/synchronization.html but it's bugy 'cause it's creating race conditions I cannot handle. // this is the consumer // it

  • Photoshop CS4 CPU Question...

    Hello, I hope everyone had happy and safe holidays. Welcome to 2009. I have a friend with a Pentium 4 system and she wants to run Photoshop CS4 Extended on it. Right now it only has 1GB of ram and while she plans to buy a new system later this year,

  • Photoshop Elements 10 APPCRASH

    Every time I load my Photoshop Elements 10 it comes up with and error message: Product name:                     APPCRASH App Name:                           PhotoshopElementsOranizer.exe Version:                               10.0.0.0 Time Stamp: