Extract only the records exist in Table A but not in Table B

Hi guru, I need to compare two big SAP tables and only select the records that exist in Table A but not in Table B, i.e. Exclude the records that exist in both tables. Due to the volume, left outer join is not preferred. Does anybody know any smart and quick way to do so?
Thanks,

Sounds like you're looking for alternatives from performance perspective, so maybe your question would be better posed in .
As always for any performance related questions the answer is: It depends...
I.e. you need to provide some further background: How many entries in table A, how many in table B? How are they linked (e.g. index, primary key, what fields)? On average, how many entries do you expect in your result set?
Depending on those parameters (and possibly others) one can then evaluate other options: There's probably not many, I'd try also using [subqueries|http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_SUBQUERY.htm]. Since performance tuning always requires an analysis, it's best to try out the different variations and check what happens (e.g. how long do they run, what kind of load do they introduce on the database, etc.). Subquery versus outer join performance depends also on the used database.
Cheers, harald

Similar Messages

  • How to get only the record which is different by outer join

    Hi,
    how to get the values Existing in table A which are not existing in table B by using left outer join, In this example only the record '3' should display. thanks
    the requirementment is like
    Table A.Number Table B.Number
    1 1
    2 2
    3 4
    4 5
    output
    3

    SQL>  with a as (
    select 1 a from dual union all
    select 2 a from dual union all
    select 3 a from dual union all
    select 4 a from dual
    b as (
    select 1 a from dual union all
    select 2 a from dual union all
    select 4 a from dual union all
    select 5 a from dual
    select a.*
      from a left outer join b on (a.a = b.a)
    where b.a is null
             A
             3

  • Unable to extract all the records initial run(for Datasource 0HR_PY_1).

    Hi All,
    I was trying to extract the data using 0HR_PY_1 Data Source (HR-Payroll related).  When I use Full update in BW, it extracts all the records from R/3 but when I use Init load to extract the data, it is not extracting all the records(some records are missing).
    So I dont know what exactly is happening. I also checked RSA7 and deleted the entry for this data source (this entry was created because we tried to do some test delta in the past).
    When I goto RSA3(Extractor Checker) and use update mode "F" (along with some selection criteria employee#284), it shows 550 records which is the correct number.But when I use the update mode "C"(Initialization of the delta transfer),  I just get 490 records only.
    So I am thinking is there anything I need to do to reset the initialization tables somewhere on r/3 side or do some kind of settings on r/3 by which I can extract all the records by using INIT load.

    I noticed a weird thing in RSA3,
    I tested this without any selection criteria.
    Using "F" update mode, the total number of records were 173,654
    Using "C" update mode, the total number of records were 176,205
    So, even though I was getting less number of records by using "Full" update mode, I was able to see the latest data I wanted. But When I use "C" update mode, even though the number of records is more, still I could not see the latest data (6/2007)???
    So dont know what exactly is happening!!

  • How can I extract only the audio as an aiff file?

    Using a Sony DSC-N2 Cybershot Camera I recorded video that was saved as “MOV01606.MPG”. The video plays back with sound in Quicktime Pro and iTunes but how can I extract only the audio as an aiff file?

    Use MPEG Streamclip (free) to convert your .mpg files to QuickTime formats.
    QuickTime can't extract audio from muxed file formats.

  • MDM API to read the Record Key Mapping table

    Hi,
    Does anybody know what class/method I can use to read the Record Key Mapping table?
    For the Business Partner table the Key Mapping table has this columns:
    <u>Default / MDM Partner ID / Remote System / Key</u>
    I have everything but the Key. How can I read it?
    Thanks in advance,
    Diego.

    GetKey Mapping is one of the available Web Services as of SP4.
    Else you could use the Java API to get the Key Mapping.
    <b>CatalogData class</b> has the following method
    <b>GetKeyMapping</b>
    public java.lang.String[][] GetKeyMapping(java.lang.String agency,
                                              java.lang.String table,
                                              int[] recordIDs,
                                              boolean isDefaultKeyOnly)
                                       throws StringExceptionRetrieves the key mapping for each record.
    Parameters:
    agency - the agency name.
    table - the table name.
    recordIDs - the list of records.
    isDefaultKeyOnly - True to retrieve only the default value, False to all key values.
    Returns: the key values for each record.

  • Only first record in internal table in output

    Hi,
    I have a requirement.
    I loop at an internal table and that tabl (list_selected_records) records.
    Loop at list_of_selected_nodes into wa_selected_nodes.
    node = wa_selected_nodes-node_id.
    node_level = wa_selected_nodes-node_level.
    read table ex_list_of_texts
    into wa_list_of_texts
    with key node_id = node
    binary search.
    IF sy-subrc eq 0.
    node_text = wa_list_of_texts-text.
    ENDIF.
    node_level = node_level - 1.
    Selecting Text for Node selected (Business Scenario)
    READ TABLE list_of_all_nodes into wa_all_nodes WITH KEY NODE_LEVEL = node_level
    BINARY SEARCH.
    if sy-subrc = 0.
    SELECT SINGLE TEXT FROM TTREET into texts WHERE ID EQ wa_all_nodes-tree_id
    AND SPRAS EQ 'EN '.
    IF NOT TEXTS IS INITIAL.
    wa_final-texts = texts.
    append wa_final to it_final.
    CLEAR WA_FINAL.
    endif.
    endif.
    endloop.
    This is my code.
    Now from the select single stmt i fetch a text and add it to be internal table . Once i fetch a one record the loop should be ended and a new iteration for for a second guid should start.
    Once one record , first record is fetched for texts, only that shd appear in alv output but not other. but the loop should contnue for other fields. Please help
    Thanks in Advance.
    SS

    Hi Swarna,
    Use control event AT-NEW inside the loop. This event will triger only once for every new node_id.
    Loop at list_of_selected_nodes into wa_selected_nodes.
    AT-NEW node_id.
    node = wa_selected_nodes-node_id.
    node_level = wa_selected_nodes-node_level.
    read table ex_list_of_texts
    into wa_list_of_texts
    with key node_id = node
    binary search.
    IF sy-subrc eq 0.
    node_text = wa_list_of_texts-text.
    ENDIF.
    node_level = node_level - 1.
    Selecting Text for Node selected (Business Scenario)
    READ TABLE list_of_all_nodes into wa_all_nodes WITH KEY NODE_LEVEL = node_level
    BINARY SEARCH.
    if sy-subrc = 0.
    SELECT SINGLE TEXT FROM TTREET into texts WHERE ID EQ wa_all_nodes-tree_id
    AND SPRAS EQ 'EN '.
    IF NOT TEXTS IS INITIAL.
    wa_final-texts = texts.
    append wa_final to it_final.
    CLEAR WA_FINAL.
    endif.
    endif.
    ENDAT.
    endloop.
    Thanks & Regards,
    Parameswaran.K

  • Import only the rows of emp table from Test into emp table of Prod

    hi,
    Test Instance:
    =========
    I have a table "emp". I want to take export of it.
    Prod Instance:
    =========
    Table with name "emp" already exists.
    I want to import only the rows of emp table from Test Instance into emp table of Prod Instance.
    regards,
    charan

    Charan,
    Set the import command IGNORE=Y
    Importing into Existing Tables
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm#i1023662
    Regards,
    Hussein

  • Way to extract only the DDL out of an 8i Database?

    Hello -
    Is there a way in Oracle 8i to extract only the DDL (using a package, etc.) of a database? I know this can easily be done in 10g with Data Pump, but I have to have this done in 8i.
    Thanks,
    Mike

    You can use export and import to generate the DDL.
    exp <user>/<password> file=<file_name> owner=<schema>
    imp <user>/<password> file=<file_name> indexfile=<filename>
    This will generate a file that contain the ddl to create the indexes. The table ddl is included but commented out.
    See the docs for more information on the INDEXFILE parameter of import.
    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96652/ch02.htm#1005500
    Also check out the thread on AskTom:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:1995108178664252119::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:1464804639878

  • Stay on the edit page once saved and see the record as a table

    I like to click on the edit of an interactive report to go to the edit page.
    Once in the edit page, I like to see not only the form to edit the record but also
    the record as a table to see what the record looks like once the save button is clicked below the edit form.
    Thanks.

    Look at the page branches. There will be one or more which goes to the first page. Change it to go to the current page instead of the first page.

  • How to export only the data displayed in table of a jsp page to Excel

    Hi All,
    I want to export only the data that is displayed in the table of a jsp page to excel. But with my current code everything is getting exported to excel.
    <input type="checkbox" name="download" onclick = "form.submit()"/> Export to Excel
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-disposition", "inline; filename=fileName.xls");
    the table is displayed in the jsp using the following code:
    <table cellspacing="2" cellpadding="3" border="1"
    width="100%"> <tr> <%for (int i = 2; i <= cols; i++) {%>
    <td>
    <%
    out.println( rsmd.getColumnName(i) + " ");
    } %>
    <% while (rsettaba.next ())
    out.println("<tr>");
    for (int j= 2; j <= cols ; j++) {
    //out.println("<td>"+rsetallcl.getString(j)+"</td>");
    String varnl = rsettaba.getString(j);
    if ( varnl == null )
    out.println("<td> Empty </td>");
    else
    out.println("<td>"+rsettaba.getString(j)+"</td>");
    out.println("</tr>");
    %>
    </td>
    </tr>
    </table>
    please can anyone help how to just extract only the data in the table of a jsp page to excel.
    Edited by: Ramky48 on Dec 9, 2009 9:51 PM

    Ramky48,
    Why did you open a new thread when you had gotten quite a few responses and suggestions on the [url http://forums.oracle.com/forums/thread.jspa?threadID=998411]thread where you asked the same question - seems the best thing to do would be to continue on the same thread?
    However, your question has nothing to do with JDeveloper/ADF. If you'd like to do it the ADF way, it's trivially easy - you can use the [url http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e12419/tagdoc/af_exportCollectionActionListener.html]af:exportCollectionActionListener component, which does what you are asking for. If you want to use a straight JSP way, there were several good suggestions in the other thread you opened, or Googling "jsp export to excel" will get you about 4.6 million hits; the first 10 or so look pretty promising.
    John

  • Regarding how to delete the record in internal table

    Hi experts ,
    how to delete the record in intarnal table after validating the data,
    if record contains invalid fields?
    i am giving my code see this and give me the answer?
    loop at it_data into wa_data .
    Validate  Cost Center
        READ TABLE it_kostl INTO wa_kostl WITH KEY kostl = wa_data-kostl BINARY SEARCH.
        IF sy-subrc NE 0.
          PERFORM update_error_log USING wa_data
                                         text-004.
        ENDIF.
    Validate source file material ( material number )
    loop at it_mara into wa_mara .
      read table it_ausp into wa_ausp with key atwrt = wa_data-i_matnr .
               if sy-subrc NE 0 .
       PERFORM update_error_log USING wa_data
                                           text-002.
    delete it_data-objek .
         else.
      read table it_mara into wa_mara with key  matnr = wa_ausp-objek .
           if sy-subrc EQ 0 .
           wa_data-objek = wa_mara-matnr.
           wa_data-matkl = wa_mara-matkl.
         ENDIF.
         Modify it_data from wa_data  .
      endif.
    *endloop.
    Validate unit of measure (unit)
        READ TABLE it_t006 INTO wa_t006 WITH KEY msehi = wa_data-unit .
        IF sy-subrc NE 0.
          PERFORM update_error_log USING wa_data
                                         text-003.
        endif.
    Validate delivery location ( storage location )
        READ TABLE it_lgort INTO wa_lgort WITH KEY del_loc = wa_data-del_loc.
        IF sy-subrc NE 0.
          PERFORM update_error_log USING wa_data
                                         text-001.
             if wa_data-flag ='x' .
          delete it_data from  wa_data .
        endif.
        ENDIF.
    endloop.

    Hi Naren,
    First get the index number of the IT_data table and store it in one variable whose declaration like this.
    data: tabix type sy-tabix.
    while reading the internal table it_data set the tabix variable.
    tabix = sy-tabix.
    Instead of  the above use below one.
    Delete it_data-objek
    Use the Below statement it will delete  the row from the internal table.
    Delete it_data-objek index tabix
    Thanks,
    Chidanand

  • Sending email after deleting the records in a table

    Hi
    I am deleting the records in a table. After deleting the records,
    i want to send an email to another person. I am planning to follow this steps.
    1. Create a trigger on the table(AFTER DELETE ON table FOR EACH ROW)
    to copy the deleted records to temporary table.
    2. Read the temporary table and send an email.
    Is there any other way we can do with out creating temporary table ?.
    Govind

    I don't know what you plan to use to send the mail but here's a solution that would work.
    -- Create a send mail procedure
    create or replace procedure send_mail (
    sender      IN VARCHAR2,
    recipient   IN VARCHAR2,
    message     IN VARCHAR2)
    IS
      mailhost VARCHAR2(30) := 'localhost';
      mail_conn utl_smtp.connection;
    BEGIN
    mail_conn :=  utl_smtp.open_connection(mailhost, 25);
      utl_smtp.helo(mail_conn, mailhost);
      utl_smtp.mail(mail_conn, sender);
      utl_smtp.rcpt(mail_conn, recipient);
      utl_smtp.data(mail_conn, message);
      utl_smtp.quit(mail_conn);
    END;
    /-- Create the trigger to email deleted rows
    create or replace trigger email_del_rows
    after delete on <table>
    for each row
    declare
    msg varchar2(2000);
    begin
    msg := 'COL1  COL2  COMPANY NAME  DATE'||chr(10);
    msg := msg||:old.col1||'    '||:old.col2||'    '||:old.company_name||'       '||:old_date|| chr(10);
    msg := msg||'END OF FILE';
    send_mail('SENDER','[email protected]',msg);
    end;
    /You can make it look pretty but you get the basic idea.

  • Custom batch rename files with Aperture 3 in the following format: IMG_0023.cr2 to Smith_YYMMDD_0023.cr2?  I cannot find a way to structure the date in Aperture as such, as well as extract only the camera file

    Please advise how to custom batch rename files with Aperture 3 in the following format: IMG_0023.cr2 to Smith_120816_0023.cr2?  I cannot find a way to structure the date in Aperture as such (YYMMDD), as well as extract only the camera file (0023, for example).  Adobe Bridge CS5 can do this, but NONE of the Adobe software is retina optimized, and is terrible to look at.

    In Aperture you are limited to renaming files by the entries in the File Naming preset window.
    At what point are you looking to rename, import or export? It might be possible to do what you are looking to do external to Aperture either via a script or other software.
    regards

  • Triggers to insert the record in a table

    I have two table 1. Holiday 2. Attendance.
    When I insert the record    in holiday table for his
     advance holiday   with empid, the same time I want to insert it attendance table
     automatically for the same date using a trigger
    Insert into attendance (empid,date,holiday) values (20078,07/10/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    If employee mark his current attendance as  holiday through attendance,
     it should   be  inserted into holiday table 
    automatically using triggers.
    Insert into  Holiday (empid,date,holiday) values (20078,06/08/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    Please I am looking for your help , how I can make it using triggers 
    to insert both table  in two different ways of options.
    Regards
    Pol
    polachan

    Hi polachan,
    According to your description, if you want to synchronize the data between the holiday table and the attendance table while inserting records into holiday table, you need to create a trigger on the holiday table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_holiday
    on holiday
    for insert
    as
    declare @empid varchar(20),
    @date datetime,
    @holiday int
    select @empid = empid, @date=date, @holiday=holiday from inserted
    declare @qty int
    select @qty =count(*) from attendance where empid=@empid and date=@date and holiday=@holiday
    if @qty<1
    begin
    insert into attendance
    select i.empid,
    i.date,
    i.holiday
    from inserted i
    end
    Meanwhile, if you want to insert the record into the holiday table when holiday is updated to 1 in the attendance table, you need to create another trigger on the attendance table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_attendance
    on attendance
    for update
    as
    declare @holiday int
    if update (holiday)
    begin
    select @holiday=holiday from inserted
    if @holiday=1
    begin
    insert into dbo.holiday
    select empid,
    date,
    holiday
    from inserted
    end
    end
    For more details about creating triggers in SQL Server, please review this article:
    CREATE TRIGGER (Transact-SQL).
    Thanks,
    Lydia Zhang

  • Function module or BAPI that is used to update the records in RBKP table.

    Hello All,
    Can anybody please give me the name of any Function module or BAPI that is used to update the records in RBKP table.
    Please help me
      I need to change the fiscal year in RBKP table
    Thanks in Advance,
    Regards,
    LIJO

    Hi,
    You can use the BAPIs,
    BAPI_ACC_INVOICE_RECEIPT_CHECK Accounting: Check Invoice Receipt (OAG: LOAD PAYABLE)
    BAPI_ACC_INVOICE_RECEIPT_POST  Accounting: Post Invoice Receipt (OAG: LOAD PAYABLE)
    Hope this helps.
    Regards,
    Renjith Michael.

Maybe you are looking for