How do I find missing entries in outer join table?

Hi all,
I am trying to find records in table1 that are missing in table2.  This is a simple process in SQL, but ABAP is giving me trouble.  I want to do this using an outer join.
Example:
Select table1~docnumber
From table1
Left Outer Join table2
On table1docnumber = table2docnumber
Where table2~docnumber IS NULL.  (the record is missing in table2)
Note: ABAP gives an error and wants me to use the Having Clause, which is ok, but then ABAP wants me to use Group By, which ok, but then I still get the same syntex error.
Any thoughts on doing this with the outer join and is null options.  I do not want to select into two internal tables and compare them.

All,
I am not trying to do a subquery.  Just a simple outer join where I know some records are missing in the second table.
Here is the code:
select eban~banfn
into table i_delay_banfn
from eban
left outer join zsmt_prdelay_upd
on eban~banfn = zsmt_prdelay_upd~banfn
where zsmt_prdelay_upd~banfn IS NULL.
Here is the error message:
No fields from the right-hand table of a LEFT OUTER JOIN may appear in
the WHERE condition: "ZSMT_PRDELAY_UPD~BANFN".
select eban~banfn
into table i_delay_banfn
from eban
left outer join zsmt_prdelay_upd
on eban~banfn = zsmt_prdelay_upd~banfn
having zsmt_prdelay_upd~banfn IS NULL.
Please use code tags
Edited by: Rob Burbank on Mar 5, 2009 12:20 PM

