SAP QUERY/INFOSET with OUTER JOIN

Hi,
I have created an infoset (SQ02) using two tables for SAP query.
Table: AGR_TEXTS. Fields: AGR_NAME, SPRAS, LINE, TEXT.
TABLE: AGR_FLAGS. Fields: AGR_NAME, FLAG_TYPE, FLAG_VALUE.
Joined these two tables using outer join.  Defined the join condition as AGR_NAME = AGR_NAME.  Saved and Generated the infoset.
Created SAP Query (SQ01) using the above created infoset.
In the basic list,
Marked AGR_NAME (AGR_TEXTS), TEXT, FLAG_VALUE as listed fields.
Marked AGR_NAME (AGR_TEXTS), SPRAS, LINE, FLAG_TYPE as selection fields.
Save the query.  When execute the query provided the inputs for all the selection fields in the selection screen as given below:
AGR_NAME=Z*
SPRAS=E
LINE=00000
FLAG_TYPE=LICENSE_01
Executed the Query. 
Got the results only the matched records as per the selection field FLAG_TYPE.
But I want all the records from table AGR_TEXTS and matched records from table AGR_FLAGS.
I want the report (output) as below,
_AGR_NAME                                               TEXT                                                                                  FLAG_VALUE_
ZCA_BASIC_ACCESS_GLOBAL     Non-critical basic access for all users.                                       53
ZCA_BASIC_ENDUSER_ACCESS     UK:CA Basic Enduser Access     
ZCA_BASIC_ENDUSER_ACCESS_UK     UK:CA Basic Enduser Access UK                                        52
ZCA_BASIC_ENDUSER_SU52_UK     UK:CA Basic Enduser Access to change Parameter ID's     
But I got the report (output) as below, 
_AGR_NAME                                                TEXT                                               FLAG_VALUE_
ZCA_BASIC_ACCESS_GLOBAL     Non-critical basic access for all users.     53
ZCA_BASIC_ENDUSER_ACCESS_UK     UK:CA Basic Enduser Access UK     52
Apprecited your help. Thanks.
Code Formatted by: Alvaro Tejada Galindo on Dec 30, 2009 2:20 PM

Identify a KF for which there are non-zero values for all accounts in the cube.
Create the query with Account (from MP coming from both IO and cube) and this KF. KF will have 0 values for accounts not existing in the cube. Create a condition to show only the 0 value for the KF. This should show you all the accounts in the IO which are not in the cube.

