Abap query, join between same tables

Hi,
I have an Abap Query (SQ01), I need to create a join between the same table (ESLL-ESLL) to obtain the services from a PO. The join is with the packno from ESLL to subpackno from ESLL (the same table). But I don't know how I can do that with Abap Query. Because the Infoset doesn't allow inserting the table two times.
Somebody can help me.
Thanks.
Victoria

Hi:
I was able to create a query to retrieve the service lines entries using tables ESSR (Header) (service entry sheet number as input parameter), linked to package number to view ML_ESLL and then from the view the sup-package number linked to ESLL. That way I was able to retrieve all the service lines information from table ESLL only using SQ02 and SQ01, no ABAP.
I Hope this help.
Juan
PS: I know the post is old but may be there are people out there with no ABAP access who needs to create reports for Service Entry Sheets lines. All the join conditions are.
Table             Table
ESSR            EKKO
ESSR            ML_ESLL
ML_ESLL      ESLL
ESLL             ESLH
Edited by: Juan Marino on Jan 23, 2012 10:53 PM

Similar Messages

  • Need Query - join in same table

    I need query for following criteria,
    Table : test
    No     Order
    1     a
    1     b
    1     c
    2     a
    2     b
    2     d
    3     e
    3     f
    3     g
    3     h
    1     f
    2     f
    Consider the above table,
    1)     I will give input order as a,b: It should return No 1,2
    No     Order
    1     a
    1     b
    1     c
    2     a
    2     b
    2     d
    3     e
    3     f
    3     g
    3     h
    1     f
    2     f
    2)     I will give input order as f,g,h: It should return No 3
    No     Order
    1     a
    1     b
    1     c
    2     a
    2     b
    2     d
    3     e
    3     f
    3     g
    3     h
    1     f
    2     f
    Please give me the query which will give above result.
    Thanks

    I am not sure I understand you, but it may be this
    with test as (
    select 1 N, 'a' Ord from dual union all
    select 1,'b' from dual union all
    select 1,'c' from dual union all
    select 2,'a' from dual union all
    select 2,'b' from dual union all
    select 2,'d' from dual union all
    select 3,'e' from dual union all
    select 3,'f' from dual union all
    select 3,'g' from dual union all
    select 3,'h' from dual union all
    select 1,'f' from dual union all
    select 2,'f' from dual )
    select N from test tp where Ord = 'a'
    intersect
    select N from test tp where Ord = 'b';
    with test as (
    select 1 N, 'a' Ord from dual union all
    select 1,'b' from dual union all
    select 1,'c' from dual union all
    select 2,'a' from dual union all
    select 2,'b' from dual union all
    select 2,'d' from dual union all
    select 3,'e' from dual union all
    select 3,'f' from dual union all
    select 3,'g' from dual union all
    select 3,'h' from dual union all
    select 1,'f' from dual union all
    select 2,'f' from dual )
    select N from test tp where Ord = 'f'
    intersect
    select N from test tp where Ord = 'g'
    intersect
    select N from test tp where Ord = 'h';

  • Sq02: define join between 2 tables as per your choice

    Hi Team,
    I am trying to create a join between 2 tables ekko & Lfa1. The sq02 tcode by default is joining it as
    ekko-lblif = lfa1-lifnr in ecc 6.0
    While in 4.7 i found that the same joint exists as
    ekko-lifnr = lfa1-lifnr.
    I want to create the joint as ekko-lifnr = lfa1-lifnr.
    Can i do it ?
    Please advice.

    yes you can.
    right click on the default link and delete it.. then start dragging from EKKO-LIFNR field to LFA-LIFNR. it will work.

  • Subject: How to do join between two tables using something like SE16

    SE16, SE11 provide form based interface query information from a single table. Is there a way to do join between two tables without creating an infoset erc? I am looking for something similar to sql join but in SAP BI 7.0
    Thanks.

    Hi
    Pls look into below links. Hope this helps you.
    1. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45bf455611d189710000e8322d00/content.htm
    2. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45a5455611d189710000e8322d00/content.htm
    Regards
    Sirigiri

  • How to provide joins between oracle tables and sql server tables

    Hi,
    I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server.
    how to provide joins between oracle tables and sql server tables ? Any help on this
    Regards,
    Malli

    user10675696 wrote:
    I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server. Bad idea most times. Heterogeneous joins do not exactly scale and performance can be severely degraded by network speed and b/w availability. And there is nothing you can do in the application and database layers to address performance issue at the network level in this case - your code's performance is simply at the mercy of network performance. With a single glaring fact - network performance is continually degrading. All the time. Always. Until it is upgraded. When the performance degradation starts all over again.
    If the tables are not small (few 1000 rows each) and row volumes static, I would not consider doing a heterogeneous join. Instead I would rather go for a materialised view on the Oracle side, use a proper table and index structure, and do a local database join.

  • [nQSError: 14044] Missing join between logical tables

    Hi All,
    I have three physical tables:
    A- Dimension (Contact) B- Helper (Con-Prod) C- Dimension (Product). 'A' joins to facts.
    Relationships are:
    A:B=1:M and B:C=N:1
    Currently a column of B table has been implemented as MLOV. As a result now I have one additional MLOV physical table 'D' that joins to 'B' (Since its B.MLOV_WID=D.MLOV_WID , its not a foreign key join).
    The Logical Layer has three Logical tables: A, B and C as in the Physical Layer. B table has got one new LTS for 'D'.
    Now the Problem is when I take a column that is sourced from D and another from C, it generates an error in Answers: Missing join between logical tables B and C. I have verified that the Logical and Physical joins exist.
    I think this is something with the Logical level setup. So here's some more information on hierarchy setup. I have one Hierarchy (Contact) for all those Logical tables. I have setup Level for the MLOV column. I don't have level setup for most of the non-MLOV columns.
    Can you please share your thoughts? I would like to avoid implicit join method.

    Hi,
    It seems like you are pulling a report from 2 tables with NO physical join.
    Please check the physical layer diagram and join the 2 tables.
    Thanks,
    Vineeth

  • Outer join between logical tables

    Hello,
    This question is likely to be asked many times, but I failed to find the proper thread in the forum.
    Assume there are 2 logical tables "Fact" and "Dim".
    "Fact" has 1 LTS which consists of physical tables F, FX1, FX2 which are inner joined.
    "Dim" has 1 LTS which consists of physical tables D, DX1, DX2 which are inner joined.
    F and D tables are also joined together on physical layer.
    I define left outer join between "Fact" and "Dim" on logical layer.
    I create a request in Answers, querying columns from "Fact" and "Dim" which map to physical tables F and D only.
    I expect OBIEE to build SQL query which uses F and D tables only, outer joined.
    Instead of that all the physical tables used for logical tables "Fact" and "Dim" are joined together in a form like:
    SELECT F.col, D.col
    FROM (F inner join FX1 inner join FX2) left outer join (D inner join DX1 inner join DX2)
    Is there any way to avoid this behavior or build data model in different way?
    Thank you!

    Hi Alex,
    In BI Applications you never have a null in a facts foreign key to the dimension. Instead there is always a zero row wi record inserted with 'Unspecified' in all the columns. When the fact table is populated in the ETL, if the fact record doesn't have a corresponding dimension record the WID is poulated with zero.
    This removes the problems with outer joins and helps considerably with performance.
    This could be one practice you take from BI Apps and put into your own ETL's and data model.
    Regards
    Robin

  • Multiple foreign key joins between two tables

    Hi,
    I have a question about building a repository.
    I have a date dimension and one fact. The fact table has about 10 foreign key columns that link to the date Dimension.
    In this case should I create 10 aliases to create joins in the Physical and BMM layer or is there any other way to handle this situation.
    I am asking this question because 10 aliases can get very confusing for me at the later point of time while creating reports.
    Using OBIEE 10.1.3

    Hi
    I have a follow up question on this.
    I am okay with not seeing the different date tables under the Subject area. Even if it just shows a it as a Simple DATE Dimension I am good with it.
    In this case which is the efficient way, creating 10 aliases or creating 10 joins in the physical layer. I just figured out that we can create multiple joins between the same set of two tables but do not know how will that effect the way BI server works.
    Please help me in understanding this concept.
    thanks
    This request id for OBIEE 10.1.3

  • Join between 2 tables

    All,
    I am newbie to this forum.
    A main query has a table say A along with other tables in a query. My requirement is to add a new table say D to fetch the records in the below fashion...
    take grant_num from table A and join grant_num with table D and take deu_grant_num from same table D...Pass deu_grant_num from table D to table A and fetch the results with respect to the grant_num from table A...
    Below are the table structures:
    table A:
    User_id, grant_num,...
    Table B:
    grant_num, deu_grant_num, user_id...
    Appreciate ur help ASAP...

    Try This Query
    cursor abc is select grant_num from tableA
    where grant_num in(select grant_num from tableB
    where tableA.grant_num =tableB.grant_num)
    begin
    open abc;
    ftech abc into :grant_num ;
    close abc;
    end;
    or
    select grant_num into grant_num from tableA
    where grant_num in(select grant_num from tableB
    where tableA.grant_num =tableB.grant_num)

  • How To Find joins between siebel tables

    Hi Experts,
    I am new in siebel and i am working on BI reports.
    I need to write queries to fetch data from sibel database.
    Any idea how do we find joins between table in siebel. Is there any user guide??
    Cheers,
    Andy

    Hi Andy,
    We can find Joins in Object Explorer. Expand the Business Component Object in Object Explorer and you can find Join. In Siebel generally we use only Equi Joins. ROW_ID of parent table will be stored in PAR_ROW_ID of child table. ROW_ID and PAR_ROW_ID are the columns of the table. Most of the tables have these two columns.
    For Example: Take two tables S_CONTACT AND S_CONTACT_X, the ROW_ID of S_CONTACT will be stored in PAR_ROW_ID of S_CONTACT_X table.
    If you want to join these two tables the query will be like
    "SELECT * FROM S_CONTACT CON, S_CONTACT_X CONX WHERE CON.ROW_ID = CONX.PAR_ROW_ID"
    This query will return all the records from S_CONTACT_X which matches S_CONTACT table.
    Thanks & Regards,
    Vinodhkumar

  • Doubt on creating join between  two tables

    Hi friends,
    I have two tables , ekes and eine
    my requirement is  if Ekes-ebtyp = 'X1'.
    then Ekes-ebtyp = EKES-EINDT + Eine-j_3alitra.
    the doubt is there is no primary key common between this table . actually in my whole program for purchase order i used EBELN for extracting details when two tables are involved . in this two tables no two primary keys are common to extract data ...is there any ways please suggest..
    the code i wrote is
    loop at li_ekes assigning <fl_ekes>.
    read table li_eine assigning <fl_eine> with table key (here i need to give some unique fields to join these two fields please guide me which field i can use.).
    <fl_ekes>-ebtyp = <fl_ekes>-EINDT + <fl_eine>-j_3alitra.

    Hi,
    Both tables have field EBELN in common.
    You can use it to extract data from both.
    Hope this helps.
    reward if helpful.
    Regards,
    Sipra

  • Query performance on same table with many DML operations

    Hi all,
    I am having one table with 100 rows of data. After that, i inserted, deleted, modified data so many times.
    The select statement after DML operations is taking so much of time compare with before DML operations (There is no much difference in data).
    If i created same table again newly with same data and fire the same select statement, it is taking less time.
    My question is, is there any command like compress or re-indexing or something like that to improve the performance without creating new table again.
    Thanks in advance,
    Pal

    Try searching "rebuilding indexes" on http://asktom.oracle.com. You will get lots of hits and many lively discussions. Certainly Tom's opinion is that re-build are very rarley required.
    As far as I know, Oracle has always re-used deleted rows in indexes as long as the new row belongs in that place in the index. The only situation I am aware of where deleted rows do not get re-used is where you have a monotonically increasing key (e.g one generated by a seqence), and most, but not all, of the older rows are deleted over time.
    For example if you had a table like this where seq_no is populated by a sequence and indexed
    seq_no         NUMBER
    processed_flag VARCHAR2(1)
    trans_date     DATEand then did deletes like:
    DELETE FROM t
    WHERE processed_flag = 'Y' and
          trans_date <= ADD_MONTHS(sysdate, -24);that deleted the 99% of the rows in the time period that were processed, leaving only a few. Then, the index leaf blocks would be very sparsely populated (i.e. lots of deleted rows in them), but since the current seq_no values are much larger than those old ones remaining, the space could not be re-used. Any leaf block that had all of its rows deleted would be reused in another part of the index.
    HTH
    John

  • Sql query with multiple joins to same table

    I have to write a query for a client to display business officers' names and title along with the business name
    The table looks like this
    AcctNumber
    OfficerTitle
    OfficerName
    RecKey
    90% of the businesses have exactly 4 officer records, although some have less and some have more.
    There is a separate table that has the AcctNumber, BusinessName about 30 other fields that I don’t need
    An individual account can have 30 or 40 records on the other table.
    The client wants to display 1 record per account.
    Initially I wrote a query to join the table to itself:
    Select A.OfficerTtitle, A.OfficerName, B.OfficerTitle, B.OfficerName, C.OfficerTtitle, C.OfficerName, D.OfficerTitle, D.OfficerName where A.AcctNumber = B.AcctNumber and A.AcctNumber = C.AcctNumber and A.AcctNumber = D.AcctNumber
    This returned tons of duplicate rows for each account ( number of records * number of records, I think)
    So added
    And A.RecKey > B.RecKey and B.RecKey > C. RecKey and C.RecKey . D.RecKey
    This works when there are exactly 4 records per account. If there are less than 4 records on the account it skips the account and if there are more than 4 records, it returns multiple rows.
    But when I try to l join this to the other table to get the business name, I get a row for every record on the other table
    I tried select distinct on the other table and the query runs for ever and never returns anything
    I tried outer joins and subqueries, but no luck so far. I was thinking maybe a subquery - if exists - because I don't know how many records there are on an account, but don't know how to structure that
    Any suggestions would be appreciated

    Welcome to the forum!
    user13319842 wrote:
    I have to write a query for a client to display business officers' names and title along with the business name
    The table looks like this
    AcctNumber
    OfficerTitle
    OfficerName
    RecKey
    90% of the businesses have exactly 4 officer records, although some have less and some have more.
    There is a separate table that has the AcctNumber, BusinessName about 30 other fields that I don’t need
    An individual account can have 30 or 40 records on the other table.
    The client wants to display 1 record per account.As someone has already mentioned, you should post CREATE TABLE and INSERT statements for both tables (relevant columns only). You don't have to post a lot of sample data. For example, you need to pick 1 out of 30 or 40 rows (max) for the same account, but it's almost certainly enough if you post only 3 or 4 rows (max) for an account.
    Also, post the results you want from the sample data that you post, and explain how you get those resutls from that data.
    Always say which version of Oracle you're using. This sounds like a PIVOT problem, and a new SELECT .... PIVOT feature was introduced in Oracle 11.1. If you're using Oracle 11, you don't want to have to learn the old way to do pivots. On the other hand, if you have Oracle 10, a solution that uses a new feature that you don't have won't help you.
    Whenever you have a question, please post CREATE TABLE and INSERT statements for some sample data, the results you want from that data, an explanation, and your Oracle version.
    Initially I wrote a query to join the table to itself:
    Select A.OfficerTtitle, A.OfficerName, B.OfficerTitle, B.OfficerName, C.OfficerTtitle, C.OfficerName, D.OfficerTitle, D.OfficerName where A.AcctNumber = B.AcctNumber and A.AcctNumber = C.AcctNumber and A.AcctNumber = D.AcctNumber Be careful, and post the exact code that you're running. The statement above can't be what you ran, because it doesn't have a FROM clause.
    This returned tons of duplicate rows for each account ( number of records * number of records, I think)
    So added
    And A.RecKey > B.RecKey and B.RecKey > C. RecKey and C.RecKey . D.RecKey
    This works when there are exactly 4 records per account. If there are less than 4 records on the account it skips the account and if there are more than 4 records, it returns multiple rows.
    But when I try to l join this to the other table to get the business name, I get a row for every record on the other table
    I tried select distinct on the other table and the query runs for ever and never returns anything
    I tried outer joins and subqueries, but no luck so far. I was thinking maybe a subquery - if exists - because I don't know how many records there are on an account, but don't know how to structure that
    Any suggestions would be appreciatedDisplaying 1 column from n rows as n columns on 1 row is called Pivoting . See the following link fro several ways to do pivots:
    SQL and PL/SQL FAQ
    Pivoting requires that you know exactly how many columns will be in the result set. If that number depends on the data in the table, then you might prefer to use String Aggregation , where the output consists of a huge string column, that contains the concatenation of the data from n rows. This big string can be formatted so that it looks like multiple columns. For different string aggregation techniques, see:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    The following thread discusses some options for pivoting a variable number of columns:
    Re: Report count and sum from many rows into many columns

  • Join between two tables in SAP ( actual sales vs budget sales)

    I have one table with  actual data sales in SAP .This table has a name   CE11000
    This table contain amounts about : customers ,Products, Quantity of Sales ,amount of sales ,month witch did the sales and the year.
    The other table from SAP has the budget sales . This table is CE21000
    This table contain the same fields : customers ,Products, Quantity of Sales ,amount of sales ,month witch did the sales and the year but all this for budget .
    In the budget table ( CE21000)there are no records for a particular make if it was not budgeted to make a sale.
    Sometimes i have the same problem with the actual data table (CE11000) ...I have not records witch can use to join the results for a report witch take the comparison between actual sales and budget sales.
    I would like to remind you that the report should have four "dimensions"
    a) year
    b) month
    c) customer
    d) type of product
    I try to use left outer join with a customer fields in two tables but i have  simultaneously the field with type of product .
    I want to see in one year (for example february of 2011)  for one customer the type of products (quantity and anmounts) witch buy (ACTUAL)  and that to  compare with the corresponding data if available
    Any help would appreciate
    thanks

    Haggar
    Your first query matches on two conditions BOTH being true. If there is a D and no matching E, you'll see the columns from D but none from E.
    Your second query takes all Emplyees, and lines up 2 (possibly different) rows from D against each
    E columns | D columns (match e.deptid=d.dept_id) | D columns (match ep_id=de_id)
    So you may have any mix of:
    E       | D1      | D2
    E       | nothing | D2
    nothing | D1      | D2
    E       | D1      | nothing
    E       | nothing | nothing
    nothing | D1      | nothing
    nothing | nothing | D2(NB I'm assuming FULL OUTER JOIN is commutative - ie the order is unimportant - but I may be wrong in which case the last row won't occur)
    You will get a different number of rows (as well as different columns) in each case.
    Try it!
    Regards Nigel

  • Left Outer Join on same table clarification

    HI,
    I have a table that gets populated from 3<sup>rd</sup> party system. We don’t have control over it. So, the table has master record (master) and children. Master type is 78 and children’s type is 64. So, it looks like this. In the 3<sup>rd</sup>
    party system, if Master transaction gets cancelled, it is recorded as type 178. If child is cancelled, then it is 164. Once the child is cancelled and created again using one process then newly created transaction will have 65 as type. Same thing with Master
    cancelled transaction also. It will be 79. So, to summarize:
    Master:                                                                                                                                                                      
    Brand New Transaction type = 78
    Cancelled Transaction type = 178
    Cancelled with creation transaction type = 79
    Child:
    Brand New Transaction type = 64
    Cancelled Transaction type = 164
    Cancelled with creation transaction type = 65
    I don’t have to bother about master records. I need to focus on only children for my query.
    ID
    TxnID
    Master
    Type
    TDate
    Location
    193075
    211554
    211543
    64
    20140805
    ABC
    193076
    211555
    211543
    64
    20140805
    NBC
    193077
    211556
    211543
    64
    20140805
    ABC
    193080
    211559
    211558
    64
    20140805
    ABC
    193081
    211562
    211561
    64
    20140805
    ABC
    193082
    211565
    211564
    64
    20140805
    CBC
    193083
    211565
    211564
    164
    20140805
    CBC
    193084
    211566
    211564
    65
    20140805
    AZC
    --drop
    table #Transactions
    CREATE
    TABLE #Transactions
    ID
    int,
    TxnID
    int,
    mstTicket
    int,
    Typecode
    int,
    Tdate
    datetime,
    Location
    varchar(10)
    select
    * from
    #Transactions
    Insert
    into #Transactions
    (ID,
    TxnID,
    mstTicket,Typecode,Tdate,Location)
    Select 193075, 211554,211543,64,'2014-08-05','ABC'
    UNION ALL
    Select 193076, 211555,211543, 64,
    '2014-08-05',
    'NBC' UNION ALL
    Select 193077, 211556, 211543, 64,
    '2014-08-05',
    'ABC' UNION
    ALL
    Select 193080, 211559, 211558, 64,
    '2014-08-05',
    'ABC' UNION
    ALL
    Select 193081, 211562, 211561, 64,
    '2014-08-05',
    'ABC' UNION
    ALL
    Select 193082, 211565, 211564, 64,
    '2014-08-05',
    'CBC' UNION
    ALL
    Select 193083, 211565, 211564, 164,
    '2014-08-05',
    'CBC' UNION
    ALL
    Select 193084, 211566, 211564, 65,
    '2014-08-05',
    'AZC'
    select
    T.TxnID,
    T.TypeCode,
    T.Location,
    TL.TxnID
    From
    #Transactions T
    Left Outer
    JOIN #Transactions
    TL ON
    TL.TxnID
    = T.TxnID
    and TL.TypeCode
    = 164
    select
    T.TxnID,
    T.TypeCode,
    T.Location,
    TL.TxnID
    From
    #Transactions T
    Left Outer
    JOIN #Transactions
    TL ON
    TL.TxnID
    = T.TxnID
    and TL.TypeCode
    = 164
    Where
    T.typecode
    in (64, 65)
    I need a clarification regarding left Outer Join. 
    In the first left outer join query both 64 and 164 both have TL.TxnID populated. Why is that?. What I understand from
    left outer join is that ‘Returns all the rows’ from left table and only matching data from right table.
    Here, matching row from right table is 211565 and 164 record (id 193083). So, only it should have TxnID populated. But row 211565 and 64 has TL.txnID getting populated (ID 193082).
    Why is it? Am I not understanding left out join properly?
    Thanks,

    Thank you Shailesh. I understood what join does in left outer join. I was thinking
     Left Outer JOIN #Transactions TL ON TL.TxnID = T.TxnID and TL.TypeCode = 164 is same as
    Left Outer JOIN #Transactions TL ON TL.TxnID = T.TxnID and TL.TypeCode = T.TypeCode
    and TL.TypeCode = 164
    #Transactions
    T
    Left
    Outer
    JOIN
    #Transactions
    TL
    ON
    TL.TxnID
    =
    T.TxnID
    and
    TL.TypeCode
    = 164
    Where
    T.typecode
    in
    (64,
    65)

Maybe you are looking for