Remove duplicate entry from table

Hello all,
In my one table
File Stage log (File_Stage_Log_ID int identity(1,1),File ID int ,Quarter_Date nvarchar(50),StageID int )
have done duplicate entry by mistake on similar quarter_date 
something like ..
FILE_ID
Quarter
FILE_STAGE_LOG_ID
STAGE_ID
22401
Dec-13
233091
450
22401
Dec-13
244116
420
22401
Mar-14
233095
450
22401
Mar-14
237478
405
22401
Jun-14
237479
405
22401
Jun-14
233099
450
22401
Sep-14
233102
450
22401
Sep-14
237480
405
22401
Dec-14
237481
405
22401
Dec-14
227275
420
there are too many files which have the same duplicacy ..
now , above you can see that dec -13 quarter coming twice for a single file 
tell me the way to delete one entry from the table for a files 
so that i have output at the end like ...
FILE_ID
Quarter
FILE_STAGE_LOG_ID
STAGE_ID
22401
Dec-13
233091
450
22401
Mar-14
233095
450
22401
Jun-14
237479
405
22401
Sep-14
233102
450
22401
Dec-14
237481
405
Please help me with easiest possible way ..
Dilip Patil..

How do you determine which one out of duplicate to be kept? As per output it doesnt follow any pattern
so it may be this
--DELETE t
SELECT *
FROM
SELECT ROW_NUMBER() OVER (PARTITION BY FILE_ID,Quarter_Date ORDER BY FILE_ID) AS Rn,*
FROM FileStageLog
)t
WHERE Rn >1
Run the select above to see records to be removed and once happy uncomment the delete, comment the select * and run the query to do the delete
If it doesnt give expected records, explain on what basis you want to identify records to be deleted
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Trick to remove duplicate entries from tables ?

    hi.
    i have 53tables which are having duplicate entries and names of all 53 tables r listed in top_t table ?
    can any1 provide me solution to show and if possible ask for remove of those duplicates entries from each table if required ?
    daily i am removing duplicates manually ....its too tedious now !
    can any1 help me out ?

    Well, I suppose if the duplication is such that
    SELECT DISTINCT * FROM tablename;gives you the required result, then you could have a procedure that made a copy of the table, deleted/truncated the original, then inserted the distinct values back into it.
    In 10g you could even use flashback to avoid the temp copy - but it also means you can't use TRUNCATE so whether it's any more efficient I'm not sure. But just for fun and since it's urgent:
    CREATE OR REPLACE PROCEDURE dedupe_table
        ( p_table_name user_tables.table_name%TYPE )
    IS
        k_start_timestamp TIMESTAMP := SYSTIMESTAMP;
    BEGIN
        SAVEPOINT start_of_dedupe;
        BEGIN
            EXECUTE IMMEDIATE 'DELETE ' || p_table_name;
        EXCEPTION
            WHEN OTHERS THEN
                ROLLBACK TO start_of_dedupe;
                RAISE_APPLICATION_ERROR
                ( -20000
                , 'Error deleting ' || UPPER(p_table_name) ||
                   CHR(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE
                , TRUE );
        END;
        BEGIN
            EXECUTE IMMEDIATE
            'INSERT INTO ' || p_table_name ||
            ' SELECT DISTINCT * FROM ' || p_table_name || ' AS OF TIMESTAMP :b1'
            USING k_start_timestamp;
        EXCEPTION
            WHEN OTHERS THEN
                ROLLBACK TO start_of_dedupe;
                RAISE_APPLICATION_ERROR
                ( -20000
                , 'Error repopulating ' || UPPER(p_table_name) ||
                   CHR(10) || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE
                , TRUE );
        END;
    END dedupe_table;
    SQL> select * from wr_test;
          COL1 C C
             1 A B
             1 A B
             2 C D
             2 C D
    4 rows selected.
    SQL> BEGIN
      2      dedupe_table('WR_TEST');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> select * from wr_test;
          COL1 C C
             1 A B
             2 C D
    2 rows selected.I make no claims for robustness, efficiency or human safety.
    Edited by: William Robertson on Sep 24, 2009 7:12 PM

  • Remove duplicate entries from dropdownlist in web dynpro abap

    How to remove duplicate entries from dropdownlist in web dynpro abap? Can someone please help me
    I have maintained the data in the z table wherein the records of particular fields are repeated but when i show that record in the Web Dynpro application dropdown list, the user should only be able to view the unique data for selection of that particular field.

    Hi,
    try this code in init method.
    use the
    Delete adjacent duplicates.
    <set the table>
    select <f1>  from <table> into TABLE <Itab> whre <condition>.
       DELETE ADJACENT DUPLICATES FROM <Itab> COMPARING <f1>.
         lo_nd_vbap->bind_table( new_items = <itab> set_initial_elements = abap_true ).

  • TS4062 how do i remove duplicate entries from my phone directory?

    question; how do i remove duplicate entries from my phone directory?

    go to your contacts icon and choose the one you want to delate
    Choose edit, top right and go (scroll) to the bottom of the page and press delete contact

  • How to remove duplicate entries from Settings General iTunes Wi-Fi Sync?

    On my iPhone under Settings > General > iTunes Wi-Fi Sync there is a duplicate entry for my Mac. One is active, the other one shows options greyed out, as if it can't see the Mac on the network (although it's the same name). Is there a way to manually remove that entry from the iPhone?
    I am running iOS 7.0.4, and OS X 10.9.1, iTunes 11.1.3 on the Mac.

    iPhone 3G doesn't support Wi-Fi sync or IOS 5.1.1. You have to connect to iTunes using the dock connector to sync.
    Unless you have a iPhone 3GS or jailbroken.

  • First attempt to remove duplicate rows from a table...

    I have seen many people asking for a way to remove duplicate rows from data. I made up a fairly simple script. It adds a column to the table with the cell selected in it, and adds the concatenation of the data to the left into that new column. then it reads that into a list, and walks through that list to find any that are listed twice. Any that are it marks for DELETE.
    It then walks through to find each one marked for delete and removes them (you must go from bottom to top to do this, otherwise your row markings for delete don't match up to the original rows anymore). Last is to delete the column we added.
    tell application "Numbers"
    activate
    tell document 1
    -- DETERMINE THE CURRENT SHEET
    set currentsheetindex to 0
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of (tables whose selection range is not missing value)
    end tell
    if x is not 0 then
    set the currentsheetindex to i
    exit repeat
    end if
    end repeat
    if the currentsheetindex is 0 then error "No sheet has a selected table."
    -- GET THE TABLE WITH CELLS
    tell sheet currentsheetindex
    set the current_table to the first table whose selection range is not missing value
    end tell
    end tell
    log current_table
    tell current_table
    set list1 to {}
    add column after column (count of columns)
    set z to (count of columns)
    repeat with j from 1 to (count of rows)
    set m to ""
    repeat with i from 1 to (z - 1)
    set m to m & value of (cell i of row j)
    end repeat
    set value of cell z of row j to m
    end repeat
    set MyRange to value of every cell of column z
    repeat with i from 1 to (count of items of MyRange)
    set n to item i of MyRange
    if n is in list1 then
    set end of list1 to "Delete"
    else
    set end of list1 to n
    end if
    end repeat
    repeat with i from (count of items of list1) to 1 by -1
    set n to item i of list1
    if n = "Delete" then remove row i
    end repeat
    remove column z
    end tell
    end tell
    Let me know how it works for y'all, it worked good on my machine, but I know localization is causing errors sometimes when I post things.
    Thanks,
    Jason
    Message was edited by: jaxjason

    Hi jason
    I hope that with the added comments it will be clear.
    Ask if something is always opaque.
    set {current_Range, current_table, current_Sheet, current_Doc} to my getSelection()
    tell application "Numbers09"
    tell document current_Doc to tell sheet current_Sheet to tell table current_table
    set list1 to {}
    add column after column (count of columns)
    set z to (count of columns)
    repeat with j from 1 to (count of rows)
    set m to ""
    tell row j
    repeat with i from 1 to (z - 1)
    set m to m & value of cell i
    end repeat
    set value of cell z to m
    end tell
    end repeat
    set theRange to value of every cell of column z
    repeat with i from (count of items of theRange) to 1 by -1
    (* As I scan the table backwards (starting from the bottom row),
    I may remove a row immediately when I discover that it is a duplicate *)
    set n to item i of theRange
    if n is in list1 then
    remove row i
    else
    set end of list1 to n
    end if
    end repeat
    remove column z
    end tell
    end tell
    --=====
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
    tell application "Numbers09" to tell document 1
    set theSheet to ""
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    (* Open a trap to catch the selection range.
    The structure of this item
    «class
    can't be coerced as text.
    So, when the instruction (selection range of table y) as text
    receive 'missing value' it behaves correctly and the lup continue.
    But, when it receive THE true selection range, it generates an error
    whose message is errMsg and number is errNum.
    We grab them just after the on error instruction *)
    try
    (selection range of table y) as text
    on error errMsg number errNum (*
    As we reached THE selection range, we are here.
    We grab the errMsg here. In French it looks like:
    "Impossible de transformer «class
    The handler cuts it in pieces using quots as delimiters.
    item 1 (_) "Impossible de transformer «class » "
    item 2 (theRange) "A2:M25"
    item 3 (_) " of «class NmTb» "
    item 4 (theTable) "Tableau 1"
    item 5 (_) " of «class NmSh» "
    item 6 (theSheet) "Feuille 1"
    item 7 (_) " of document "
    item 8 (theDoc) "Sans titre"
    item 9 ( I drop it ) " of application "
    item 10 ( I drop it ) "Numbers"
    item 11 (I drop it ) " en type string."
    I grab these items in the list
    {_, theRange, _, theTable, _, theSheet, _, theDoc}
    Yes, underscore is a valid name of variable.
    I often uses it when I want to drop something.
    An alternate way would be to code:
    set ll to my decoupe(errMsg, quote)
    set theRange to item 2 of ll
    set theTable to item 4 of ll
    set theSheet to item 8 of ll
    set theDoc to item 10 of ll
    it works exactly the same but it's not so elegant.
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
    exit repeat (*
    as we grabbed the interesting datas, we exit the lup indexed by y.*)
    end try
    end repeat -- y
    if theSheet > "" then exit repeat (*
    If we are here after grabbing the datas, theSheet is not "" so we exit the lup indexed by i *)
    end if
    end tell -- sheet
    end repeat -- i
    (* We may arrive here with two kinds of results.
    if we grabbed a selection, theSheet is something like "Feuille 1"
    if we didn't grabbed a selection, theSheet is the "" defined on entry
    and we generate an error which is not trapped so it stops the program *)
    if theSheet = "" then error "No sheet has a selected table."
    end tell -- document
    (* Now, we send to the caller the interesting datas :
    theRange "A2:M25"
    theTable "Tableau 1"
    theSheet "Feuille 1"
    theDoc "Sans titre" *)
    return {theRange, theTable, theSheet, theDoc}
    end getSelection
    --=====
    on decoupe(t, d)
    local l
    set AppleScript's text item delimiters to d (*
    Cut the text t in pieces using d as delimiter *)
    set l to text items of t
    set AppleScript's text item delimiters to "" (*
    Resets the delimiters to the standard value. *)
    (* Send the list to the caller *)
    return l
    end decoupe
    --=====
    Have fun
    And if it's not clear enough, you may ask for more explanations.
    Yvan KOENIG (from FRANCE mardi 27 janvier 2009 21:49:19)

  • How to remove duplicates records from output ?

    how to remove duplicates records from output ?  i used delete adjacent but duplicates records are coming again ..suggest me

    hi shruthi,
    thanks for ur answer ..but duplicates records coming again
    here is my code >> plz check it out
    *& Report  ZCRM_TROUBLE_TICKET
    REPORT  zcrm_trouble_ticket.
    TYPES : BEGIN OF ty_qmih,
            qmnum TYPE qmnum,
            equnr TYPE equnr,
            iloan TYPE iloan,
            ausvn TYPE ausvn,
            ausbs TYPE ausbs,
            auztv TYPE auztv,
            auztb TYPE auztb,
            iwerk TYPE iwerk,
            END OF ty_qmih,
            BEGIN OF ty_qmel,
            qmnum TYPE qmnum,
            qmtxt TYPE qmtxt,
            indtx TYPE indltx,
            priok TYPE priok,
            strmn TYPE strmn,
            strur TYPE strur,
            ltrmn TYPE ltrmn,
            ltrur TYPE ltrur,
            objnr TYPE qmobjnr,
            arbpl TYPE lgwid,
            vkorg TYPE vkorg,
            vtweg TYPE vtweg,
            spart TYPE spart,
            END OF ty_qmel,
            BEGIN OF ty_ihpa,
            parnr TYPE i_parnr,
            parvw TYPE parvw,
            objnr TYPE qmobjnr,
            END OF ty_ihpa,
            BEGIN OF ty_crhd,
            arbpl TYPE arbpl,
            objid TYPE cr_objid,
            END OF ty_crhd,
            BEGIN OF ty_crtx,
            ktext TYPE cr_ktext,
            objid TYPE cr_objid,
            END OF ty_crtx,
            BEGIN OF ty_qmfe,
            fecod TYPE fecod,
            fegrp TYPE fegrp,
            qmnum TYPE qmnum,
            END OF ty_qmfe,
            BEGIN OF ty_qmur,
            urcod TYPE urcod,
            urgrp TYPE urgrp,
            urtxt TYPE urstx,
            qmnum TYPE qmnum,
            END OF ty_qmur,
            BEGIN OF ty_iloa,
            tplnr TYPE tplnr,
            iloan TYPE iloan,
            END OF ty_iloa,
            BEGIN OF ty_output,
            qmnum TYPE qmnum,
            equnr TYPE equnr,
           iloan TYPE iloan,
            ausvn TYPE ausvn,
            ausbs TYPE ausbs,
            auztv TYPE auztv,
            auztb TYPE auztb,
            iwerk TYPE iwerk,
            qmtxt TYPE qmtxt,
            indtx TYPE indltx,
            priok TYPE priok,
            strmn TYPE strmn,
            strur TYPE strur,
            ltrmn TYPE ltrmn,
            ltrur TYPE ltrur,
           objnr TYPE qmobjnr,
           arbpl TYPE lgwid,
            vkorg TYPE vkorg,
            vtweg TYPE vtweg,
            spart TYPE spart,
            parnr TYPE i_parnr,
            parvw TYPE parvw,
            arbpl TYPE arbpl,
           objid TYPE cr_objid,
           arbpl1 TYPE arbpl,
            ktext TYPE cr_ktext,
            fecod TYPE fecod,
            fegrp TYPE fegrp,
            urcod TYPE urcod,
            urgrp TYPE urgrp,
            urtxt TYPE urstx,
            tplnr TYPE tplnr,
            END OF ty_output.
    DATA : it_qmih TYPE STANDARD TABLE OF ty_qmih,
           it_qmel TYPE STANDARD TABLE OF ty_qmel,
           it_ihpa TYPE STANDARD TABLE OF ty_ihpa,
           it_crhd TYPE STANDARD TABLE OF ty_crhd,
           it_crtx TYPE STANDARD TABLE OF ty_crtx,
           it_qmfe TYPE STANDARD TABLE OF ty_qmfe,
           it_qmur TYPE STANDARD TABLE OF ty_qmur,
           it_iloa TYPE STANDARD TABLE OF ty_iloa,
           it_output TYPE STANDARD TABLE OF ty_output,
           wa_qmih TYPE ty_qmih,
           wa_qmel TYPE ty_qmel,
           wa_ihpa TYPE ty_ihpa,
           wa_crhd TYPE ty_crhd,
           wa_crtx TYPE ty_crtx,
           wa_qmfe TYPE ty_qmfe,
           wa_qmur TYPE ty_qmur,
           wa_iloa TYPE ty_iloa,
           wa_output TYPE ty_output.
    INITIALIZATION.
      REFRESH : it_qmih,
                it_qmel,
                it_ihpa,
                it_crhd,
                it_crtx,
                it_qmfe,
                it_qmur,
                it_iloa,
                it_output.
      CLEAR:     wa_qmih,
                 wa_qmel,
                 wa_ihpa,
                 wa_crhd,
                 wa_crtx,
                 wa_qmfe,
                 wa_qmur,
                 wa_iloa,
                 wa_output.
    start-of-selection.
      SELECT  qmnum
              equnr
              iloan
              ausvn
              ausbs
              auztv
              auztb
              iwerk
              FROM qmih
              INTO  TABLE it_qmih.
      SORT it_qmih BY qmnum .
      DELETE ADJACENT DUPLICATES FROM it_qmih COMPARING qmnum equnr iloan ausvn ausbs auztv auztb iwerk.
      SELECT   qmnum
               qmtxt
               indtx
               priok
               strmn
               strur
               ltrmn
               ltrur
               objnr
               arbpl
               vkorg
               vtweg
               spart
               FROM qmel
               INTO TABLE it_qmel
               FOR ALL ENTRIES IN it_qmih
               WHERE qmnum = it_qmih-qmnum.
      SORT it_qmel BY qmnum.
      DELETE ADJACENT DUPLICATES FROM it_qmel COMPARING  qmnum
                                                         qmtxt
                                                         indtx
                                                         strmn
                                                         strur
                                                         ltrmn
                                                         ltrur
                                                         objnr
                                                         arbpl
                                                         vkorg
                                                         vtweg
                                                         spart.
      IF it_qmel IS NOT INITIAL.
        SELECT parnr
               parvw
               objnr
               FROM ihpa
               INTO TABLE it_ihpa
               FOR ALL ENTRIES IN it_qmel
               WHERE objnr = it_qmel-objnr.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM it_ihpa COMPARING  parnr
                                                         parvw
                                                         objnr.
      IF it_qmel IS NOT INITIAL.
        SELECT arbpl
               objid
               FROM crhd
               INTO TABLE it_crhd
               FOR ALL ENTRIES IN it_qmel
               WHERE objid = it_qmel-arbpl.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM it_crhd COMPARING  arbpl
                                                         objid.
      IF it_qmel IS NOT INITIAL.
        SELECT ktext
               objid
               FROM crtx
               INTO TABLE it_crtx
               FOR ALL ENTRIES IN it_crhd
               WHERE objid = it_crhd-objid.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM it_crtx COMPARING ktext
                                                        objid.
      IF it_qmih IS NOT INITIAL.
        SELECT fecod
               fegrp
               qmnum
               FROM qmfe
               INTO TABLE it_qmfe
               FOR ALL ENTRIES IN it_qmih
               WHERE qmnum = it_qmih-qmnum.
      ENDIF.
      SORT it_qmfe BY qmnum.
      DELETE ADJACENT DUPLICATES FROM it_qmfe COMPARING fecod
               fegrp.
      IF it_qmih IS NOT INITIAL.
        SELECT urcod
               urgrp
               urtxt
               qmnum
               FROM qmur
               INTO TABLE it_qmur
               FOR ALL ENTRIES IN it_qmih
               WHERE qmnum = it_qmih-qmnum.
      ENDIF.
      SORT it_qmur BY qmnum.
      DELETE ADJACENT DUPLICATES FROM  it_qmur COMPARING urcod
                                                         urgrp
                                                         urtxt.
      IF it_qmih IS NOT INITIAL.
        SELECT  tplnr
                iloan
                FROM iloa
                INTO TABLE it_iloa
                FOR ALL ENTRIES IN it_qmih
                WHERE iloan = it_qmih-iloan.
      ENDIF.
      DELETE ADJACENT DUPLICATES FROM it_iloa COMPARING tplnr
                                                        iloan.
      LOOP AT it_qmih INTO wa_qmih.
        wa_output-qmnum = wa_qmih-qmnum.
        wa_output-equnr = wa_qmih-equnr.
       wa_output-iloan = wa_qmih-iloan.
        wa_output-ausvn = wa_qmih-ausvn.
        wa_output-ausbs = wa_qmih-ausbs.
        wa_output-auztv = wa_qmih-auztv.
        wa_output-auztb = wa_qmih-auztb.
        wa_output-iwerk = wa_qmih-iwerk.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
        READ TABLE it_qmel INTO wa_qmel WITH KEY qmnum = wa_qmih-qmnum.
        wa_output-qmtxt = wa_qmel-qmtxt.
        wa_output-indtx = wa_qmel-indtx.
        wa_output-priok = wa_qmel-priok.
        wa_output-strmn = wa_qmel-strmn.
        wa_output-strur = wa_qmel-strur.
        wa_output-ltrmn = wa_qmel-ltrmn.
        wa_output-ltrur = wa_qmel-ltrur.
       wa_output-objnr = wa_qmel-objnr.
       wa_output-arbpl = wa_qmel-arbpl.
        wa_output-vkorg = wa_qmel-vkorg.
        wa_output-vtweg = wa_qmel-vtweg.
        wa_output-spart = wa_qmel-spart.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
        READ TABLE it_ihpa INTO wa_ihpa WITH KEY objnr = wa_qmel-objnr.
        wa_output-parnr = wa_ihpa-parnr.
        wa_output-parvw = wa_ihpa-parvw.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
        READ TABLE it_crhd INTO wa_crhd WITH KEY objid = wa_qmel-arbpl.
        wa_output-arbpl = wa_crhd-arbpl.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
        READ TABLE it_crtx INTO wa_crtx WITH KEY objid = wa_crhd-objid.
        wa_output-ktext = wa_crtx-ktext.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
        READ TABLE it_qmfe INTO wa_qmfe WITH KEY qmnum = wa_qmih-qmnum.
        wa_output-fecod = wa_qmfe-fecod.
        wa_output-fegrp = wa_qmfe-fegrp.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
        READ TABLE it_qmur INTO wa_qmur WITH KEY qmnum = wa_qmih-qmnum.
        wa_output-urcod = wa_qmur-urcod.
        wa_output-urgrp = wa_qmur-urgrp.
        wa_output-urtxt = wa_qmur-urtxt.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
        READ TABLE it_iloa INTO wa_iloa WITH KEY iloan = wa_qmih-iloan.
        wa_output-tplnr = wa_iloa-tplnr.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
      ENDLOOP.
      DELETE ADJACENT DUPLICATES FROM it_output  COMPARING        qmnum
                                                                  equnr
                                                                  ausvn
                                                                  ausbs
                                                                  auztv
                                                                  auztb
                                                                  iwerk
                                                                  qmtxt
                                                                  indtx
                                                                  priok
                                                                  strmn
                                                                  strur
                                                                  ltrmn
                                                                  ltrur
                                                                  vkorg
                                                                  vtweg
                                                                  spart
                                                                  parnr
                                                                  parvw
                                                                  arbpl
                                                                  ktext
                                                                  fecod
                                                                  fegrp
                                                                  urcod
                                                                  urgrp
                                                                  urtxt
                                                                  tplnr.
    *CALL FUNCTION 'STATUS_TEXT_EDIT'
    EXPORTING
      CLIENT                  = SY-MANDT
      FLG_USER_STAT           = ' '
       objnr                   =
      ONLY_ACTIVE             = 'X'
       spras                   = en
      BYPASS_BUFFER           = ' '
    IMPORTING
      ANW_STAT_EXISTING       =
      E_STSMA                 =
      LINE                    =
      USER_LINE               =
      STONR                   =
    EXCEPTIONS
      OBJECT_NOT_FOUND        = 1
      OTHERS                  = 2
    *IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    *CALL FUNCTION 'READ_TEXT'
    EXPORTING
      CLIENT                        = SY-MANDT
       id                            =
       language                      =
       name                          =
       object                        =
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
    tables
       lines                         =
    EXCEPTIONS
      ID                            = 1
      LANGUAGE                      = 2
      NAME                          = 3
      NOT_FOUND                     = 4
      OBJECT                        = 5
      REFERENCE_CHECK               = 6
      WRONG_ACCESS_TO_ARCHIVE       = 7
      OTHERS                        = 8
    *IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    *LOOP AT IT_OUTPUT INTO WA_OUTPUT.
    *WRITE : / WA_OUTPUT-qmnum,
             WA_OUTPUT-equnr,
             WA_OUTPUT-iloan,
             WA_OUTPUT-ausvn,
             WA_OUTPUT-ausbs,
             WA_OUTPUT-auztv,
             WA_OUTPUT-auztb,
             WA_OUTPUT-qmtxt,
             WA_OUTPUT-indtx,
             WA_OUTPUT-strmn,
             WA_OUTPUT-strur,
             WA_OUTPUT-ltrmn,
             WA_OUTPUT-ltrur,
             WA_OUTPUT-objnr,
             WA_OUTPUT-arbpl,
             WA_OUTPUT-parnr,
             WA_OUTPUT-parvw,
             WA_OUTPUT-objid,
             WA_OUTPUT-ktext,
             WA_OUTPUT-fecod,
             WA_OUTPUT-fegrp,
             WA_OUTPUT-urcod,
             WA_OUTPUT-urgrp,
             WA_OUTPUT-urtxt,
             WA_OUTPUT-tplnr.
    *ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          filename                        = 'E:\CRM1.TXT'
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
         write_field_separator           = '|'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
        TABLES
          data_tab                        = it_output
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • Eleminating duplicate entries in table

    How to remove the duplicate entries from the tables or internal tables.
    Thankyou for your time in giving the answers.
    Bhaskar.

    Hi,
    For Internal tables use,
    DELETE ADJACENT DUPLICATES FROM itab.
    If u want to delete the duplicate entries depending on one or 2 columns then u can use
    DELETE ADJACENT DUPLICATES FROM itab COMPARING f1 f2.
    Rgds,
    Prakash

  • Duplicate entries in table

    Hi,
    I am using a standard function module, BBP_GET_BOBUSERS_F4. However, after the execution, im getting duplicate entries in my table.
    Please suggest cause and solution.
    Thanks,
    Prisford Pereira.

    Hi,
    To remove duplicate entries try the following piece of code-
    SORT the internal table entries BY <field name>.
    DELETE ADJACENT DUPLICATES FROM internal table    COMPARING <field name>.

  • Removing duplicate values from selectOneChoice bound to List Iterator

    I'm trying to remove duplicate values from a selectOneChoice that i have. The component binds back to a List Iterator on the pageDefinition.
    I have a table on a JSF page with 5 columns; the table is bound to a method iterator on the pageDef. Then above the table, there are 5 separate selectOneChoice components each one of which is bound to the result set of the table's iterator. So this means that each selectOneChoice only contains vales corresponding to the columns in the table which it represents.
    The selectOneChoice components are part of a search facility and allow the user to select values from them and restrict the results that are returned. The concept is fine and i works. However if i have repeating values in the selectOneChoice (which is inevitable given its bound to the table column result set), then i need to remove them. I can remove null values or empty strings using expression language in the rendered attribute as shown:
    <af:forEach var="item"
    items="#{bindings.XXXX.items}">
    <af:selectItem label="#{item.label}" value="#{item.label}"
    rendered="#{item.label != ''}"/>
    </af:forEach>
    But i dont know how i can remove duplicate values easily. I know i can programatically do it in a backing bean etc.... but i want to know if there is perhaps some EL that might do it or another setting that ADF gives which can overcome this.
    Any help would be appreciated.
    Kind Regards

    Hi,
    It'll be little difficult removing duplicates and keeping the context as it is with exixting standard functions. Removing duplicates irrespective of context changes, we can do with available functions. Please try with this UDF code which may help you...
    source>sort>UDF-->Target
    execution type of UDF is Allvalues of a context.
    public void UDF(String[] var1, ResultList result, Container container) throws StreamTransformationException{
    ArrayList aList = new ArrayList();
    aList.add(var1(0));
    result.addValue(var1(0));
    for(int i=1; i<var1.length; i++){
    if(aList.contains(var1(i)))
         continue;
    else{
    aList.add(var1(i));
    result.addValue(var1(i));
    Regards,
    Priyanka

  • 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.

  • Removing duplicate rows from SELECT

    Hi, I was wondering if there was any way to remove duplicate rows from a select statement.
    My table looks like this:
    CREATE TABLE CUS_ID_TO_PC_ID (
    CUSTOMER_ID VARCHAR2 (10) NOT NULL,
    PC_ID VARCHAR2 (25) NOT NULL,
    PASSWORD VARCHAR2 (25) NOT NULL,
    REG_DATE DATE,
    PRODUCT_DESC VARCHAR2 (25),
    EXPIRE_DATE DATE,
    SERIAL_NBR VARCHAR2 (12),
    LDAP_USER VARCHAR2 (200),
    COMMENTS VARCHAR2 (2000),
    PC_ID_5_4 VARCHAR2 (25),
    PC_ID_6_0 VARCHAR2 (25),
    PASSWORD_5_4 VARCHAR2 (25),
    PASSWORD_6_0 VARCHAR2 (25),
    PC_ID_6_1 VARCHAR2 (25),
    PASSWORD_6_1 VARCHAR2 (25),
    OPERATING_SYSTEM VARCHAR2 (20),
    STATUS VARCHAR2 (1)
    Basically, I want to retrieve all columns from the table but remove all duplicate variations of
    the pc_id/serial_nbr combinations.
    For example, given this data:
    PC_ID SERIAL_NBR CUSTOMER_NO
    1234567 AAA C345
    1234567 AAA C567
    3333333 BBB C456
    only the 1st and 3rd rows would be returned.
    Any ideas?

    Try something like this:
    select * from your_table yt
    where rowid in (select max(rowid)
    from your_tabel yt2
    where yt2.pc_id = yt.pc_id
    and yt2.serial_nbr = yt.serial_nbr);

  • Help required on mapping to remove duplicate entries

    Hi all experts,
    I need some help in mapping. I am new to this tool. How would I remove duplicate entries in source payload? My structure is as follows
    Message Structure
    <List> 1-1
    <ParentNode> 0-unbounded
    <Child1> 0-1
    <Child2> 0-1
    Source:
    <List>
         <ParentNode>
              <Child1>PK1</Child1>
              <Child2>SomeValue1</Child2>
         </ParentNode>
         <ParentNode>
              <Child1>PK1</Child1>
              <Child2>SomeValue1</Child2>
         </ParentNode>
         <ParentNode>
              <Child1>PK2</Child1>
              <Child2>SomeValue2</Child2>
         </ParentNode>
    </List>
    Target I would like:
    <List>
         <ParentNode>
              <Child1>PK1</Child1>
              <Child2>SomeValue1</Child2>
         </ParentNode>     
         <ParentNode>
              <Child1>PK2</Child1>
              <Child2>SomeValue2</Child2>
         </ParentNode>
    </List>
    Any help?
    Thanks so much all

    Hi,
    Please note that in my reply I asked you to map ParentNode with <Child1> Please see the below.
    <Child1>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext---<ParentNode>
    Secondly: introduce split by value(for each value ) after collapse context for child1 and child2. as shown below.
    <Child1>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext>Split by value(for each value)----</Child1>
    <Child2>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext>Split by value(for each value)----</Child2>
    it will surely work,

  • How to update duplicate row from table

    Hi,
    how to update duplicate row from table?
    First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
    can you give me suggestion on it?
    Thanks in advance.
    your early response is appreciated...

    In order to find a duplicate row, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
    (or search this forum, your question has been asked before)
    In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
    If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase.

  • HT2905 How to remove duplicate songs from the iPhone when the duplicates are not listed in the iTunes library on the computer.

    How can I remove duplicate songs from the iPhone4. The duplicates are not listed in the computer iTunes library.

    The simplest thing may be to back-up and then restore the iPhone. If you don't fancy that then remove all media that is currently synced to it, then double check and manually remove any media that remains on the device, before reselecting your sync options.
    If you've been manually managing the device and your library doesn't contain copies of all your media then see Recover your iTunes library from your iPod or iOS device.
    tt2

Maybe you are looking for

  • CD/DVD printers no longer made?

    I was looking through the current product lines but didn't really see any that would print directly onto CD or DVD's like in the past.  About a year or so there used to be a couple models but I never had the money even though the cheaper one was only

  • Error Ipod Touch Stuck In Recovery Mode

    hey guys ive got an ipod touch and after updateing it today to 2.2.1 it now wont turn on it is showing the itunes icon and usb connector ive plugged it back in to the computer i installed the update on and it says this ipod is in recovery mode ive tr

  • Problem in PlSql Block

    Hello All, when i am executing the below block then i m getttin the err ERR :ORA-01847: day of month must be between 1 and last day of month I am struggling to get where is the exact err .. Any one can suggest me any solution Emp Table EmpId Varchar2

  • Can CS6 be installed on two systems?

    We have a CS5 license which could be installed on two systems. Is this possible if we upgrade to CS6

  • IPhoto confusion

    hi, I have all current updates for iPhoto, but when I went to download 9.1.5, it said I needed version 9.0 or above. I went searching for 9.0 to no avail and tried 9.1, but this still wouldn't load without 9.0! My current version is 8.1.2 on OSX 10.6