Similar Messages

  • How do u find old entries on your calender

    How do you find old entries on your calender

    Settings > Mail, Contacts, Calendars.
    Scroll down to Calendars and select how far back you want items.

  • Logic to find missing entries

    Hello all...i'm new to abap programming and i had a small doubt regarding a logic.
    The logic is to obtain missing entries from 2 internal tables by comparing them.
    for ex tab1 may contain some entries not present in tab2 and vice-versa.
    i want to accomplish this by using only two loops i.e. nested loops. is it possible? pls let me know!
    Regards,
    Rahul
    Message was edited by:
            Rahul Khanna

    the following code will just provide you with logic,
    imagine the two tables to be itab1 and itab2
    and itab3 will have the mismatched values,
    see carefully the steps used for code optimization,
    the loop is processed only once
    REPORT  ZTRIP_TEST.
    data: itab1 like table of lfa1 with header line,
    itab2 like table of lfa1 with header line,
    itab3 like table of lfa1 with header line. "Table to hold mismatch values
    data: line1 type i,
    line2 type i.
    describe table itab1 lines line1.
    describe table itab2 lines line2.
    sort: itab1,itab2.
    if line1 ge line2.
      loop at itab1.
        read table itab2 with key lifnr = itab1-lifnr binary search.
        if sy-subrc ne 0.
          append itab1 to itab3.
        else.
          delete itab2 where lifnr eq itab1-lifnr.
        endif.
      endloop.
      append lines of itab2 to itab3.
    else.
      loop at itab2.
        read table itab1 with key lifnr = itab2-lifnr binary search.
        if sy-subrc ne 0.
          append itab2 to itab3.
        else.
          delete itab1 where lifnr = itab2-lifnr.
        endif.
      endloop.
      append lines of itab1 to itab3.
    endif.
    *Now itab3 will contain mismatched enteries
    Reward points if useful, get back in case of query...
    Cheers!!!
    Message was edited by:
            Tripat Pal Singh

  • Conditions on Outer Joined Tables

    I'm trying to understand how Discoverer handles conditions created on outer joined tables. We're using Discoverer Plus 11.1.1.3.
    I have a query using two tables connected by an outer join. While I want all records back from the first table, I don't want all records back from the outer joined table. So, if I typed the SQL directly in a SQL Editor, I would put the '(+)' in each condition. However, I find that in Discoverer, sometimes it does this, and sometimes it doesn't. If it does not put the '(+)' on all conditions as well as the join, that essentially nullifies the outer join and makes it an standard join.
    For example, I expanded an item on the outer joined table in the Items dialog to see its list of values, and selected one, to add the column to the worksheet and create a condition. No (+). But when I deleted this and created the condition using the Condition dialog, I got a (+). Then I created another condition using the condition dialog. I used the IN operator and pasted in a list (this item had no item class to choose from)--no (+).
    When I tried manually adding (+) after the item name in the condition dialog, it put quotes around the whole thing and treated it as a string.
    I can find nothing in the documentation that discusses this. Is is possible to control whether or not it uses the (+)?
    Thank you, Scott Newman

    Dear Michael,
    Last night I had a call from user who was experiencing a very strange behaviour of her Discoverer workbook.
    I replicated the issue on my machine and could not believe my eyes. A condition on an item was being ignored. I then analysed the workbook and realised it was due to a condition on an item from an outer-joined folder. I did not have the strength after a long day to deal with it and was looking forward to having some fun the next day. Firstly, I tried few tricks such as NVL, LENGTH functions in a test query in Toad. I hate to give up but I did and searched threads on this forum and opened few. The very first thread I read was this one and I laughed when I read your advice. Only until the moment I tested it in the troubled workbook. It worked like a charm. I take my hat off to you Michael. I have rarely experienced such a satisfaction when solving a tricky problem during my 9-year-long Oracle Discoverer journey. This goes straight to my little text file with interesting problems and solutions.
    Thank you very much. I owe you a beer or two.
    It is great to have an expert like you, always ready to share his knowledge with his colleagues.
    P.S.
    My apologies for this massive post, I could not resist expressing my joy and gratitude.
    Jozef Hlavaty

  • Illegal selection by InfoObject from outer join table

    Hi all,
    in any infoset with left-outer-join, when i want to select any field (infoobject) to get exlude conditions i got these errors:
    illegal selection by InfoObject from outer join table.
    error reading the data of infoprovider '*'.
    thanks in advance .
    HS

    Hi Dorota,
    Choudhary S was right.
    İ have notified the SAP about this issue..they wrote me below note :
    As SAP tables have no concept for NULL, we
    have to restrict this condition to not allow excluding condition to be
    used any more. But alternatively, you could use including to replace it.
    Please check my last reply to see the detailed reason for it, and
    this explaination is from our development colleagues.
    For this note 1435772, you could also see why this error message
    arises.
    So, they said it is not possible in case of left outer join after those patches.
    i just used  include to replace that exluding condition.it takes little time but the problem is solving.
    Thanks
    HS

  • Find missing entries

    Hi,
    I have a table that contains several names like along with some other information.
    alpha1
    alpha2
    beta2
    gamma1
    gamma2
    I wanted to know about some of these entries, so I did a select like this.
    select * from t
    where t.name in ( 'alpha1', alpha2', 'beta1', beta2', 'gamma1', gamma2')
    Now if you look at the data above you will see that beta1 is missing, so obviously the above query does not fetch information about beta1.
    Is there a way to find the missing entries like this through SQL.
    I have a restriction here. I have a readonly access to the database. I log in as schema2 and look at data in schema1. Moreover since this is a production database, I would not like to create any temporary tables in schema2 either. So, any solution has to use only select statements and no DML/DDL.
    Thanks in advance,
    Rajesh

    Hi All!
    2 kuljeet pal singh
    SQL> select * from a2
    SQL> /
    NAME
    alpha
    beta
    delta
    epsilon
    (Missing gamma)
    What show your procedure?
    2 Rajesh
    The temporary table i think is the best solution.
    SELECT * FROM TEMP_TAB_NAME;
    NAME
    alpha
    beta
    gamma
    delta
    epsilon
    SELECT * FROM TEMP_TAB_NAME a
    WHERE NOT EXISTS (SELECT 1 FROM PROD_TABLE_NAME B
    WHERE B.COL_NAME = A.NAME);
    You can use following SQL*Plus script:
    set echo off
    set ver off
    set fee off
    set serveroutput on
    declare
    type tp is varray (30) of varchar2(30);
    tp_tab tp := tp('alpha', 'beta', 'gamma', 'delta');
    var varchar2(30);
    cnt number;
    num number;
    begin
    cnt := tp_tab.count;
    for i in 1..cnt loop
    var := tp_tab(i);
    select count(*)
    into num
    from PROD_TABLE_NAME
    where COL_NAME = var;
    if num = 0
    then
    dbms_output.put_line('Missing '||var);
    end if;
    end loop;
    end;

  • How to avoid duplicated rows using the outer join

    Hi everybody,
    I have the following query:
    select a.usr_login, b.ugp_rolename, b.ugp_display_name from
    (select usr.usr_login, usr.usr_key, usg.ugp_key from usr,usg
    where usg.usr_key = usr.usr_key
    and usr.usr_login IN ('C01015','C01208')) a,
    (select ugp.ugp_key, ugp.ugp_display_name from ugp
    where ugp.ugp_rolename LIKE 'B-%') b
    where a.ugp_key = b.ugp_key (+)
    The first query 'a' has the following result:
    usr_login <space> usr_key <space> ugp_key
    C01015 <space> 49 <space> 565
    C01015 <space> 49 <space> 683
    C01015 <space> 49 <space> 685
    C01015 <space> 49 <space> 3
    C01208 <space> 257 <space> 3
    The usr_login on table usr is the primary key, and as you can see above, for each usr_login I can find one ore more ugp_key on the table usg.
    The query 'b' gives the list of all the usr_login's roles which have the name LIKE 'B-%' (it means '*Business Roles*'), and all the respective role's key (ugp_key)
    So, when I join the query 'a' with the query 'b', I expect to find for every usr_login the respective ugp_display_name (the Business Role name).
    Because the query 'b' contains ONLY the ugp_keys of the Business Roles, when I execute the complete query, this is the result:
    usr_login <space> ugp_rolename <space> ugp_display_name
    C01015 <space> BK005 <space> TELLER 1
    C01015 <space> BK003 <space> TELLER 2
    C01015 <space> null <space> null
    C01015 <space> null <space> null
    C01208 <space> null <space> null
    As you can see, with the outer join I obtain the Business Name (ugp_display_name) for each occurrence (and I have 2 rows duplicated with 'null' for the usr_login C01015); This beacuse the query 'b' doesn't have the two ugp_keys 685 and 3.
    Instead I'd like to have the following result:
    usr_login <space> ugp_rolename <space> ugp_display_name
    C01015 <space> BK005 <space> TELLER 1
    C01015 <space> BK003 <space> TELLER 2
    C01208 <space> null <space> null
    deleting ONLY the duplicated rows with null, when the usr_login has already at least one ugp_display_name not null.
    For example:
    1) The usr_login 'C01015' has 2 Business Roles (with ugp_key = 565 and 683) and other 2 not-Business Roles (with ugp_key = 685 and 3) --> I want to see ONLY the 2 records related to the Business Roles
    2) The usr_login 'C01208' has only one not-Business Roles (with ugp_key = 3) --> I want to see the record related to the not- Business Role
    Practically:
    1) When a usr_login has one or more Business Roles and other not-Business Roles , I'd like to see ONLY the records about the Business Roles (not the records with 'null','null')
    2) When a usr_login doesn't have Business Roles, I'd like to see the records about the same usr_login with 'null','null'
    This, because I need to show both usr_logins: with and without Business Roles.
    Anybody has any suggestions ? Any help will be appreciated.
    Thanks in advance for any help !!
    Alex

    Hi, Alex,
    So you want to display rows from a where either
    (1) the row has a match in b, or
    (2) no iwith the same usr_login has a match.
    Here's one way to do that:
    WITH     a     AS
         SELECT  usr.usr_login, usr.usr_key, usg.ugp_key
         FROM      usr
         ,     usg
         WHERE      usg.usr_key     = usr.usr_key
         AND     usr.usr_login     IN ('C01015','C01208')
    ,     b     AS
         SELECT  ugp.ugp_key, ugp.ugp_display_name
         FROM      ugp
         WHERE     ugp.ugp_rolename     LIKE 'B-%'
    ,     got_match_cnt     AS
         SELECT     a.usr_login, b.ugp_rolename, b.ugp_display_name
         ,     b.ugp_key
         ,     COUNT (b.ugp_key) OVER (PARTITION BY  a.usr_login)     AS match_cnt
         FROM      a
         ,     b
         WHERE     a.ugp_key     = b.ugp_key (+)
    SELECT     usr_login, ugp_rolename, ugp_display_name
    FROM     got_match_cnt
    WHERE     ugp_key          IS NOT NULL     -- Condition (1)
    OR     match_cnt     = 0              -- Condition (2)
    ;If b.ugp_rolename or b.ugp_display_name can not be NULL, then you could use that just as well as b.ugp_key for testing condition (1).
    By the way, you don't need sub-queries for a and b; you can do all the joins and all the filtering (except conditions (1) and (2)) in one query, but the sub-queries aren't hurting anything. If you find the separate sub-queries easier to understand, debug and maintain, then, by all means, keep them.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.

  • How to understand the way OBIEE implements outer joins?

    Hello guys
    I have a few scenarios where I have to implement outer joins and inner joins between dimensions and facts..
    There are 2 ways as far as I know that allows me to implement outer joins in BMM layer.
    1, Join the Logical dim table A to Logical Fact table B using outer join. The modeling will look like the below:
    A Dim ---outer------B fact -----------inner----C Dim
    By this design, the query that selects columns from all 3 tables will look at this:
    select columns from ((B fact inner joins C on key1 = key2) left outer joins on A dim) on key3=key4)..
    2, Join logical dim table A to fact table B inside the LTS of fact B by mapping the LTS B to dim A using outer join. then join fact B to C:
    B fact (mapped to fact B outer join Dim A) ------------inner -------C dim
    By this design, the query that selects columns from all 3 tables will look at this instead:
    select columns from C, B left outer join A on key1=key2 where key3=key4
    Comparing these 2 queries, the first one seems to do inner joins first and then outer join the result set to Dim A, the second query seems to outer join Dim A first and the result set inner joins to Dim C..
    I ran the same report using these 2 different designs, and the data comes out very different. The report of the first query is much smaller than the report of the second query...
    Can anyone help me understand how OBIEE understands outer joins? The second query is so far giving the right result, however, I can't get rid of the outer join in the query even if not selecting columns from Dim A, which is impacting the performance of other reports without Dim A.
    Your inputs will be greatly appreciated
    Thanks
    Edited by: user7276913 on Apr 20, 2010 9:31 AM
    Edited by: user7276913 on Apr 20, 2010 9:31 AM

    Xcode is the IDE.
    Objective-C is the language typically used.
    There's lots of getting started stuff at https://developer.apple.com

  • How to edit one particular entry in custom database table

    Hi all,
    I want edit one particular entry in custom database table with or without a program.
    1.   I tried using SE16N and &SAP_EDIT but im unable to get entries to edit.
    2.   I tried using '/h' and 'code = edit' but it is prompting me to delete an entry but not edit.
    3.   I tried using modify statement. But in vain.
    I tried this statements through programatically,
                            MODIFY itab FROM wa_itab TRANSPORTING  zabc.
                            MODIFY zsample_02 FROM itab.
    please suggest with out writing a program, if possible.

    Hi ,
    Try with FM SE16N_INTERFACE.
    1 .Go to SE37
    2. Enter FM SE16N_INTERFACE and execute
    3. Give table name in Itab,
    I_EDIT                  =   
    X
    I_SAPEDIT             =    
    X
    4. Press F8
    5. Edit table entries and save.
    Thanks

  • How to have a condition with the outer join

    Hi, I'd like to know if, inside a report, there's a way to create a condition which include in some way an outer join.
    So, I have 2 custom folders:
    Tickets with 2 fields: Ticket_id, Inventory_item_id, category_id and iptv_sumptom
    Hierarchy with 4 fields: Symptom, Inv_item_id, Category_id and Group
    These 2 folders are joined in this way
    Tickets.inventory_item_id = Hierarchy.inv_item_id (+) AND Tickets.category_id = Hierarchy.category_id (+) AND Tickets.iptv_sumptom = Hierarchy.Symptom (+)
    Now, from the report I have a parameter based on the field Group to restrict dataset of the tickets.
    ...but when I choose a group and I run the report, the conditions inside the plsql query generated is like this
    WHERE (Tickets.inventory_item_id = Hierarchy.inv_item_id (+) AND Tickets.category_id = Hierarchy.category_id (+) AND Tickets.iptv_sumptom = Hierarchy.Symptom (+)) AND Hierarchy.Group = 'A'
    where the last condition is WITHOUT outer join !
    I need to have also the outer join on the Hierarchy.Group: AND Hierarchy.Group (+) = 'A', but from the Administrator I don't want to add another join with (+) for the Group. From Plus I didn't find any way to write (+).....
    Anybody knows another method or workaround to have also a filter (the condition Hierarchy.Group = 'A') with an outer join ?
    Thanks in advance
    Alex

    Hi,
    A workaround can be either use new objects or modify the existing ones to avoid the outer join.
    In order to do that you can add a dummy record to each custom folder and then join by it.
    For example if you will add to the
    Tickets will be:
    select Ticket_id, Inventory_item_id, category_id, iptv_sumptom
    from......
    union all
    select -1,-1,-1,'Some value' from dual
    And hierarchy will be:
    select Symptom, Inv_item_id, Category_id ,Group
    from......
    union all
    select 'Some value',-1,-1,'Some value' from dual
    Now you can create a full join between them without the need to outer join.
    Hope it will help
    Tamir

  • Issues with limit/filter on outer join table in BQY

    I'm converting a series of BQY's from Brio 6.6 to Hyperion 9.3. I have some questions about the "use ODBC outer join syntax on limits" option in the OCE. I sort of understand this option's purpose, but I don't completely understand the SQL I'm seeing. For example Brio 6.6 is generating the following SQL statement:
    SELECT * FROM tblA AL1 LEFT OUTER JOIN tblB AL38 ON (AL38.ParentID=AL1.ChildID AND
    AL38.Data='SomeData') WHERE ((NOT AL38.Action IS NULL))
    Now, Hyperion 9.3 generated the SQL statement as follows:
    SELECT * FROM tblA AL1 LEFT OUTER JOIN tblB AL38 ON (AL38.ParentID=AL1.ChildID AND
    AL38.Data='SomeData') AND (NOT AL38.Response IS NULL))
    My questions are:
    1) Why isn't the "NOT AL38.Action IS NULL" statement included in the outer join in Brio? My limited understanding of the "use ODBC outer join syntax on limits" seems to indicate that it should end up there. I want the SQL to look like this, but I don't know why Brio generates this SQL.
    2) How can I get Hyperion to generate the same SQL as Brio? And still use the OCE with "use ODBC outer join syntax on limits" selected?

    Setting the Cardinality of Department > Employee role to OptionalOne
    gives rise to cartesian join (which is a bigger issue).
    Therefore, the Cardinality of Department > Employee role should remain as
    OptionalMany (default).
    This means, the outer join problem still remains unsolved. I have, therefore,
    unmarked the above answer by me.
    The question is - why has Report Builder been designed in such a way that the primary entity is always the child entity when attributes are selected from both parent and child entities?
    Most people desire that all the rows of the parent entity be fetched irrespective of whether there are corresponding rows in the child entity or not. Report Builder tool should not dictate what the user wants to get, meaning it is not right to assume
    that the focus of the report is Employee when attributes are selected from both Department and Employee. Report Builder should not make the child entity (i.e., Employee) as the primary entity when the user selects attributes from the child entity after
    having selected attributes from the parent entity.
    I am sorry to say that clients may not accept the Report Builder tool as this does not fetch the records as desired.
    I hope there is someone who can suggest how the outer join problem can be solved by just tweaking the properties of the report model (SMDL).
    Besides, the end users are business users and are not tech savvy. They are not expected to modify queries. They would simply drag and drop attributes from entities to create adhoc reports.

  • How to convert maintenance view 'v_t001k_assign' to inner join tables

    Dear friends,
    I found I could not select the fields of view 'v_t001k_assign' using SQL, and I found there are some tables joined together as below:
    T001     MANDT     =     T001K     MANDT
    T001     BUKRS     =     T001K     BUKRS
    T001K     MANDT     =     TASSIGN_MM_T001W     MANDT
    T001K     BWKEY     =     TASSIGN_MM_T001W     BWKEY
    T001W     MANDT     =     TASSIGN_MM_T001W     MANDT
    T001W     WERKS     =     TASSIGN_MM_T001W     WERKS
    T001W_EXT     MANDT     =     TASSIGN_MM_T001W     MANDT
    T001W_EXT     WERKS     =     TASSIGN_MM_T001W     WERKS_EXT
    So how to convert this maintenance view 'v_t001k_assign' to inner join tables for SQL selection?
    Thanks a lot!
    Edited by: Qiwei Yin on May 27, 2009 10:35 AM

    Hi,
    You should use the 'Search help exit' to select the data for yourself from the database. Go into the search help maintenance screen and press F1 on field 'search help exit'; follow the links. There is actually a pretty good documentation.
    Regards, Gerd Rother

  • How do I find missing/lost bookmarks I tried the trouble shooting section i just couldn't figure it out

    I had a bookmark folder & decided to add two more. When I went to my folders I could only find one new folder. When I clicked on it, it brought me to the second new folder. I couldn't get all three to appear under the bookmarks section. I retitled them because two of the three bookmarks had the wrong bookmarked items & then I lost the third, which had all the original bookmarks.
    I've tried your trouble shooting section, I don't understand all of the information. I have been through the trouble shooting section several times trying different options. I've gotten myself so frustrated & confused :( I'm hoping for a little one on one help.
    Thank you so much

    <u>First steps read the articles & do the following</u>
    # manually backup your current bookmarks (as they are now)<br> see [[Restore bookmarks from backup or move them to another computer]]
    #locate your profile, backup your bookmarks backups folder and the files it contains. See <br /> [[Profiles - Where Firefox stores your bookmarks, passwords and other user data#w_how-do-i-find-my-profile]]'''_how-do-i-find-my-profile'''
    *also see http://kb.mozillazine.org/Profile_folder_-_Firefox#Folders
    * put the new backups somewhere safe; outside any Firefox or profile paths
    <u>Now look at what you have and keep the best ones</u> <br />
    There are limits to what may be restored, depending on what you have done and deleted, but once you have taken the action above you have preserved whatever is there.
    You can now try restoring any of the automated backups that Firefox has made for you (By default each of the last ten days). But take CARE any restore overwrites and destroys existing ones (unless it is from an HTML file then it is appended ). Always backup by exporting before you do a restore.
    You may restore from any backup you have made by exporting the current state, you are not limited to just the automated backups.
    Post back with how you get on and with any further questions.

  • How can i find missing backup on Time Machine (for Mac)?, How can i find missing backup on Time Machine (for Mac)?

    I backed up my computer on August 8th 2010 with Time Machine. I'm absolutely certain I did. But some reason there's a gap. I have a backup of my computer from just before that date, and just after that date, but August 8th is missing.
    Is there any way to recover my files from this date? What's happening? It can't have started automatically deleting files because I have backups from as far back as June 2010 (when I started using time machine).
    Thank you

    See:
    A  whole  lot  about  Time  Machine for help with TM problems.  Also you can select Mac Help from the Finder's Help menu and search for "time machine" to locate articles on how to use TM.  See also Mac 101- Time Machine.

  • How do you find missing titles, effects, and generators in final cut pro x?

    Actually, that's only one of two questions...
    ONE
    When I attempt to export a movie, uncompressed, not through Compressor and not sharing to an Apple device, I get an error saying my Project has "missing or offline titles, effects, or generators."
    There is a little yellow warning triangle next to the project name.
    But there are no little yellow warning triangles next to anything in my libraries, and everything plays through in the Timeline.
    Before exporting, how can I identify the supposedly missing elements???
    TWO
    After attempting to export the same movie via the Share item to an iiPhone, i received a Quicktime Error: -50.
    Interpretation, please?

    I recently added a new plugin (mObject) and was experimenting with it. I decided to create a "temporary" library on my root drive since it's the fastest in my setup. I prefer to have major files like the library at the top level of my drives, and for the internal drive, that's outside my User folder. That's when all the trouble started.  I would manually start a render and FCPX would not stop... would not completely render the clip... I would get "dashed" orange render lines over the clip. The only way to stop the rendering was to add something new to the storyline (that includes going into background tasks and trying to stop or pause the rendering from there!)  Once I moved the library back into my user folder (and inside Movies), all the rendering problems stopped.
    The only connection I can make is that FCPX is getting hung up on user permissions and the "current user". A lot of these issues started when I upgraded to a new iMac and restored all my old software (from the previous iMac) from Time Machine. It made me alter my user name for the new machine and I had some segments on this new machine with the older user permissions which I had to manually change to the new username in many cases.
    If you have strict (user only) permissions on your RAID, try loosening them or make sure that you add your username to the list with read/write permissions. (? perhaps.)

Maybe you are looking for