Similar Messages

  • SAP Query Infoset

    Dear All,
    I have created a SAP Query Infoset with ldp pnp, i have a customer infotype added to that infoset.
    One of my field in the customer infotype consist of value and text(meaning values are stored in the infotype, which also has some text attached to it which is the check table).
    Now how can i link those two in the infoset, so that user can choose between them?
    Thanks.
    Moderator message: please choose more descriptive subject lines for your posts.
    Edited by: Thomas Zloch on May 26, 2011 10:12 AM
    Edited by: Satish R on May 26, 2011 10:55 AM
    Edited by: Satish R on May 26, 2011 10:59 AM
    Edited by: Satish R on May 26, 2011 11:00 AM

    Hello Satish,
    In SQ01 when you create your output list, you can right-click the column and select "Value and text",  I am on version ECC 6.0.
    Kind Regards,
    Rae Ellen Woytowiez

  • Help requried with outer joins

    Hi All,
    I neeed a query help can any one please help me getting this done,
    for the below query
    select trunc(assumed_time_sql) AS date1,sum(rp.rebate_due)as sum1 from mn_date_dim dd ,mn_rebate_payment rp,mn_prc_program prc,mn_structured_doc sd
    where trunc(assumed_time_sql) in (TO_DATE('01-JUL-10','dd-mon-yy'),add_months(TO_DATE('01-JUL-10','dd-mon-yy'),-3),add_months(TO_DATE('01-JUL-10','dd-mon-yy'),-6),add_months(TO_DATE('01-JUL-10','dd-mon-yy'),-9))----input parameter
    AND trunc(dd.assumed_time_sql)=TRUNC(rp.start_date)
    AND prc.prc_program_id=rp.tiered_rebate_id
    AND sd.struct_doc_id=prc.struct_doc_id
    AND sd.struct_doc_id_num='M0000763'----input parameter
    group by trunc(assumed_time_sql);
    I am getting output as
    date1      sum1
    01-JAN-10      10
    01-APR-10     15
    01-JUL-10     20
    But i want my output to be as
    date1      sum1
    01-JAN-10      10
    01-APR-10     15
    01-JUL-10     20
    01-OCT-09 NULL
    I have tried with outer joins but this didn't help me
    Can any one please give me help in getting this done
    Thanks

    Hi,
    As SB pointed out, you'd better provide tables and data in order to be helped more efficiently.
    Anyway, you may want to investigate the use of NVL and/or DECODE so that you can translate NULL into valid values so they are returned to your select statement.
    HTH,
    Thierry
    Handle:  p78   
    Status Level:  Newbie (10) 
    Registered:  Mar 9, 2009 
    Total Posts:  60 
    Total Questions:  35 (30 unresolved)  Be kind to share your helpful / correct threads with other with marking them as ANSWERED
    Edited by: Urgent-IT on Feb 13, 2011 11:00 AM

  • Generate a where clause with outer join criteria condition: (+)=

    Hi,
    In my search page, I use Auto Customization Criteria mode, and I build where clause by using get Criteria():
    public void initSrpQuery(Dictionary[] dic, String userName) {
    int dicSize = dic.length;
    StringBuffer whereClause = new StringBuffer(100);
    Vector parameters = new Vector(5);
    int clauseCount = 0;
    int bindCount = 1;
    for(int i=0; i < dicSize; i++){
    String itemName = (String)(dic.get(OAViewObject.CRITERIA_ITEM_NAME));
    Object value = dic[i].get(OAViewObject.CRITERIA_VALUE);
    String joinCondition = (String)dic[i].get(OAViewObject.CRITERIA_JOIN_CONDITION);
    String criteriaCondition = (String)dic[i].get(OAViewObject.CRITERIA_CONDITION);
    String criteriaDataType = (String)dic[i].get(OAViewObject.CRITERIA_DATATYPE);
    String viewAttributename = (String)dic[i].get(OAViewObject.CRITERIA_VIEW_ATTRIBUTE_NAME);
    String columnName = findAttributeDef(viewAttributename).getColumnNameForQuery();
    if((value != null) /*&& (!("".equals((String).trim())))*/){
    if(clauseCount > 0){
    whereClause.append(" AND ");
    whereClause.append(columnName + " " + criteriaCondition + " :");
    whereClause.append(++bindCount);
    parameters.addElement(value);
    clauseCount++;
    If I want to generate following where clause:
    select
    ,emp.name
    ,emp.email
    ,emp.salesrep_number
    ,comp.name
    ,gs.srp_goal_header_id
    ,gs.status_code
    ,gs.start_date
    ,gs.end_date
    from g2c_goal_shr_emp_assignments_v emp
    ,jtf_rs_salesreps rs
    ,xxg2c_srp_goal_headers_all gs
    ,cn_comp_plans_all comp
    where 1 = 1
    and rs.salesrep_id = gs.salesrep_id (+)
    and gs.comp_plan_id = comp.comp_plan_id (+)
    and gs.period_year (+) = :1 -- :1 p_fiscal_year
    How can I generate a where clause with outer join : gs.period_year (+) = :1 ? Will I get '(+)=' from get(OAViewObject.CRITERIA_CONDITION)?
    thanks
    Lei

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • Extracting SAP Query,Infoset  Data from VB Application

    Hi,
    I need to get all SAP Queries,Infosets and SAP Query Group data from a VB application.
    I have found a Remote Enabled Function called    IQAPI_READ_QUERY_CATALOG.
    But when I call the Function from a VB application ,the call is not successful and even I am not getting any exception.
    The call is getting false with null exception .
    Can anyone please guide me.
    Or is there any other function module /procedure / table to extract SAP Query ,Infoset,SAP Query Group data??
    Thanks in Advance.

    http://stackoverflow.com/questions/3765373/how-do-i-do-a-select-distinct-using-a-sap-infoset-query

  • How to use common object from two tables with out join.

    HI,
    I have two tables called A & B In A table i have the following objects
    1.weekend
    2.S1(measure)
    3.S2(measure)
    4.S3(measure)
    5.S4(measure)
    And In B table i have followning columns
    1.week end
    2.p1(measure)
    3.p2(measure)
    4.p3(measure)
    5.p4(measure)
    Now in universe i created all the measure objects i.e.s1,s2,s3,s4,p1,p2,p3,p4 A.weekend,B.weekend.
    instead of using week end two times i wnt to use only once because this is common in both table.
    if i use join between these tables i am getting values fine
    But With out join is there any thing to do in universe level to create common objects to use from both the tables..I tried using aggregate awareness but while reporting it is taking as two SQL.which is not synchronized.
    Please help me on this ...

    hi,
    Although  Weekend column is present in both tables, by creating a single Object in Universe, Universe can identify relationship with only table referenced in Object Creation.
    So, there will be no identification of relationship with other table measures.
    Obviously, you need to create 2 Weekend objects in Universe (in two classes).
    Case 1: You need not join these two tables in Universe. When you create 2 Queries in WEBI, automatcially Weekend objects are synchronized (if both are of same datatype)
    Case 2: If you join these two tables in Universe, Obviously,
    your SQL may contain Weekend from Table1, measures from Table 2
    or
    your SQL may contain Weekend from Table2, measures from Table 1
    Finally, You need to create 2 objects in Universe. But your query may contain a single Object based on Case 2.
    Regards,
    Vamsee

  • How to poll a blob using db adapter, with outer joins condition

    Hi All,
    We are trying to poll tables which contain column types as long and blob, we are using relationships in adapter and kept outer joins. by this we got select distinct t1.document .....etc
    distinct keyword cannot be used for blobs.
    is there any way to poll these tables having blob column types with outer joins.
    thanks a lot in advance,
    RR

    Hi,
    Procedure will be an explicit Invoke not Polling. If you can alter you design such that your BPEL process instead of polling gets triggered by some external entity (Java, PL/SQL, Scheduler, another BPEL etc.), you can put the data fetching logic in the procedure and call this procedure from your BPEL process to get the data. And your BPEL process is called periodically at an interval by an external entity.
    Also see if you can restrict the duplicate records at the database level itself. Polling, AFAIK, is limited in terms of customization and wouldn't be easy to customize. However, would like to learn a way if someone has.
    Regards,
    Neeraj Sehgal

  • Group by with outer join

    Group by sum doesn't work with outer join. Can anyone please help me to get it right?
    I've posted some sample data and queries below:
    CREATE TABLE COMPLAINT
      CNO     NUMBER,
      REASON  VARCHAR2(15 BYTE),
      TOTAL   NUMBER
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (1, 'edge', 250);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (2, 'edge', 250);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (3, 'brst', 300);
    Insert into COMPLAINT
       (CNO, REASON, TOTAL)
    Values
       (4, 'crea', 400);
    COMMIT;
    CREATE TABLE SCOTT.COMPLAINTROLL
      CNO   NUMBER,
      ROLL  VARCHAR2(15 BYTE)
    SET DEFINE OFF;
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (2, 'roll22');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll4');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll3');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll2');
    Insert into COMPLAINTROLL
       (CNO, ROLL)
    Values
       (1, 'roll1');
    COMMIT;
    select * from complaint
    CNO     REASON     TOTAL
    1     edge     250
    2     edge     250
    3     brst     300
    4     crea     400
    select * from complaintroll
    CNO     ROLL
    1     roll1
    1     roll2
    1     roll3
    1     roll4
    2     roll22
    -- total of reason code edge is 500
    select reason,sum(total)
    from complaint c
    group by reason
    REASON     SUM(TOTAL)
    brst     300
    crea     400
    edge     500
    -- total of reason code edge after outer join is 1250
    select reason,sum(total)
    from complaint c,complaintroll cr
    where c.cno=cr.cno(+)
    group by reason
    REASON     SUM(TOTAL)
    brst     300
    crea     400
    edge     1250
    {\code}
    Thanks for reading this post.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The problem that you described is simple. The outer join duplicates all the rows from the parent table (complaint). If you want to sum a column from the parent table, then this sum includes all the duplicated rows.
    There are several solutions for this problem.
    A) One had been shown already by Cenutil. Instead of doing an outer join, you can do a subquery in the select clause that delivers the additional information from the detail table.
    SQL> select reason,
       sum(total),
       sum((select count(*) from complaintroll cr where c.cno=cr.cno)) cnt_rolls
    from complaint c
    group by c.reason;
    REASON          SUM(TOTAL)  CNT_ROLLS
    crea                   400          0
    brst                   300          0
    edge                   500          5b) sum in two steps. First sum and count including the join criteria, then use this information to calculate the correct total sum.
    SQL> select reason, sum(stotal), sum(stotal/scount), sum(scount), sum(cnt_rolls)
      2  from (select reason, sum(total) stotal, count(*) scount, count(cr.cno) cnt_rolls
      3         from complaint c
      4         left join complaintroll cr on c.cno=cr.cno
      5         group by reason, c.cno
      6         )
      7   group by reason;
    REASON          SUM(STOTAL) SUM(STOTAL/SCOUNT) SUM(SCOUNT) SUM(CNT_ROLLS)
    crea                    400                400           1              0
    brst                    300                300           1              0
    edge                   1250                500           5              5
    sql> c) another option is to do the left join, but do the aggregation only one time for the parent table. Analytic functions are helpful for that. However since analytic fuinctions can't be used inside an aggregation function, we would again need an inline view.
    SQL> select reason, sum(case when rn = 1 then total end) sum_total, count(*), count(crcno)
      2  from (select row_number() over (partition by c.reason order by c.cno) rn,
      3                   c.*, cr.cno crcno
      4         from complaint c
      5         left join complaintroll cr on c.cno=cr.cno
      6         )
      7  group by reason;
    REASON           SUM_TOTAL   COUNT(*) COUNT(CRCNO)
    brst                   300          1            0
    crea                   400          1            0
    edge                   250          5            5
    SQL> Edited by: Sven W. on Feb 10, 2011 1:00 PM - formatting + column added to 2nd option

  • Update with Outer Join, round 2

    Thanks for those of you who helped me out on the first one (I never thought that you could use a one-row SELECT like that).
    However, here is a new version of my problem:
    I have three tables.
    Table_1 has a column that needs to be updated based on values in Table_2 and Table_3.
    Both Table_1 and Table_2 have values used to determine which Table_3 row to use.
    However, not every Table_1 row has a corresponding Table_3 row, in which case the Table_3 value to use is assumed to be 1.
    The tables and corresponding columns are:
    TABLE_1
    value_1 - the value to be updated
    key_2 - a pointer to TABLE_2
    key_3a - a pointer to TABLE_3, or a dummy value if there is no corresponding TABLE_3 record
    TABLE_2
    key_2 - the primary key
    key_3b - a secondary pointer to TABLE_3
    value_2 - a value to be used in calculating TABLE_1.value_1
    TABLE_3
    key_3a - the first part of the unique key
    ley_3b - the second part of the unique key
    value_3 - a value to be used in calculating TABLE_1.value_1
    If there is a row in table_3 that matches the table_1.key_3a and table_2.key_3b values (where table_2.key_2 = table_1.key_2):
    set table_1.value_1 = table_2.value_2 * table_3.value_3
    If there is no such row in table_3:
    set table_1.value_1 = table_2.value_2
    I want to do something like this:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_2 t2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1.key_3a)
    WHERE t2.key_2 = t1.key_2
    However, Oracle does not allow t1 to be referenced in the ON clause of the outer join.
    (Assume that every key_2 value in table_1 is in table_2 as well - it is only the key_3 value that can be a dummy.)
    If I move "t3.key_3 = t1.key_3" to the WHERE clause, then t1.value_1 is null for rows without the corresponding table_3 value.
    I can do it with a clone of table_1 using ROWIDs:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_1 t1a
    JOIN table_2 t2
    ON t2.key_2 = t1a.key_2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1a.key_3a)
    WHERE t1a.row_id = t1.row_id
    However, is there an easier way to do this using ANSI joins (i.e. without (+) syntax)?
    I have this feeling I am missing something reasonably obvious here.

    ddelgran wrote:
    Thanks for those of you who helped me out on the first one (I never thought that you could use a one-row SELECT like that).
    I want to do something like this:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_2 t2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1.key_3a)
    WHERE t2.key_2 = t1.key_2
    However, Oracle does not allow t1 to be referenced in the ON clause of the outer join.
    (Assume that every key_2 value in table_1 is in table_2 as well - it is only the key_3 value that can be a dummy.)
    If I move "t3.key_3 = t1.key_3" to the WHERE clause, then t1.value_1 is null for rows without the corresponding table_3 value.
    I can do it with a clone of table_1 using ROWIDs:
    UPDATE table_1 t1
    SET value_1 =
    SELECT t2.value_2 * NVL(t3.value_3, 1)
    FROM table_1 t1a
    JOIN table_2 t2
    ON t2.key_2 = t1a.key_2
    LEFT JOIN table_3 t3
    ON (t3.key_3b = t2.key_3b and t3.key_3a = t1a.key_3a)
    WHERE t1a.row_id = t1.row_id
    However, is there an easier way to do this using ANSI joins (i.e. without (+) syntax)?
    I have this feeling I am missing something reasonably obvious here.You might want to refer to my post in your original thread how to use join views in updates. You can use ANSI join syntax there, too:
    Re: Update with Outer Join
    You would end up with something like this (note: untested):
    UPDATE
      SELECT t1.value_1, t2.value_2 * NVL(t3.value_3, 1) as new_val
      FROM table_1 t1
      INNER JOIN table_2 t2 ON (t2.key_2 = t1.key_2)
      LEFT JOIN table_3 t3
      ON (t3.key_3b = t2.key_3b and t3.key_3a = t1.key_3a)
    SET value_1 = new_val;And again the same restrictions regarding key-preserved tables apply as described in the post referred to.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Trim With Outer Join in where

    Getting an error called Invalid relational Operator
    SELECT DISTINCT t1.recv_order_no, t2.reference_no
    FROM receiving_order t1, receiver_num t2
    WHERE TRIM(t2.reference_no) (+) = TRIM (t1.recv_order_no)
    ORDER BY t2.reference_no ASC
    What I am doing wrong here ?
    Can I use trim fun with outer join ?
    Thanks for help.
    Srini

    Hi Srini,
    I have done this with emp and dept
    Following is an example:
      1  select a.deptno, b.ename
      2     from dept a, emp b
      3*   where trim(a.deptno) = trim(b.deptno(+))
    scott>/
        DEPTNO ENAME
            10 CLARK
            10 KING
            10 GHULAM
            10 MILLER
            20 SMITH
            20 ADAMS
            20 FORD
            20 SCOTT
            20 JONES
            30 ALLEN
            30 BLAKE
            30 MARTIN
            30 JAMES
            30 TURNER
            30 WARD
            40Hope this helps
    Ghulam

  • Tabular form from query with outer join destroys the universe!

    Well, maybe just my app...
    At any rate, what I have is a query that pulls RISKS for a project and does a reasonable outer join which joins the latest value from a RISK_HISTORY table. Values for RISK are updated and the value for RISK_HISTORY is changed and a new entry added to the RISK_HISTORY table.
    At least that's how it's supposed to be.
    I was able to do this with a report-with-a-form region by adding an extra update process to do a new insert into RISK_HISTORY but it seems that the tabular form is a bit more work.
    Here's the query I'm using:
    select * from(
    select
    r.RISK_SEQ RISK_SEQ_DISPLAY,
    r.RISK_PRIORITY,
    r.RISK_INFO,
    r.RISK_MITIGATION,
    r.ONGOING_FLAG,
    r.RISK_DATE,
    r.WEEK_GROUP_SEQ,
    r.CREATED_ON,
    r.CREATED_BY,
    r.LAST_MODIFIED_ON,
    r.LAST_MODIFIED_BY,
    rh.STATUS,
    row_number() over (partition by rh.risk_seq order by rh.last_modified_on desc) rn
    from RISK r, WEEK_GROUP w, RISK_HISTORY rh
    where w.PROJECT_SEQ=43
    and r.week_group_seq= w.week_group_seq
    and w.week_index=0
    and rh.RISK_SEQ = r.RISK_SEQ
    ) where rn = 1
    Clicking "Add Row" gets me this:
    Error in mru internal routine: ORA-20001: no data found in tabular form
    Running debug doesn't seem to expose much for me either. Is there a better tact for me to take here?
    Thanks,
    Jon

    Hi Prazy,
    using nvl also didn't solve my problem.Actually my problem is I am having a table a in which I have a column called satus, status has the values like A or I .I have one lookup called MTH_BUYSINESS_FUNCTION in which for lookup_code A I have menaing as Active and for lookup_code I meaning is Inactive.Now in table a for sttaus I have two values one A and one null Now I want to write sql which displayes the meaning for column staus.Result should be Active and null .If I am uisng 1 query which I gave u I am not able to get the 2nd row in my output.If I use 2nd query then I get duplicate rows.
    Thanks ,
    Amrit

  • Query Question: Combine outer join with max() statement

    Hi Folks,
    I have been banging my head on this for a while now and am asking from some advice.
    I have a Project Completion Report that pulls information from a number of tables:
    1) Program (PK: ID)
    2) Project (PK: ID, FK: Program_ID constrained to Program.ID)
    3) Project_Monthly (PK: ID, FK: Project_ID constrained to Project.ID)
    4) Status_Report (PK: ID, FK: Project_ID constrained to Project.ID)
    The Status_Report table has a Record_Date field and holds a BLOB with the status reports for all the projects. In the best of all possible worlds, every project would have a status report, but, obviously, some have no status reports.
    I have been asked to extend the Project Completion Report. It currently shows:
    1) Program Number (Program.Program_Number)
    2) Program Name (Program.Program_Name)
    3) Project (Project.Project_Name)
    4) Projected Completion Date (Project_Monthly.Current_Date_Production)
    We would like to add the latest status report. So I started with something that works in another report, which is to get the ID from the Status_Report table for the record that has the maximum date value in the Record_date that matches the Project in the current Program. But this other query is looking at one program at a time. The Project Completion Report is showing all programs with projects that complete within a certain time frame.
    The requirement is to show all projects that will complete within a time frame and to display the ID of the most recent status report (I use javascript to turn this into a downloadable link). However, whenever I try something like:
    AND Status_Report.Record_Date =
    (select MAX(Status_Report.record_date) from Status_Report
    where Status_Report.ID = Project.ID)I loose all projects that have no status reports associated with them.
    How can I keep all the projects that fulfill the criteria of completing within a specified time frame and add the ID, if it exists, of the most recent status report?
    I thank you for your time and assistance. Please let me know how I can clarify the problem more clearly.
    Yours,
    Petie

    I had thought I finally solved it. Alas, it wasn't yet to be.
    I created a view with the following select statement:
    select p.program_number, p.program_name,
    pj.id as pj_id, pj.project_name, pjm.in_prod_current, pjm.record_date as pjm_record_date,
    prs.id as prs_ID, prs.record_date as prs_record_date
    from program p, project pj, project_monthly pjm,
    project_status_report prs
    where p.id = pj.program_id
    and pj.id = pjm.project_id
    and pj.id = prs.project_id (+);Then, I selected from the view and the project_status_report table, performed an outer join on those (filtered to only the current month's project records) and filtered by the maximum date for each project.
    Here is the resulting query:
    select pc.program_number, pc.pj_id, pc.project_name, pc.in_prod_current,
    pc.pjm_record_date, pc.prs_id
    from project_completion pc,
    project_status_report prs
    where trunc(pjm_record_date, 'mon') = trunc(sysdate,'mon')
    and prs.id = pc.prs_id (+)
    and pc.prs_record_date =
    (select max(mprs.record_date)
    from project_status_report mprs
    where mprs.project_id = pc.pj_id)However, I am still not getting the projects for which there are no status reports.
    Verflixt und zugenaeht!
    It seems that I want to compare based upon the record_date of the status report, but get the ID back. Can I use DECODE for that? Can I get the MAX(prs.record_date), but return only the prs.ID? Because if I include the ID in the select statement, I get too many matches, but if I don't then I don't have the ID, which is needed.
    Any suggestions?
    Thanks, Petie
    Message was edited by:
    Petie

  • Need sql query to find out Joins attached with folders in Discoverer

    Hi,
    Can anyone let me know the sql query which can be used to identify the joins which are attached to the folders.
    Actually we have to identify all the joins conditions from folders those are migrated from one instance to others.
    Thanks
    abhishek

    I recommend that you implement the admin EUL supplied by oracle, you can get there a lot of repository information (metalink note: 556932.1).
    Try to use this (maybe you will need some pkg's):
    SELECT
    DECODE(KEYS.FK_MANDATORY,
    1,
    'Always exist in master folder',
    'Might not exist in master folder') "Detail Item values",
    EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID, 'N') "Join Master --> Detail",
    KEYS.KEY_DESCRIPTION JOIN_DESCRIPTION,
    KEYS.KEY_DEVELOPER_KEY JOIN_IDENTIFIER,
    KEYS.KEY_NAME JOIN_NAME,
    DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
    'AUTO_GENERATED_NAME',
    'Yes',
    'No') "AutoGen",
    DECODE(DECODE(SUBSTR(KEYS.KEY_NAME, 1, 19),
    'AUTO_GENERATED_NAME',
    'Yes',
    'No') ,
    'Yes',
    EUL10G_US.EUL5_GET_JOIN(EXP.EXP_ID),
    KEYS.KEY_NAME) "Actual Join Name",
    KEYS.KEY_UPDATED_DATE JOIN_LAST_UPDATE,
    DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "One to One join",
    DECODE(KEYS.FK_MSTR_NO_DETAIL,
    1,
    'Outer join on detail' || CHR(10),
    NULL) "Outer Join on Detail",
    DECODE(KEYS.FK_DTL_NO_MASTER,
    1,
    'Outer join on master' || CHR(10),
    NULL) "Outer Join on Master",
    DECODE(KEYS.FK_MSTR_NO_DETAIL,
    1,
    'Outer join on detail' || CHR(10),
    NULL) || DECODE(KEYS.FK_DTL_NO_MASTER,
    1,
    'Outer join on master' || CHR(10),
    NULL) ||
    DECODE(KEYS.FK_ONE_TO_ONE, 1, 'One to one join', NULL) "Optional Join Configurations",
    OBJ.OBJ_NAME "MASTER_FOLDER",
    OBJ_DETAIL.OBJ_NAME "DETAIL_FOLDER"
    FROM EUL10G_US.EUL5_OBJS OBJ,
    EUL10G_US.EUL5_EXPRESSIONS EXP,
    EUL10G_US.EUL5_KEY_CONS KEYS,
    EUL10G_US.EUL5_OBJS OBJ_DETAIL
    WHERE ((KEYS.KEY_ID = EXP.JP_KEY_ID) AND
    (OBJ.OBJ_ID = KEYS.FK_OBJ_ID_REMOTE) AND
    (OBJ_DETAIL.OBJ_ID = keys.KEY_OBJ_ID));

  • How to add new codes into SAP Query/Infoset

    Hi Experts,
    First time working with SAP Query.
    I need to enhance an existing Query to add a new field into a report.  I have added new tables into this Infoset and joined my new  tables with existing tables and able to extract the new fields out on the report.  But here are my problems:
    Example of original output:
    X88888 500000
    X99999 400000
    Example of new output after adding my 2 new tables to get 1 new field to output:
    X88888 50000  01/08/2009
    X88888 50000  01/25/2009      <--- for X88888 customer, I want only this record w/ latest date to be output
    X88888 50000  01/22/2009   
    X99999 40000  03/09/2009
    X99999 40000  04/18/2009
    X99999 40000  04/19/2009      < -- for X99999, I want only this record w/ latest date to be output
    Where/How i can add the code to control this logic so that only 1 record per customer with the highest date can be output.  I looked at the query program and it looks very confusing and hard to understand.
    Please advise,
    Thanks,
    Sam

    Hi Sam,
    Instead on adding new table/tables , better way to use Direct Read from your single table.
    Please read the below steps to suffice your requirement.
    Assumption: Let your original table be A and second table is B.
                            Tables A and B are having field X1 and X respectively, using these fields, they can be joined.
                             You want field date1 of table B.
    Infoset Changes:
    1. Go to SQ02 (Enter Infoset name, click on Change button)
    2. Create an extra field E_date of type date (Sy-datum), by clicking on 'Extras' (F5) button.
    3. Select that field in one of the field group of your Infoset.
    4. Click on Code Icon (Shift+F8) displayed on application bar, you will be getting lists events in 'Code section'.
    5. In Data Section , declare an internal table like below code (here pseudo code)
    data: begin of itab_date occurs 0,
                       date1  like B-date1,
                       end of itab_date.
    6. In Recod processing Event write the following code.
    CLEAR itab_date.
    CLEAR E_date.
    SELECT date1 FROM B into table itab_date                           " Retrieving date field from table B
    WHERE X = A-X1.
    Sort itab_date by itab_date-date1  DESCENDING.                 "Sort internal table B in decendind order on date1
    READ TABLE itab_date index 1.                                            "Read first record of interanal table
    E_date  = itab_date-date1                                                      "Assigning top most date of internal table into field E_date.
    7. Generate the Infoset
    Query changes
    1.Go To SQ01 (in a new session),
    2.Give your Query name, click on change button, and select that field group in which you have added extra field.
    3.Select extra field.
    4.Go to basic list to select that field in your O/p list.
    5.Click on Test button, and see if you are getting desired result.
    Please let me know if you need further details.
    Regards,
    Dinesh

  • BI Infoset left outer join  (NW04s)

    I created an Infoset using a left outer join for infoproviders:
    - 0FIGL_O10 (GL transaction figures - DSO )
    - 0CCA_C03 (CCA Statistical key figures - CUBE)
    DSO 0FIGL_O10 is the left table with joins on:
    - 0COSTCENTER
    - 0FISCPER
    The data set returned by Infoset appears to be based on a SQL using an
    inner join.
    This appears to be a bug.
    We are on BI 700 SP 15.

    Hi Raynald - I did a demo with few records and it works fine for me.  We are on 7, SP14.

Maybe you are looking for

  • 500 Internal Server Error: An unknown error has occurred

    When I open my browser, it immediately displays this error message. No matter what web site I navigate to, I get this message. I have no problems with Internet Explorer, so I know this is limited to Firefox. I've been gone for the past 5-6 days and j

  • New iPod wants me to uninstall previous version.  Will I lose my music?

    I lost my 2 G nano, just got a 30 G to replace it. My library on my computer is full of good stuff, subscriptions to podcasts, etc. When I try to install the software from the disk that came with my new unit, it tells me to uninstall the previous ver

  • How can I put a Pages file on icloud?

    Is there are way to load a Pages document, or keynote or numbers for that matter, on iCloud?  I can do this through iWorks but would like it to do it automatically.

  • Embedding unicode font problem

    Hi All,        I am developing a flex application for Tamil language. I want to use tamil text in all the controls. When I embed a tamil unicode font with the application, it doesn't render the text properly because of the glyphs. @font-face {       

  • JPDK - Unable to see Sample provider in repository - getting Error

    I have been trying to intall the sample provider as outlined in the document "Installing the PDK-Java Framework and Samples". Everything works fine except that I am unable to see the provider in the repository...even after I refresh the repository or