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

Similar Messages

  • 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

  • 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

  • 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

  • SQL Join between two tables two columns, but the data in the join condition could be null.

    hello all,
    can anyone help me write an outer join b/n the two tables below. The joining condition has if's and or's.
    table 1 has 2 million rows, table 2 is very small
    TABLE1
    CUSTOMER_ID
    CITY
    STATE
    1
    SKOKIE
    IL
    2
    CHICAGO
    IL
    3
    CARY
    NC
    ERIE
    PA
    PHILLY
    PA
    CHARLOTE
    NC
    2 MILLION
    CITYXY
    STATEX
    TABLE2
    CITY
    STATE
    CONTACT
    IL
    OJO
    ERIE
    BRITT
    PA
    MIKE
    PITTSBURG
    PA
    HILTON
    N043
    TAT
    affi
    B
    affi
    R
    b0b
    Q
    b0b
    CHARLOTE
    NC
    b0b
    problem :: for all the data in table1, I need to find out the CONTACT from table 2 And the join condition would be as below
    1. either both TABLE1.CITY=TABLE2.CITY AND TABLE1.STATE=TABLE2.STATE and get CONTACT
    OR
    2. TABLE1.CITY=TABLE2.CITY AND TABLE2.STATE IS NULL  and get the value of CONTACT
    OR
    3. TABLE1.STATE=TABLE2.STATE AND TABLE2.CITY is null and get the value of CONTACT
    I need a query like this
    SELECT A.CUSTOMER_ID, A.CITY, A.STATE, B.CONTACT
    FROM TABLE1 A, TABLE2 B
    WHERE (join condition fitting in the 3 condition mentioned above)

    Dear OP,
    Do you want something like this?
    > with t1 as
    -- Start of SAMPLE DATA
    (select 1 CUSTOMER_ID, 'SKOKIE' CITY, 'IL' STATE from dual union
    select 2, 'CHICAGO', 'IL'  from dual union
    select 3, 'CARY', 'NC' from dual union
    select 4, 'ERIE', 'PA'  from dual union
    select 5, 'PHILLY', 'PA'  from dual union
    select 6, 'CHARLOTE', 'NC' from dual)
    t2 as
    (select null CITY, 'IL' STATE, 'OJO' CONTACT from dual union
    select  'ERIE', null, 'BRITT'  from dual union
    select null, 'PA', 'MIKE'  from dual union
    select 'PITTSBURG', 'PA', 'HILTON'  from dual union
    select 'N043', 'TAT', 'affi'  from dual union
    select null,'B', 'affi'  from dual union
    select null,'R', 'b0b'  from dual union
    select null,'Q', 'b0b'  from dual union
    select 'CHARLOTE', 'NC', 'b0b'  from dual
    --- END IF SAMPLE Data
    select * from t1 full outer join t2
    on ( nvl(t1.city,t2.city) = nvl(t2.city,t1.city)
    and nvl(t1.state,t2.state) = nvl(t2.state,t1.state) )
    order by 1,2,3,4
    CUSTOMER_ID CITY     STATE CITY      STATE CONTACT
              1 SKOKIE   IL              IL    OJO    
              2 CHICAGO  IL              IL    OJO    
              3 CARY     NC                           
              4 ERIE     PA    ERIE            BRITT  
              4 ERIE     PA              PA    MIKE   
              5 PHILLY   PA              PA    MIKE   
              6 CHARLOTE NC    CHARLOTE  NC    b0b    
                               N043      TAT   affi   
                               PITTSBURG PA    HILTON 
                                         B     affi   
                                         Q     b0b    
                                         R     b0b    
    12 rows selected
    Elapsed: 00:00:00.112
    Hope this is helpful. If not please let us know what is you desired result (sample) if your data was like above?
    vr,
    Sudhakar

  • Joins between two tables generating Cartesian product

    Hi All,
        I am facing an issue in my report in which, I am getting mismatch as the two subsets which I'm joining is resulting in a cartesian product of individual subset's results. I am doing left join to join those two subsets. Please help in resolving
    this issue. 
    Thank you,
    Anu.

    Hi,
    Can you please post your script to see what is causing the cartesian product?
    This way it is difficult to help you.
    Regards,
    Reshma
    Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered

  • Update Multiple Column with Single Command with Join between Two tables.

    This is our command where we are trying to update a table's two columns by pulling values from another table after joining. This query takes too much time to execute. Any suggestions ?
    UPDATE raw_alc_rmfscombinednew
    SET (BSC, CELL_NAME) =
    SELECT distinct raw_alc_R110combinednew.BSC, raw_alc_R110combinednew.CELL_NAME
    FROM raw_alc_R110Combinednew
    WHERE
    raw_alc_R110Combinednew.OMC_ID = raw_alc_rmfscombinednew.OMC_ID
    AND raw_alc_R110Combinednew.CELL_CI = raw_alc_rmfscombinednew.CI
    AND RAW_ALC_R110COMBINEDNEW.START_TIME = RAW_ALC_RMFSCOMBINEDNEW.START_TIME
    Results of Last execution:
    Elapsed Time (sec) 4,476.56
    CPU Time (sec) 4,471.88
    Wait Time (sec) 4.68
    Executions that Fetched all Rows (%) 100.00
    Average Persistent Mem (KB) 32.43
    Average Runtime Mem (KB) 31.59
    --------------------------------------------------------------

    Your update requires a full execution of the subquery for each row in the destination table (raw_alc_rmfscombinednew). Try rewriting as a MERGE. Tons faster.
    MERGE INTO raw_alc_rmfscombinednew  D
          USING ( SELECT distinct
                         BSC,
                         CELL_NAME
                         START_TIME
                    FROM raw_alc_R110Combinednew )  S
             ON (    S.OMC_ID     = D.OMC_ID
                 AND S.CELL_CI    = D.CI
                 AND S.START_TIME = D.START_TIME )
        WHEN MATCHED THEN
          UPDATE
             SET D.BSC        = S.BSC,
                 D.CELL_NAME  = S.CELL_NAME

  • Inner Join between two big tables

    Hi There,
    I have a situation where in which I have to write an inner join between two table of the order of (30k to 60 rows).
    My query is as simple as,
    select A.a,B.b from A ,B where A.a = B.b;
    N.B: a and b are of type varchar
    But the problem is it takes nearly 15 mins to run. Is there any better way of doing an inner join between such bigger tables?
    Thanks,
    Jose John.

    Thank you all for your help.....Indexing works....:)
    --JJ                                                                                                                                                                                                   

  • Joins between two schemas

    Hi
    I need data from two different schemas. Can develop one subject area taking 2 tables from 2 different schemas or we need to have these two tables from one schema only ?
    Can any one help on this.
    Thanks
    Manu

    Hi,
    When you try to create physical join between these two tables of different schemas.
    The join condition is REGION.REGION_CODE = REGION.REGION_ID
    Note: The table name is same in both the schema.
    Now as soon as I click on Ok, it gives an error.Because You can not create join between two tables with the same name.
    So, create alias for these two tables and try to create the join with the same join condition.
    It allowed me to create join perfectly. I moved ahead with the creation of Subject Area based out of these two tables.
    Opened Presentation Services, selected few attributes from both the Presentation folders.But it gave ODBC error as :
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 46036] Internal Assertion: Condition m_CountFields == static_cast<int32>(m_ColumnNameVector.size()), file .\Src\SQCSCacheStorageListStream.cpp, line 221. (HY000)
    Now in order to fix that issue, rename the base tables as Schema1_name.REGION and Schema2_name.REGION in the repository.
    Reload the rpd and run the same report, it would give correct result.
    But instead you can have the tables in the same schema for better maintenance activities.
    Hope this solved your question.
    Regards
    MuRam

  • Sql join on two tables where column like another column

    hi all,
    been trying to get the results from a join between two tables where one column is like another one.
    table1 (nameA) examples: black2, green1
    table2 (nameB) example: black2.location.uk.com, green1.location.uk.com
    so for example I want to match all those in table1 with black2 to the column in table2 that begins with black2 and so on if you see what im trying to get at!
    my sql so far:
    select * from  schema.table1 a
    join schema.table2 b
    on a.nameA like concat('%', b.nameB, '%'); but it errors:
    ORA-00909: invalid number of arguments
    00909. 00000 - "invalid number of arguments"
    Any help or advice would be greatly appreciated, thankyou!

    Either of these should do it...
    select * from  schema.table1 a
    join schema.table2 b on a.nameA like '%'||b.nameB||'%';or
    select * from  schema.table1 a
    join schema.table2 b on instr(b.nameB,a.nameA) > 0

  • Can we implement the custom sql query in CR for joining the two tables

    Hi All,
    Is there anyway to implement the custom sql query in CR for joining the two tables?
    My requirement here is I need to write sql logics for joining the two tables...
    Thanks,
    Gana

    In the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
    Log on to your data source if necessary.
    Under your data source, double-click the Add Command node.
    In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
    For example:
    SELECT
        Customer.`Customer ID`,
        Customer.`Customer Name`,
        Customer.`Last Year's Sales`,
        Customer.`Region`,
        Customer.`Country`,
        Orders.`Order Amount`,
        Orders.`Customer ID`,
        Orders.`Order Date`
    FROM
        Customer Customer INNER JOIN Orders Orders ON
            Customer.`Customer ID` = Orders.`Customer ID`
    WHERE
        (Customer.`Country` = 'USA' OR
        Customer.`Country` = 'Canada') AND
        Customer.`Last Year's Sales` < 10000.
    ORDER BY
        Customer.`Country` ASC,
        Customer.`Region` ASC
    Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
    Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
    For more information about creating parameters, see To create a parameter for a command object.
    Click OK.
    You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
    Note:
    To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
    By default, your command is called Command. You can change its alias by selecting it and pressing F2.

  • How to compare data between two tables?

    Hi,
    My team is trying to develop a SAP data migration tool (DMT) using ABAP.
    One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
    The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
    How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
    Any help would be greatly appreciated, thanks!

    Hi Kian,
    Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
    Thanks,
    Vinay

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

  • How to write select statement between two tables

    hi,
    i need to do comparision between two table for each records.ex:
    table1:
    regid            regno         ind
    1                 1001
    1                 1002
    1                 1003
    1                  1004
    and table2:
    regid           regno
    1               1002
    1                1005
    i need to select first row from table and loop for values in second table, if the values found first record , the record must update 'yes' to ind, if not 'No'.
    please help with this.
    thanks in advance
    raja

    Hi Raja,
      Do it like this.  loop  the first table and read the second table.
    Use where condition to satisfy the conditions.
    Or
    In your select query use joins. Like this.
    SELECT mara~matnr
           marc~werks
    INTO   TABLE t_material
    FROM   mara AS mara INNER JOIN marc AS marc
    ON     maramatnr = marcmatnr
    WHERE  mara~mtart = p_mtart.
    Instead of MARA and MARC here use your tables.
    Much Regards,
    Amuktha.

  • Prcedure to joining of two tables and pls explore the primary & foriegn key

    Dear All,
    Am new to this forum looking forward to have some discussions and guidance reg ABAP.
    <b>My query is</b>
    what is the prcedure to joining of two tables and pls explore the primary & foriegn key relationships.
    Your kind help is required in this query .
    Thanks n regards
    Carol P

    Hi Carol,
    Joining two tables fetch data from tables that has relevent entry based on the keys. like LIKP and LIPS these are delivery tables. if the business requirement is fetching delivery data that are exists in both two tables. here LIKP will conatins a single entry against a condition and LIPS may contains several entry because one delivery may has multiple line items. so, fetch the data joining the two tables on vbeln that is delivrey number. this is used to increase the performance of the program except for all entries.
    Foreign key is poiting twowards primary key; it may be 1:1 , 1:many and many:many. if field1 of table a is pointing towards field1 of table b. then based on these condition at the time of entry SAP will check how many entry can be entred in field1 of table a.
    regards
    Krishnendu

Maybe you are looking for