Delete duplicate entriess from the internal table its urgent pls help.

Hi friends,
Hope everybody is doing good,Here is m query on delete duplicate data from the intenal table.
I have an internal table which contain data in the following format.
Doc No Comp Cod Vendor Assignment
1500000009 JM11 00000000
1500000008 JM11 20070212(Repeating)
1500000007 JM11 20070212
1500000006 JM11 00000000
1500000005 JM11 00000000
1500000004 JM11 00000000(Repeating)
1500000003 JM11 00000000 (Repeating)
1500000002 JM11 00000000
1500000001 JM11 20050302
1500000000 JM11 00000000
1500000003 JM11 10000088
1500000001 JM11 10000088
1500000030 JM11 10006260
1500000010 JM11 10006269
1500000008 JM11 10006269
1500000006 JM11 10006269
1500000004 JM11 10006269
if you see the document numbers,there are some document number which are repeating here,there are some document numer which contain vendor number but not the assignments,some of the document numbers contain the assignments but not the vendors.
If my internal table contain this kind of data with repeted document numbers than i want the document number which contains only the vendor number.
Pls help me with the appropriate logic,its urgent.
Thanks a lot
mrutyun^

Hi,
<u><b>Deleting Adjacent Duplicate Entries</b></u>
To delete adjacent duplicate entries use the following statement:
DELETE ADJACENT DUPLICATE ENTRIES FROM <itab>
[COMPARING <f1> <f2> ...
|ALL FIELDS].
The system deletes all adjacent duplicate entries from the internal table <itab>. Entries are
duplicate if they fulfill one of the following compare criteria:
  Without the COMPARING addition, the contents of the key fields of the table must be
identical in both lines.
  If you use the addition COMPARING <f1> <f2> ... the contents of the specified fields <f1>
<f2> ... must be identical in both lines. You can also specify a field <fi> dynamically as
the contents of a field <ni> in the form (<ni>). If <ni> is empty when the statement is
executed, it is ignored. You can restrict the search to partial fields by
specifying offset and length.
  If you use the addition COMPARING ALL FIELDS the contents of all fields of both lines
must be identical.
You can use this statement to delete all duplicate entries from an internal table if the table is
sorted by the specified compare criterion.
If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4.
Examples
DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1.
DO 4 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
INSERT LINE INTO TABLE ITAB.
ENDDO.
LINE-COL1 = 1.
DELETE TABLE ITAB: FROM LINE,
WITH TABLE KEY COL1 = 3.
LOOP AT ITAB INTO LINE.
WRITE: / LINE-COL1, LINE-COL2.
ENDLOOP.
The output is:
2    4
4   16
The program fills a hashed table with a list of square numbers. The DELETE
statement delete the lines from the table where the key field COL1 has the contents 1 or 3.
Regards,
Bhaskar

Similar Messages

  • Bat files from java application..its urgent pls help me

    hi
    My java application tries to execute the bat file, the code followes
    Runtime runs = Runtime.getRuntime();
              runs.exec("e:/customisation/test.bat");
    The bat file contains commands to copy files from one folder to another
    and some dos commands, but the commands are not executing. If i tried the bat file with some exe's like notepad its working well, but not working with dos commands.
    thanks in advance
    nisam

    Hi
    Your batch file will be working actually. But no output will be seen in the console window.
    For example I had created a batch file with the folowing code
    echo This is test
    copy test.bat test1.bat
    pause
    Even though I can't see the messages in the console, it executed when called using
    Runtime runs = Runtime.getRuntime();
    runs.exec("hi.bat");
    where hi.bat contains the above code.
    If you want to see the output messages also in the console, you have to redirect the outputstream to the current console. One such class this does is available somewhere in Java(I don't exactly remember :-( ). I think it is StreamPluginThread.java
    Regards

  • Delete all entries from the following tables - Follow-up Activities (oracle)

    Hello,
    I performed a homogeneous system copy of our development BW system with the database (oracle 11.2.0.3) from the BW production system!
    I already start the oracle database and the SAP system in the target system/server (development BW system) and I´m doing some follow-up activities. One of this activities is (at the system copy guide 6.2.3.2 Activities at Database Level) is to delete all entries from the following tables:
    DBSTATHORA, DBSTAIHORA, DBSTATIORA, DBSTATTORA
    I tried to delete them using SQL Plus:
    sqlplus /nolog
    SQL> connect /as sysdba
    SQL> delete from DBSTATTORA;
    delete from DBSTATTORA
    ERROR at line 1:
    ORA-00942: table or view does not exist
    ... and it show me that error message.
    This is strange because when I go to transaction SE14 and check the DBSTATTORA I see that table exist and contain a lot of entries!
    Why this is happened in SQL Plus!? I´m running the correct SQL statement for doing this type of task or not?
    How can I delete the entries of that tables? Can I do that using the transaction SE14?
    Can you help me please?
    Thank you,
    samid raif

    Hello
    sqlplus /nolog
    SQL> connect /as sysdba
    SQL> delete from DBSTATTORA;
    delete from DBSTATTORA
    ERROR at line 1:
    ORA-00942: table or view does not exist
    It doesn't surprise me as you are not mentioning the schema name here. Instead it should be
    delete from SAPSR3.DBSTATTORA;
    Assuming the schema owner is SAPSR3. if the owner is different then replace that with the correct one.
    Regards
    RB

  • Creating MS- Access data base from the Internal tables data of an ABAP Prog

    Hi,
    I have a requirement where I have to create Access tables from the Internal tables of ABAP program.
    The tables are like Project systems Header data, WBS elements data, Netwrok data, Activity data, Milestone data and Project revunes. I will have the internal tables for these. I want to transfer these tables data into MS-Access tables onto Users desktop.
    Please adivce me how to do this.
    Thanks,
    Prabhakar

    HI,
    I am trying to create a DB table in the access but I am not successful. The following is the format of the table needs to be created from the ABAP program.
    I have created a table with the following format in MS-Access with the name tblHeader. Is it neccessary to create a DB table ( MS-Access) in advance or by using the FM  STRUCTURE_EXPORT_ TO_MSACCESS  we need to create a structure in MS-Access?
    False tblHeader
    Field Name Type Length
    ProjectDef Text 255
    ProjectDes Text 255
    Created Text 50
    Change Text 50
    RespPerson Text 255
    Profile Text 255
    Plant Text 255
    ObjNo Text 255
    OverheadKey Text 255
    I have created a Z table ZTAB1 with the same format from the SAP fields.
    MS-Access Table name : tblHeader
    ABAP program Internal table : t_tblheader
    Z table Name : ZTAB1.
    First I am trying to create a structure in MS-Access with the following FM.
    CALL FUNCTION 'STRUCTURE_EXPORT_ TO_MSACCESS'
    EXPORTING
    dbname = 'D:\test\db2'
    LANGU = SY-LANGU
    dest = 'PS_ACCESS_1'
    TABLES
    tabname = ttblheader
    EXCEPTIONS
    system_failure = 1
    comm_failure = 2
    OTHERS = 3
    Table ttblheader type is DFIES and I am filling the table with only one record and one field i.e TABNAME and the value is ZTAB1.
    The source code of the FM is using another FM
    CALL FUNCTION 'MSACCESS_STRUCT_ EXPORT_RFC' DESTINATION DEST
    Here I am getting the Error message Object required. I can't able to create a table structure in MS-Access.
    Next I am going to Use the FM
    'TABLE_EXPORT_ TO_MSACCESS'
    and it will create the records in the MS-access table.
    CALL FUNCTION 'TABLE_EXPORT_ TO_MSACCESS'
    EXPORTING
    dbname = 'D:\test\db2'
    langu = sy-langu
    dest = 'PS_ACCESS_2'
    tabname = 'ZTAB1'
    reftable = 'tblheader'
    FLG_NO_DOWNLOAD = ' '
    FLG_APPEND = ' '
    FLG_POPUP = ' '
    TABLES
    dtab = t_tblheader
    here t_tblheader is the internal table.
    Reftable = tblheader is the table which i have created in advance. ( not by using the First FM)
    In this FM i am getting a error message : Unable to connect to Database D:\test\db2.
    Please help me how to create the MS-Access database.

  • I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY WUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ??

    I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY QUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM .I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ?? HOW IT IS ??

    Hi Kishore,
    First identify deleted records by selecting "Detect deleted rows from comparison table" feature in Table Comparison
    Then Use Map Operation with Input row type as "delete" and output row type as "delete" to delete records from target table.

  • How do I delete duplicate icons from the dock of an Imac 8.1?

    How do I delete duplicate icons from the dock of an Imac 8.1?

    No dragging to trash doesn't work. Just keep dragging them off. If they are stacked, which shouldn't happen, then when you delete one the other is still there.
    Just how did you get duplicates? Did you put them there? If not then you have other problems and I'm not sure how to correct it.

  • Deleting a row from the item table

    Hi All,
    I have a requirement where I need to put a button to delete the selected row from the item table and for this I have written the following code:
    DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
        DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
        DATA ls_t_bseg TYPE wd_this->element_t_bseg.
        data: it_tab type table of wd_this->element_t_bseg.
      lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
      lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
      lo_el_t_bseg->get_static_attributes(
        IMPORTING
          static_attributes = ls_t_bseg ).
        lo_nd_t_bseg = wd_context->path_get_node( path = `Z.T_BSEG` ).
        lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
        IF lo_el_t_bseg IS not INITIAL.
          lo_nd_t_bseg->remove_element( lo_el_t_bseg ).
        ENDIF.
    Now the problem is although it's deleteing the selected line correctly but because of this I am losing one line on the screen for the user to enter... my form has a fixed number of lines and in my case it's 10... so everytime I am using deleting a line item I am losing one line to enter..... can you please tell me how can I avoid this?
    Edited by: rajatg on Aug 4, 2011 3:12 PM

    lets say...
    i have 1,2,3 documents
    i have cleared , document 2....
    1. when the user selects this record.... you can read the context_element....using the context element you can get the values and clear those values and set the blank values...
    when the user click on save ...you can have only those two records in the table.
    2. conitnue with your logic .... remove_element. once it is done ,,, create_element at the deleted index...
    3. when clicked on delete ...remove_element ( current code).... bind the table to the node... and you will have ur values

  • How to delete Duplicate records from the informatica target using mapping?

    Hi, I have a scenario like below: In my mapping I have a source, which may containg unique records or duplicate records. Source and target are different tables. I have a target in my mapping which contains duplicate records. Using Mapping I have to delete the duplicate records in the target table. Target table does not contain any surrogate key. We can use target table as a look up table, but target table cannot be used as source in the mapping. We cannot use post SQL.

    Hi All, I have multiple flat files which i need to load in a single table.I did that using indirect option at session level.But need to dig out on how to populate substring of header in name column in target table. i have two columns Id and Name. in all input file I have only one column 'id' with header like H|ABCD|Date. I need to populate target like below example. File 1                                    File2     H|ABCD|Date.                      H|EFGH|Date.1                                            42                                            5  3                                            6 Target tale: Id    Name1     ABCD2     ABCD3     ABCD4     EFGH5     EFGH6     EFGH can anyone help on what should be the logic to get this data in a table in informatica.

  • Getting the last record from the internal table

    When we use a READ statement it always picks up the first record which fulfill its condition but in my case I want to pick up the last record that fulfills it condition
    I have a internal table like
    id     type
    N1      A
    N1      T
    N1      A
    N1      6 ----> LAST RECORD
    my code is
    read table itab wIth key id = netobjid.
    for eg if netobjid = N1 , then I want to read the last record that corresponds to N1 ie ID N1 TYPE - 6...
    How to do that?

    HI
    actually i have done same requirement like this ...
    Take  one count variable into your internal table ..you pass the number of records into cont variable for every time  u enter the loop .
    Sort the internal table with count variable descending . ( AS we cant sort the internal table with sy-tabix)
    Then use read statement with sy-index = 1 .
    USe below logic ,............
    data  :  count  type i value '0'.
    LOOP at int .
    count = count + 1 .
    endloop.
    sort int count descending .
    read int  with  index = 1 .

  • Can I restore the deleted statistical data from the database tables?

    Hi all,
       I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete.
    Is there any way to restore the deleted data back? Thanks in advance.

    Now I'm really confused-
    Your first post said
    "<b>I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM</b>,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete."
    but your last respsonse said
    "I have deleted the BW Statistics data, <b>not the actual data in RSDDSTAT tables</b> through
    RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' bin to delete data."
    If you used the RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' - <b>then you deleted the data from the RSDDSTAT tables</b>. This assumes you accepted the default date range that would have popped up after the clicking on the Delete button which specified to delete thru the current date.  If this is what you did, the data is gone.  Your only hope is be to recover from a DB backup.  
    The data in the RSDDSTAT tables is what is used to feed the BW Statistics cubes, generally on a daily basis.

  • How to collect similar record from the internal table

    I need to collect exact matched records from 1 internal table to another internal table by searching 5 fields. I need to have records which are exactly matched for 5 fields. i have written a code wich is mention below it gave me only similar records but not 100% matched record.. would you like to help me. any correction, suggetion,. Will be great help to me.

    To get exact match of 5 records, do as follows.
    Check whether internal table gives only one record or not after READ statement.If internal table gives more than one entry for READ then the results will be improper.
    I think there is no need of READ statement on same internal table within LOOP. I commented the same in code.
    sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
    loop at i_bp_p into wa_i_bp_p.
    *lv_tabix = sy-tabix.
    *read table i_bp_p index lv_tabix into wa_i_bp_p.read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
    idtype = wa_i_bp_p-idtype binary search.
    if sy-subrc = 0.
    read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
    initials = wa_i_bp_p-initials
    name_last = wa_i_bp_p-name_last binary search.
    if sy-subrc = 0.
    read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
    rbcode = wa_i_bp_p-rbcode binary search.
    if sy-subrc = 0.
    move-corresponding wa_i_bp_p to i_bp_p100.
    append i_bp_p100.
    endif.
    endif.
    endif.
    endloop.
    sort i_bp_p100 by partner.
    loop at i_bp_p100.
    write : /10 i_bp_p100-partner,
    20 i_bp_p100-title,
    30 i_bp_p100-initials,
    40 i_bp_p100-name_last,
    53 i_bp_p100-idnumber,
    70 i_bp_p100-idtype,
    85 i_bp_p100-rbcode,
    95 i_bp_p100-f50code.
    endloop.
    sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.
    loop at i_bp_p into wa_i_bp_p.
    lv_tabix = sy-tabix.
    read table i_bp_p index lv_tabix into wa_i_bp_p.
    if sy-subrc = 0.
    read table i_but0id into wa_but0id with key idnumber = wa_i_bp_p-idnumber
    idtype = wa_i_bp_p-idtype binary search.
    if sy-subrc = 0.
    read table i_but000 into wa_but000 with key title = wa_i_bp_p-title
    initials = wa_i_bp_p-initials
    name_last = wa_i_bp_p-name_last binary search.
    if sy-subrc = 0.
    read table i_but0is into wa_but0is with key f50code = wa_i_bp_p-f50code
    rbcode = wa_i_bp_p-rbcode binary search.
    if sy-subrc = 0.
    move-corresponding wa_i_bp_p to i_bp_p100.
    append i_bp_p100.
    endif.
    endif.
    endif.
    endif.
    endloop.

  • Its urgent pls help me .

    how can i call a portal from webdynpro application
    my requirment is
    i was created webdynpro application.
    in that i was created one view . in that i was created one button (go).
    if i click that button i want move some other portal.
    how can i acchive pls help me.
    its urgent.
    pls send any example programe
    Message was edited by:
            madipadiga nagaraju
    Message was edited by:
            madipadiga nagaraju

    hi,
    there is no direct tcode for going to webdynpro component/interfaces in ecc 6.0.
    but u have se58 in ecc 5.0,as webdynpro convertor.u give ur program name and click web dynpro convertor button then it takes u to se80 .but this wda(webdynpro abap) component comes as in application tree hierarchy .
    i can say in wda component refers a class .if u select webdynpro component/interface,it ask u to create a class or interface.
    after that it automatically generate component controller(it is also a class),
    interface view and windows.all these 3 are classes.for every window one interface view will be created.ie.. window is internal visible where as interface view is external visible.
    u create view and embed these views in windows.by going to the window layout,right click on the window name and click embed view.u can enbed as many view as u wish.in order to navigate from one view to other view ,click  "create navigation" by right clicking the view plugs.
    by default windows and view have inbound plugs.this is literally a event of that class.
    if u want to navigate from view1 to view2 ,create outbound plug for view1,the click outbound plug of view1 and right click the click create navigation the select inbound plug of view2.
    then create a application .this is simillar of creating an object.
    click on this object and test .this will open in browser.
    for deploying u have use "sap webdynpro iview".

  • How to soft delete a row from the target table?

    Could someone help me on this requirement?
    How to implement the below logic using only ODI? I am able to implement the below logic with the "DELETE_FLAG" as "N".
    I want to make the latest record with the flag as "N" and all the previous other records with the flag as "D".
    Thanks a lot in advance.
    I have a source table "EMP".
    EMP
    EMPID FIRST_NAME
    1 A
    2 B
    First name is changed from A to C and then, C to D etc. For each data change, I would add a target row and mark the latest row as "N" and the rest as "D". The target table would contain the following data:
    Target_EMP
    EMPID FIRST_NAME DELETE_FLAG
    1 A D
    1 C D
    1 D N

    The problem is that I can't delete the row cause it demands from me to fill the mandatory field previously. It takes place when the key field is ROWID. In other cases delete is succesful.

  • Removing a character in a value from the internal table

    Hi guys!
    <b>example: i_table-field = "10,20"</b>
    I want to remove " " because creating csv creates this automatically because it has a value that includes comma. I am also using comma separator for my program so if I would remove the " " before splitting the values there will also be an effect on my program... can anyone can help me with this?
    thanks in advance! good day guys!

    Hi Michael,
    In the scenario of yours, you are left with two options.
    1. Format the XLS file properly before converting it to CSV. here If you convert the quantity, currency columns to the text columns then you will not get " into CSV file.
    2. Define the quantity, currency fields in your internal table as of type char. For eg. Curr of length 18, should be defined as fields of CHAR20 (two characters for " "), then once you separate all the fields based on comma, just repalce all the occurances of " using REPLACE.
    But what I suggest is better use option 1. The decision is totally depend on the number of time you want to use the program.
    Reward points if useful.
    Regards,
    Atish

  • Followup Question: Removing a character in a value from the internal table

    Hi guys!
    example: i_table-field = "10,20"
    I want to remove " " because creating csv creates this automatically because it has a value that includes comma. I am also using comma separator for my program so if I would remove the " " before splitting the values there will also be an effect on my program... can anyone can help me with this?
    thanks in advance! good day guys!
    Follow-up:
    I have resolved with my problem regarding " " but I found out that splitting the file with comma splits the "10,20" which is a single value for a field.
    it was also split into two values: (before removing the " ")
    "10
    20"
    can anyone can help me with this? thanks in advance! good day guys!

    Hi Atish,
    1. Format the XLS file properly before converting it to CSV. here If you convert the quantity, currency columns to the text columns then you will not get " into CSV file.
    What do you mean convert the quantity, currency columns to the text columns? Does this mean by changing the cell format into currency? when I made this the format change other values ie: 150000000772 turned to 150,000,000,772. Which I think will also split to values:
    150
    000
    000
    772
    But converting from xls to csv really removed the " ".
    So I resolved removing the " " with your answers before.. my problem now is that in a single field value 10,20. they are also separated. I need them to be in a singe value. thanks!

Maybe you are looking for

  • Reg - How to remind previous view state?

    Hi, I have the following requirement: In mobile application, the home view screen has a text input and button controls. Text input will contain a service URL (value provided at run time), on click of the button, the given URL (specified in text box)

  • Audio themes for e72

    is it possibile to download and use audio themes for e72 other than the 3 provided by nokia which are preinstalled in the phone??? if possibile from where i can get them..i googled it and didnt find any..please help

  • Cheque Lot Creation

    Hi All, Please let me know the T.Code used to create Cheque lot series and also pls let me know the steps followed. Please suggest. Regards, Nagaraj S

  • Liability on two transport vendors for one shipment

    I am in the process of configuring transportation with two level leg determination.  That is from parent plant to one destination, it would be in main leg and from that destination to final destination in subsequent leg. The purpose of doing is that

  • CS5 submit error - enquiry form

    Two years ago, I was able to create a contact page with a fill out form with submit button.  All in CS3.  Now I am using CS5, created a new web site, but now when I create a contact us page with fill out form, it is not working when someone clicks on