Group by Left Report for Multiple Queries

Afternoon folks,
I have been pretty much writing my queries in Oracle Reports by having one long query (which includes multiple sub-queries) and then displaying the results (Mainly Counts and MEDIAN values).
This has resulted in one very long query (difficult to manage and understand), not to mention slower performance. I would like to change that my making smaller queries and use data links to join the groups.
Here is my Report request in hand. I need to build a Report that will be grouped by a Reporting Year and stratified by Age Groups and then Report various Counts of Students that are
coming from various data sources (Tables). As of now, I have the Counts coming from at least 3 different data sources. So as you can imagine, my 3 sub queries have added to one
very long query. Anymore requirements to the Report and it can lead to a big mess.
Column '# of Students Enrolled' is coming from ENROLLMENT_TB table
Columns '# of Students who took Math' and 'Marks > 60' are coming from COURSE_MATH table.
Birth Date information is in the STUDENT_TB table (Since the Report needs to be stratified by Age Groups)
Report Layout
Reporting Year    Age Group         # of Students Enrolled   # of Students who took Math       Marks > 60   Median Score
========================================================================================================================
2010              1960 - 1969                          999                           999              999            999                 
                  1970 - 1979                          999                           999              999            999                 
                  1980 - 1989                          999                           999              999            999                 
                  1990+                                999                           999              999            999                 
2011              1960 - 1969                          999                           999              999            999                 
                  1970 - 1979                          999                           999              999            999                 
                  1980 - 1989                          999                           999              999            999                 
                  1990+                                999                           999              999            999                 
2012              1960 - 1969                          999                           999              999            999                 
                  1970 - 1979                          999                           999              999            999                 
                  1980 - 1989                          999                           999              999            999                 
                  1990+                                999                           999              999            999                  Currently, I have 3 sub-queries
Sub Query #1: # of Students Enrolled from ENROLLMENT_TB.
Sub Query #2: # of the Enrolled Students who took Math from COURSE_MATH_TB
Sub Query #3: # of the Enrolled Students who took Math from COURSE_MATH_TB and got Marks > 60. Median Score of this sampling.
My thought would be to have them into Groups and then create a Report a s a Group Left to achieve the results. Any help or suggestions would be more than welcome.
I have begun working on this Report but it is still taking quite long (Like 4 minutes) when the individual Queries (Q_COURSE_MATH and Q_COURSE_MATCH_60) are only taking 20 seconds each.
My guess is the Grouping based on the age group is resulting in slower performance but I could be wrong.
Also, the Query runs between pages and takes a long time to run. So, when I actually ran the Report, only the first page was formatted and then subsequent pages follow.
Looking at the data model, is there something conceptually wrong?
I have also not included the Query for Enrollment Counts to keep the Report simple.
Data Links:
Q_REPORTING_YEAR and Q_COURSE_MATH (Join condition: reporting_year and age_range_order_id)
Q_REPORTING_YEAR and Q_COURSE_MATH_60 (Join condition: reporting_year and age_range_order_id)
Data Layout:
Q_REPORTING_YEAR
select yrs.reporting_year,
       age_range.age_range_label,
       age_range.age_range_order_id
from
  select to_char(Add_Months(To_Date ('01-JAN-2009', 'DD-MON-YYYY'), 12 * LEVEL), 'YYYY')   reporting_year
  from    DUAL
  CONNECT BY LEVEL < 4
) yrs,
  select decode( rownum, 10, '1990+', to_char(1900+ (rownum-1)*10)||'-'|| to_char(1900+ (rownum)*10-1))   age_range_label,
             to_char(1900+ (rownum - 1)*10)                                                               age_start,
             to_char(decode(rownum, 10, to_char(sysdate, 'yyyy'), 1900+ (rownum)*10-1))                   age_stop,
             rownum                                                                                       age_range_order_id
  from    dual
  connect by rownum < 11
) age_range
order by yrs.reporting_year, age_range.age_range_order_id
Q_COURSE_MATH
select reporting_year              cm_reporting_year,
       age_range_label             cm_age_range_label,
       age_range_order_id          cm_age_range_order_id,
       COUNT(distinct(student_id)) cm_student_count
from
  select distinct cm.student_id                     student_id,
         to_char(cm.course_date, 'YYYY')           reporting_year,
         age_range.age_range_label        age_range_label,
         age_range.age_range_order_id   age_range_order_id
  from   course_math    cm,
         student_tb s,
           select decode( rownum, 10, '1990+', to_char(1900+ (rownum-1)*10)||'-'|| to_char(1900+ (rownum)*10-1))   age_range_label,
                      to_char(1900+ (rownum - 1)*10)                                                               age_start,
                      to_char(decode(rownum, 10, to_char(sysdate, 'yyyy'), 1900+ (rownum)*10-1))                   age_stop,
                      rownum                                                                                       age_range_order_id
           from    dual
           connect by rownum < 11
          ) age_range
    where  cm.student_id = s.student_id
    and exists ( select 'x' from sampling_student_vw w
                     where  w.student_id = cm.student_id )
    and     to_char(s.birth_date, 'YYYY') between age_range.age_start and age_range.age_stop
) q
GROUP BY q.reporting_year, q.age_range_label, q.age_range_order_id
Q_COURSE_MATH_60
select reporting_year              cm_reporting_year,
       age_range_label             cm_age_range_label,
       age_range_order_id          cm_age_range_order_id,
       COUNT(distinct(student_id)) cm_student_count,
       MEDIAN(marks)                cm_median_60
from
  select distinct cm.student_id                     student_id,
         to_char(cm.course_date, 'YYYY')           reporting_year,
         cm.marks                                  marks,
         age_range.age_range_label        age_range_label,
         age_range.age_range_order_id   age_range_order_id
  from   course_math    cm,
         student_tb s,
           select decode( rownum, 10, '1990+', to_char(1900+ (rownum-1)*10)||'-'|| to_char(1900+ (rownum)*10-1))   age_range_label,
                      to_char(1900+ (rownum - 1)*10)                                                               age_start,
                      to_char(decode(rownum, 10, to_char(sysdate, 'yyyy'), 1900+ (rownum)*10-1))                   age_stop,
                      rownum                                                                                       age_range_order_id
           from    dual
           connect by rownum < 11
          ) age_range
    where  cm.student_id = s.student_id
    and      cm.marks >= 60
    and exists ( select 'x' from sampling_student_vw w
                     where  w.student_id = cm.student_id )
    and     to_char(s.birth_date, 'YYYY') between age_range.age_start and age_range.age_stop
) q
GROUP BY q.reporting_year, q.age_range_label, q.age_range_order_id

Hi Arsalan,
"Group by" is not a valid calculation option for calculated fields in the database object, nor is it for the calculation fields in your report.
I believe that what you are trying to achieve is to have a SUM of all the sales done, grouped by Brand. This is typically something you configure while building your report(in Active Studio).
If you for example would only want to show 2 out of 5 Brands in your report I suggest you use a filter(which is configured while building your report as well).
For all calculation and operation options in calculated fields you can go to the Help section of BAM and search for "Calculation Operators and Expressions".
I hope I helped you solve your problem.
Kind regards,
Martijn van der Kamp

Similar Messages

  • Bursting a report with multiple queries

    Hi,
    I need to set-up bursting in BIP for a report with multiple queries. The output format is pdf and delivery is through e-mail. Since the queries need to be linked, I'm trying to do this using data template. I've set-up split and burst based on a field (store_id) from the first query which is used as a bind variable in the subsequent queries. So I'd ideally want the report to be split based on store_id. The report works fine if I use a parameter for store_id and view the output by store_id. When I try to schedule the report for bursting, it generates and e-mails the reports but only the last report appears to have correct data output while the others have only the output from the first query (and all other queries appear to return nothing in the report).
    Any suggestions on what could be the issue here? Thanks!
    Here is the data template for the report:
    <dataTemplate name="Report" description="Report" dataSourceRef="ReportDB">
    <dataQuery>
    <sqlStatement name="STORE_VENDOR">
    <![CDATA[SELECT STORE.STORE_ID Q1_STORE_ID, VENDOR.VENDOR_ID Q1_VENDOR_ID, VENDOR.VENDOR_DESC Q1_VENDOR_DESC, PERSON.NAME Q1_NAME
                   FROM STORE, SERVICE_TICKET, VENDOR, ROLE, ROLE_TYPE, PERSON, PERIOD PERIOD_FROM, PERIOD PERIOD_TO
                   WHERE (SERVICE_TICKET.SOURCE_ID = STORE.SOURCE_ID AND SERVICE_TICKET.STORE_ID = STORE.STORE_ID)
                   AND (SERVICE_TICKET.SOURCE_ID = VENDOR.SOURCE_ID AND SERVICE_TICKET.VENDOR_ID = VENDOR.VENDOR_ID)
                   AND (STORE.SOURCE_ID = ROLE.SOURCE_ID AND STORE.STORE_ID = ROLE.STORE_ID)
                   AND (ROLE.SOURCE_ID = ROLE_TYPE.SOURCE_ID AND ROLE.ROLE_TYPE_ID = ROLE_TYPE.TYPE_ID AND ROLE_TYPE.TYPE_DESC = 'PIC')
                   AND (ROLE.SOURCE_ID = PERSON.SOURCE_ID AND ROLE.PERSON_ID = PERSON.PERSON_ID)
                   AND SERVICE_TICKET.START_DATE BETWEEN PERIOD_FROM.START_DATE AND PERIOD_TO.END_DATE
                   AND PERIOD_FROM.PERIOD_DESC = 'Cal Week 1'
                   AND PERIOD_TO.PERIOD_DESC = 'Cal Week 4'
                   GROUP BY STORE.STORE_ID, VENDOR.VENDOR_ID, VENDOR.VENDOR_DESC, PERSON.NAME
                   ORDER BY STORE.STORE_ID]]>
    </sqlStatement>
    <sqlStatement name="WO">
    <![CDATA[SELECT STORE.STORE_ID Q3_STORE_ID, 'Nightly Cleaning' Q3_NIGHTLY_CLEANING, 'Nightly Cleaning' Q3_DESCRIPTION, SERVICE_TICKET.TICKET_ID Q3_TICKET_ID, TO_CHAR(SERVICE_TICKET.END_DATE, 'MM/DD/YYYY') Q3_END_DATE, 'Excellent' Q3_QUALITY_RATING_1, 'Satisfactory' Q3_QUALITY_RATING_2, 'Unsatisfactory' Q3_QUALITY_RATING_3
                   FROM SERVICE_TICKET, STORE, PERIOD PERIOD_FROM, PERIOD PERIOD_TO
                   WHERE (SERVICE_TICKET.SOURCE_ID = STORE.SOURCE_ID AND SERVICE_TICKET.STORE_ID = STORE.STORE_ID)
                   AND SERVICE_TICKET.START_DATE BETWEEN PERIOD_FROM.START_DATE AND PERIOD_TO.END_DATE
                   AND STORE.STORE_ID = :Q1_STORE_ID
                   AND PERIOD_FROM.PERIOD_DESC = 'Cal Week 1'
                   AND PERIOD_TO.PERIOD_DESC = 'Cal Week 4']]>
    </sqlStatement>
    <sqlStatement name="SERVC_TYPE_1">
    <![CDATA[SELECT STORE.STORE_ID Q4_STORE_ID, ZONE.ZONE_DESC Q4_ZONE_DESC, SERVICE_TICKET_LINE.SERVICE_COST Q4_SERVICE_COST, SERVICE_TICKET_LINE.TICKET_ID Q4_TICKET_ID, TO_CHAR(SERVICE_TICKET_LINE.WO_END_DATE, 'MM/DD/YYYY') Q4_WO_END_DATE, 'Excellent' Q4_QUALITY_RATING_1, 'Satisfactory' Q4_QUALITY_RATING_2, 'Unsatisfactory' Q4_QUALITY_RATING_3
                   FROM SERVICE_TICKET_LINE, SERVICE_TICKET, STORE, SERVICE_TYPE, ZONE, PERIOD PERIOD_FROM, PERIOD PERIOD_TO
                   WHERE (SERVICE_TICKET.SOURCE_ID = SERVICE_TICKET_LINE.SOURCE_ID AND SERVICE_TICKET.TICKET_ID = SERVICE_TICKET_LINE.TICKET_ID)
                   AND (SERVICE_TICKET.SOURCE_ID = STORE.SOURCE_ID AND SERVICE_TICKET.STORE_ID = STORE.STORE_ID)
                   AND (SERVICE_TICKET_LINE.SOURCE_ID = SERVICE_TYPE.SOURCE_ID AND SERVICE_TICKET_LINE.SERVICE_TYPE_ID = SERVICE_TYPE.TYPE_ID)
                   AND (SERVICE_TICKET_LINE.SOURCE_ID = ZONE.SOURCE_ID AND SERVICE_TICKET_LINE.ZONE_ID = ZONE.ZONE_ID)
                   AND SERVICE_TYPE.TYPE_DESC = 'ABC'
                   AND SERVICE_TICKET.START_DATE BETWEEN PERIOD_FROM.START_DATE AND PERIOD_TO.END_DATE
                   AND STORE.STORE_ID = :Q1_STORE_ID
                   AND PERIOD_FROM.PERIOD_DESC = 'Cal Week 1'
                   AND PERIOD_TO.PERIOD_DESC = 'Cal Week 4'
                   ORDER BY SERVICE_TICKET_LINE.SOURCE_ID, SERVICE_TICKET_LINE.TICKET_ID, SERVICE_TICKET_LINE.LINE_ID]]>
    </sqlStatement>
    <sqlStatement name="SERVC_TYPE_2">
    <![CDATA[SELECT STORE.STORE_ID Q5_STORE_ID, ZONE.ZONE_DESC Q5_ZONE_DESC, SERVICE_TICKET_LINE.SERVICE_COST Q5_SERVICE_COST, SERVICE_TICKET_LINE.TICKET_ID Q5_TICKET_ID, TO_CHAR(SERVICE_TICKET_LINE.WO_END_DATE, 'MM/DD/YYYY') Q5_WO_END_DATE, 'Excellent' Q5_QUALITY_RATING_1, 'Satisfactory' Q5_QUALITY_RATING_2, 'Unsatisfactory' Q5_QUALITY_RATING_3
                   FROM SERVICE_TICKET_LINE, SERVICE_TICKET, STORE, SERVICE_TYPE, ZONE, PERIOD PERIOD_FROM, PERIOD PERIOD_TO
                   WHERE (SERVICE_TICKET.SOURCE_ID = SERVICE_TICKET_LINE.SOURCE_ID AND SERVICE_TICKET.TICKET_ID = SERVICE_TICKET_LINE.TICKET_ID)
                   AND (SERVICE_TICKET.SOURCE_ID = STORE.SOURCE_ID AND SERVICE_TICKET.STORE_ID = STORE.STORE_ID)
                   AND (SERVICE_TICKET_LINE.SOURCE_ID = SERVICE_TYPE.SOURCE_ID AND SERVICE_TICKET_LINE.SERVICE_TYPE_ID = SERVICE_TYPE.TYPE_ID)
                   AND (SERVICE_TICKET_LINE.SOURCE_ID = ZONE.SOURCE_ID AND SERVICE_TICKET_LINE.ZONE_ID = ZONE.ZONE_ID)
                   AND SERVICE_TYPE.TYPE_DESC = 'XYZ'
                   AND SERVICE_TICKET.START_DATE BETWEEN PERIOD_FROM.START_DATE AND PERIOD_TO.END_DATE
                   AND STORE.STORE_ID = :Q1_STORE_ID
                   AND PERIOD_FROM.PERIOD_DESC = 'Cal Week 1'
                   AND PERIOD_TO.PERIOD_DESC = 'Cal Week 4'
                   ORDER BY SERVICE_TICKET_LINE.SOURCE_ID, SERVICE_TICKET_LINE.TICKET_ID, SERVICE_TICKET_LINE.LINE_ID]]>
    </sqlStatement>
    <sqlStatement name="SERVC_TYPE_3">
    <![CDATA[SELECT STORE.STORE_ID Q6_STORE_ID, ZONE.ZONE_DESC Q6_ZONE_DESC, 'Excellent' Q6_QUALITY_RATING_1, 'Satisfactory' Q6_QUALITY_RATING_2, 'Unsatisfactory' Q6_QUALITY_RATING_3, 'One' Q6_QTY_MISSING_1, 'Two' Q6_QTY_MISSING_2, '3 or More' Q6_QTY_MISSING_3
                   FROM SERVICE_TICKET_LINE, SERVICE_TICKET, STORE, SERVICE_TYPE, ZONE, PERIOD PERIOD_FROM, PERIOD PERIOD_TO
                   WHERE (SERVICE_TICKET.SOURCE_ID = SERVICE_TICKET_LINE.SOURCE_ID AND SERVICE_TICKET.TICKET_ID = SERVICE_TICKET_LINE.TICKET_ID)
                   AND (SERVICE_TICKET.SOURCE_ID = STORE.SOURCE_ID AND SERVICE_TICKET.STORE_ID = STORE.STORE_ID)
                   AND (SERVICE_TICKET_LINE.SOURCE_ID = SERVICE_TYPE.SOURCE_ID AND SERVICE_TICKET_LINE.SERVICE_TYPE_ID = SERVICE_TYPE.TYPE_ID)
                   AND (SERVICE_TICKET_LINE.SOURCE_ID = ZONE.SOURCE_ID AND SERVICE_TICKET_LINE.ZONE_ID = ZONE.ZONE_ID)
                   AND SERVICE_TYPE.TYPE_DESC = 'PQR'
                   AND SERVICE_TICKET.START_DATE BETWEEN PERIOD_FROM.START_DATE AND PERIOD_TO.END_DATE
                   AND STORE.STORE_ID = :Q1_STORE_ID
                   AND PERIOD_FROM.PERIOD_DESC = 'Cal Week 1'
                   AND PERIOD_TO.PERIOD_DESC = 'Cal Week 4'
                   ORDER BY SERVICE_TYPE.TYPE_ID]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
         <group name="G_STORE_VENDOR" source="STORE_VENDOR">
              <element name="Q1_STORE_ID" value="Q1_STORE_ID"/>
              <element name="Q1_VENDOR_ID" value="Q1_VENDOR_ID"/>
              <element name="Q1_VENDOR_DESC" value="Q1_VENDOR_DESC"/>
              <element name="Q1_NAME" value="Q1_NAME"/>
         </group>     
         <group name="G_WO" source="WO">
              <element name="Q3_NIGHTLY_CLEANING" value="Q3_NIGHTLY_CLEANING"/>
              <element name="Q3_DESCRIPTION" value="Q3_DESCRIPTION"/>
              <element name="Q3_TICKET_ID" value="Q3_TICKET_ID"/>
              <element name="Q3_END_DATE" value="Q3_END_DATE"/>
              <element name="Q3_QUALITY_RATING_1" value="Q3_QUALITY_RATING_1"/>
              <element name="Q3_QUALITY_RATING_2" value="Q3_QUALITY_RATING_2"/>
              <element name="Q3_QUALITY_RATING_3" value="Q3_QUALITY_RATING_3"/>
         </group>     
         <group name="G_SERVC_TYPE_1" source="SERVC_TYPE_1">
              <element name="Q4_ZONE_DESC" value="Q4_ZONE_DESC"/>
              <element name="Q4_SERVICE_COST" value="Q4_SERVICE_COST"/>
              <element name="Q4_TICKET_ID" value="Q4_TICKET_ID"/>
              <element name="Q4_WO_END_DATE" value="Q4_WO_END_DATE"/>
              <element name="Q4_QUALITY_RATING_1" value="Q4_QUALITY_RATING_1"/>
              <element name="Q4_QUALITY_RATING_2" value="Q4_QUALITY_RATING_2"/>
              <element name="Q4_QUALITY_RATING_3" value="Q4_QUALITY_RATING_3"/>
         </group>     
         <group name="G_SERVC_TYPE_2" source="SERVC_TYPE_2">
              <element name="Q5_ZONE_DESC" value="Q5_ZONE_DESC"/>
              <element name="Q5_SERVICE_COST" value="Q5_SERVICE_COST"/>
              <element name="Q5_TICKET_ID" value="Q5_TICKET_ID"/>
              <element name="Q5_WO_END_DATE" value="Q5_WO_END_DATE"/>
              <element name="Q5_QUALITY_RATING_1" value="Q5_QUALITY_RATING_1"/>
              <element name="Q5_QUALITY_RATING_2" value="Q5_QUALITY_RATING_2"/>
              <element name="Q5_QUALITY_RATING_3" value="Q5_QUALITY_RATING_3"/>
         </group>     
         <group name="G_SERVC_TYPE_3" source="SERVC_TYPE_3">
              <element name="Q6_ZONE_DESC" value="Q6_ZONE_DESC"/>
              <element name="Q6_QUALITY_RATING_1" value="Q6_QUALITY_RATING_1"/>
              <element name="Q6_QUALITY_RATING_2" value="Q6_QUALITY_RATING_2"/>
              <element name="Q6_QUALITY_RATING_3" value="Q6_QUALITY_RATING_3"/>
              <element name="Q6_QTY_MISSING_1" value="Q6_QTY_MISSING_1"/>
              <element name="Q6_QTY_MISSING_2" value="Q6_QTY_MISSING_2"/>
              <element name="Q6_QTY_MISSING_3" value="Q6_QTY_MISSING_3"/>
         </group>
    </dataStructure>
    </dataTemplate>

    Hello user6428199,
    When you use ":Q1_STORE_ID" in your queries, BI Publisher looks for a report parameter named Q1_STORE_ID. Change all your report queries to get data for all the store_id's available. As you are bursting the report using the store_id as the bursting key, BI Publisher will split the report based on the stored_id and delivers content based on it. No matter how many queries you may have, BI Publisher will loop through all the store_id's available and all the queries will return data for that particular id in a report.
    Thanks,
    Machaan

  • Report with Multiple queries too slow in BI Publisher 11g

    Hi, I have a report in 11g where i need to create multiple queries to show them in report. I tried to combine everything in one query, but i found that the query is too huge and hard to understand and maintain. I created 3 data sets and linked them together. In SQL dev, the main query is returning about 315 records and first detail query returns less than 100 records and second detail query is returning one record which is BLOB. Each query returns data within a couple of seconds from SQL Developer. The entire report from BI Publisher should be just 21 page PDF output. Did anyone face performance issues while running reports with multiple queries in 11g? I ran reports that have single query which returned 10K pages PDF and never had an issue while everthing is in one query. This is the first time Iam attempting to create multiple queries. Can someone help me understand what i might be doing wrong or missing here. Thank you.

    Isn't there a way for you to do this via a Package/Procedure versus having multiple queries?
    Per the BI Publisher guide,
    Following are recommended guidelines for building data models:
    Reduce the number of data sets or queries in your data model as much as possible. In general, the fewer data sets and queries you have, the faster your data model will run. While multiquery data models are often easier to understand, single-query data models tend to execute more quickly. It is important to understand that in parent-child queries, for every parent, the child query is executed.
    You should only use multiquery data models in the following scenarios:
    To perform functions that the query type, such as a SQL query, does not support directly.
    To support complex views (for example, distributed queries or GROUP BY queries).
    To simulate a view when you do not have or want to use a view.
    Thanks,
    Bipuser

  • Single report with multiple queries OR multiple reports with single query

    Hello Experts,
    I have a confusion regarding Live Office connection for many days. I asked many people but did not get a concrete answer. I am re-posting this question here and expecting an answer this time.
    The product versions that I am using are as follows:
    FrontEnd:
      BOE XI 3.1 SP4 FP 4.1
      Xcelsius Enterprise 2008 SP4
    Backend:
      SAP BW 7.0 EHP1
    I have created a dashboard which is getting data from a webi report using LO connections.
    The webi report has five report parts which are populated by five different queries.
    Now my question is, when the five LO connections are refreshed, is the webi report refreshed five times or just once?
    If the report is refreshed five times, then I guess it is better to have five different webi reports containing single report part, because in that way we can prevent same query being executed multiple times.
    SO what is the best practice- to have a single report having multiple queries - OR - to create multiple webi reports with single query?
    Thanks and Regards,
    PASG

    HI
    I think Best Practice is Multiple reports with single query
    Any way If LO connections refresh 5 time the query will refresh 5 timesRegards
    Venkat

  • How to schedule one report for multiple company code?

    How you can schedule reports in BW 3.5? Suppose I need to schedule one report for multiple company code, how can you do that and notify the users? I do not want to send multiple emails to the same user if the report runs for 20 times (for 20 different companies).
    points are given for ASAP replies.
    Thanks in advance
    Peter

    Dear Peter,
    Try to restrict the Company Code with  those 20 values and schedule.
    Regards,
    Ramkumar.

  • Single input for multiple queries

    how can we have single input form for multiple queries in visual composer?

    Hi Amol,
    check this Wiki page:
    [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/connectingmultipleinputportstoonesingleform&|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/connectingmultipleinputportstoonesingleform&]
    For connecting a form with multiple queries you can create several transitions from your form to the input ports of the queries. You need a button in your form with the submit event. Select each transition from your form to the queries and rename the event to *submit. You need the asterisk for sending the data to all queries.
    Best Regards,
    Marcel

  • Portal Activity Reports for multiple groups

    Hi,
    Can the report display the count of users belonging to multiple groups or would it have to be created seperately for each group. I have tried to use wild cards and commas and nothing worked, the field does not accept more than one valid group name to be entered. Any ideas how to work around this without having to create a different report for different groups?
    Thanks

    Hi EAmin,
    You can only show information about users who belong to a specific group and not multiple groups. But if you want to show users in multiple groups, you can create a new group (say temp) and add the other groups to temp. Now, configure the report to display users in group temp.
    Rajiv

  • Oracle Ad-hoc report with multiple queries creating issues

    Hi Guys,
    I have been having multiple issues (one after the other) in trying to generate a report for Business user. Let me start with my test cases and yes, this time I have made sure by testing and dirtying my hands that the test cases work properly and commit into the database (I will be more than happy to provide screen shots of the same).
    Test Case:
    Tables:RETURNS & RETURN_LINE_ITEMS
    CREATE TABLE RETURNS
      ID                    NUMBER(12),
      PROG_PROGRAM_CD       VARCHAR2(2 BYTE),
      ACCT_ID               NUMBER(12),
      ACPE_ID               NUMBER(12),
      JENT_ID               NUMBER(12),
      PREV_RTRN_ID          NUMBER(12),
      ENTP_ABN              NUMBER(9),
      ACCT_OCCURNC_NBR      NUMBER(4),
      SOURCE_TYPE           VARCHAR2(30 BYTE)       DEFAULT 'BLANK',
      RECEIVE_DATE          DATE,
      AMEND_IND             VARCHAR2(1 BYTE)        DEFAULT 'N',
      CMPLT_IND             VARCHAR2(1 BYTE)        DEFAULT 'N',
      PENALTY_OR_IND        VARCHAR2(1 BYTE)        DEFAULT 'N',
      RETURN_STATUS         VARCHAR2(12 BYTE),
      STATUS_DATE           DATE,
      STATUS_USERID         VARCHAR2(8 BYTE),
      PERIOD_START_DATE     DATE,
      PERIOD_END_DATE       DATE,
      NOTICE_STATUS         VARCHAR2(12 BYTE),
      NOTICE_STATUS_DATE    DATE,
      NOTE_TEXT             VARCHAR2(2000 BYTE),
      PENALTY_OR_BY         VARCHAR2(8 BYTE),
      PENALTY_OR_TMST       DATE,
      FILING_ID             NUMBER(12),
      CASE_ID               VARCHAR2(49 BYTE),
      DOC_CONTRL_NBR        NUMBER(29),
      LOCTR_NBR             NUMBER(10),
      STATUTE_BARRED_DATE   DATE,
      MEDIA_TYPE            VARCHAR2(30 BYTE),
      DISPSTN_TYPE          VARCHAR2(30 BYTE),
      AMEND_TYPE            VARCHAR2(30 BYTE),
      CALC_MODE             VARCHAR2(30 BYTE),
      PROCESS_PASS_CNT      NUMBER(1),
      CONVRTD_IND           VARCHAR2(1 BYTE)        DEFAULT 'N',
      LOSS_PERIOD_END_DATE  DATE,
      MF_SYNC_CD            VARCHAR2(1 BYTE)
    CREATE TABLE RETURN_LINE_ITEMS
      ID                       NUMBER(12),
      RTSC_ID                  NUMBER(12),
      RTRN_ID                  NUMBER(12),
      SCLI_ID                  NUMBER(12),
      LITM_ID                  NUMBER(12),
      ENTP_ABN                 NUMBER(9),
      PROG_PROGRAM_CD          VARCHAR2(2 BYTE),
      ACCT_OCCURNC_NBR         NUMBER(4),
      ACPE_END_DATE            DATE,
      SCHED_NBR                VARCHAR2(3 BYTE),
      SCHD_VERSION_YR          NUMBER(4)            DEFAULT 0,
      SCHD_VERSION_NBR         NUMBER(3),
      RTSC_OCCUR_NBR           NUMBER(3),
      LITM_LINE_ITEM_NBR       VARCHAR2(3 BYTE),
      SLIN_LINE_ITEM_ID        NUMBER(12),
      OCCUR_NBR                NUMBER(3)            DEFAULT 1,
      PREV_VAL_MOD_IND         VARCHAR2(1 BYTE)     DEFAULT 'N',
      VIABLE_IND               VARCHAR2(1 BYTE)     DEFAULT 'N',
      ACTIVE_IND               VARCHAR2(1 BYTE)     DEFAULT 'Y',
      ACTION_CD                VARCHAR2(1 BYTE),
      PREV_VAL_AMT             NUMBER(15,2),
      REVISE_VAL_AMT           NUMBER(15,2),
      PREV_VAL_TEXT            VARCHAR2(100 BYTE),
      REVISE_VAL_TEXT          VARCHAR2(100 BYTE),
      DISPLAY_SEQ_NBR          NUMBER(3),
      SYS_VAL_AMT              NUMBER(15,2),
      LITM_INNER_PASS_SEQ_NBR  NUMBER(3)
    Inserting data into RETURNS table
    INSERT INTO RETURNS (
    ID                  ,
    PROG_PROGRAM_CD      ,
    ACCT_ID              ,
    ACPE_ID              ,
    JENT_ID              ,
    PREV_RTRN_ID         ,
    ENTP_ABN             ,
    ACCT_OCCURNC_NBR     ,
    SOURCE_TYPE          ,
    RECEIVE_DATE         ,
    AMEND_IND            ,
    CMPLT_IND            ,
    PENALTY_OR_IND       ,
    RETURN_STATUS        ,
    STATUS_DATE          ,
    STATUS_USERID        ,
    PERIOD_START_DATE    ,
    PERIOD_END_DATE      ,
    NOTICE_STATUS        ,
    NOTICE_STATUS_DATE   ,
    NOTE_TEXT            ,
    PENALTY_OR_BY        ,
    PENALTY_OR_TMST      ,
    FILING_ID            ,
    CASE_ID              ,
    DOC_CONTRL_NBR       ,
    LOCTR_NBR            ,
    STATUTE_BARRED_DATE  ,
    MEDIA_TYPE           ,
    DISPSTN_TYPE         ,
    AMEND_TYPE           ,
    CALC_MODE            ,
    PROCESS_PASS_CNT     ,
    CONVRTD_IND          ,
    LOSS_PERIOD_END_DATE ,
    MF_SYNC_CD)          
    VALUES(
    3715944,
    '01',
    139048,
    3587419,
    9518324,
    NULL,
    401377197,
    1,
    'TAXPAYER',
    TO_DATE('4/7/2009','mm/dd/yyyy'),
    'N',
    'Y',
    'N',
    'ASSESSED',
    TO_DATE('4/30/2009','mm/dd/yyyy'),
    'TRAPROD2',
    TO_DATE('2/1/2008','mm/dd/yyyy'),
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),
    'PRINTED',
    TO_DATE('4/30/2009'     , 'mm/dd/yyyy'),
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    6045574495,
    NULL,
    'RSI',
    'NOTICE',
    NULL,
    NULL,
    NULL,
    'N',
    NULL,
    NULL);
    NSERT INTO RETURNS (
    ID                  ,
    PROG_PROGRAM_CD      ,
    ACCT_ID              ,
    ACPE_ID              ,
    JENT_ID              ,
    PREV_RTRN_ID         ,
    ENTP_ABN             ,
    ACCT_OCCURNC_NBR     ,
    SOURCE_TYPE          ,
    RECEIVE_DATE         ,
    AMEND_IND            ,
    CMPLT_IND            ,
    PENALTY_OR_IND       ,
    RETURN_STATUS        ,
    STATUS_DATE          ,
    STATUS_USERID        ,
    PERIOD_START_DATE    ,
    PERIOD_END_DATE      ,
    NOTICE_STATUS        ,
    NOTICE_STATUS_DATE   ,
    NOTE_TEXT            ,
    PENALTY_OR_BY        ,
    PENALTY_OR_TMST      ,
    FILING_ID            ,
    CASE_ID              ,
    DOC_CONTRL_NBR       ,
    LOCTR_NBR            ,
    STATUTE_BARRED_DATE  ,
    MEDIA_TYPE           ,
    DISPSTN_TYPE         ,
    AMEND_TYPE           ,
    CALC_MODE            ,
    PROCESS_PASS_CNT     ,
    CONVRTD_IND          ,
    LOSS_PERIOD_END_DATE ,
    MF_SYNC_CD)          
    VALUES(
    4117092,
    '01',
    57794,
    3864551,
    10566221,
    NULL,
    400571410,
    1,
    'TAXPAYER',
    TO_DATE('6/30/2010', 'mm/dd/yyyy'),
    'N',
    'Y',
    'N',
    'ASSESSED',
    TO_DATE('7/27/2010','mm/dd/yyyy'),
    'TRAPROD2',
    TO_DATE('1/1/2009','mm/dd/yyyy'),
    TO_DATE('12/31/2009','mm/dd/yyyy'),
    'PRINTED',
    TO_DATE('7/27/2010','mm/dd/yyyy'),
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    6053117120,
    NULL,
    'RSI',
    'NOTICE',
    NULL,
    NULL,
    NULL,
    'N',
    NULL,
    NULL);
    INSERT INTO RETURNS (
    ID                  ,
    PROG_PROGRAM_CD      ,
    ACCT_ID              ,
    ACPE_ID              ,
    JENT_ID              ,
    PREV_RTRN_ID         ,
    ENTP_ABN             ,
    ACCT_OCCURNC_NBR     ,
    SOURCE_TYPE          ,
    RECEIVE_DATE         ,
    AMEND_IND            ,
    CMPLT_IND            ,
    PENALTY_OR_IND       ,
    RETURN_STATUS        ,
    STATUS_DATE          ,
    STATUS_USERID        ,
    PERIOD_START_DATE    ,
    PERIOD_END_DATE      ,
    NOTICE_STATUS        ,
    NOTICE_STATUS_DATE   ,
    NOTE_TEXT            ,
    PENALTY_OR_BY        ,
    PENALTY_OR_TMST      ,
    FILING_ID            ,
    CASE_ID              ,
    DOC_CONTRL_NBR       ,
    LOCTR_NBR            ,
    STATUTE_BARRED_DATE  ,
    MEDIA_TYPE           ,
    DISPSTN_TYPE         ,
    AMEND_TYPE           ,
    CALC_MODE            ,
    PROCESS_PASS_CNT     ,
    CONVRTD_IND          ,
    LOSS_PERIOD_END_DATE ,
    MF_SYNC_CD)          
    VALUES(
    4382179,
    '01',
    498210,
    3957251,
    11264174,
    3727534,
    405079963,
    1,
    'TAXPAYER',
    TO_DATE('4/26/2011', 'mm/dd/yyyy'),
    'Y',
    'Y',
    'N',
    'ASSESSED',
    TO_DATE('5/12/2011','mm/dd/yyyy'),
    'LOPATS',
    TO_DATE('2/1/2008', 'mm/dd/yyyy'),
    TO_DATE('1/31/2009','mm/dd/yyyy'),
    'PRINTED',
    TO_DATE('5/12/2011','mm/dd/yyyy'),
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    6058767341,
    TO_DATE('4/30/2015','mm/dd/yyyy'),
    'RSI',
    'NOTICE',
    'LOSS CARRY BACK (SIMPLE)',
    'LOSS CARRY BACK',
    NULL,
    'N',
    TO_DATE('1/31/2011', 'mm/dd/yyyy'),
    NULL
    Now inserting data into 2nd table i.e. RETURN_LINE_ITEMS
    RTRN_ID means RETURN ID
    This is for RTRN_ID =3715944
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES(
    277707088,
    8022477,
    3715944,
    NULL,
    1585,
    401377197,
    '01',
    1,
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '029',
    23,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    1,
    1,
    NULL,
    NULL,
    115,
    1 ,
    1);
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES
    277707106,
    8022477,
    3715944,
    NULL,
    1603,
    401377197,
    '01',
    1,
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '062',
    40,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    1069336,
    1069336,
    NULL,
    NULL,
    200,
    1069336,
    130
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES
    (277707109,
    8022477,
    3715944,
    NULL,
    1539,
    401377197,
    '01',
    1,
    TO_DATE('1/31/2009','mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '066',
    43,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    NULL,
    1000,
    'NULL',
    'NULL',
    215,
    1069336,
    200);Now for RTRN_ID = 4117092
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES(
    319820214,
    9028477,
    4117092,
    NULL,
    1585,
    400571410,
    '01',
    1,
    TO_DATE('12/31/2009','mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '029',
    23,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    3,
    3,
    NULL,
    NULL,
    115,
    3,
    1
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES(
    319820233,
    9028477,
    4117092,
    NULL,
    1603,
    400571410,
    '01',
    1,
    TO_DATE('12/31/2009','mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '062',
    40,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    790068,
    790068,
    NULL,
    NULL,
    200,
    790068,
    130
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES
    319820236,
    9028477,
    4117092,
    NULL,
    1539,
    400571410,
    '01',
    1,
    TO_DATE('12/31/2009','mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '066',
    43,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    NULL,
    790,
    NULL,
    NULL,
    215,
    790068,
    200
    Now finally for RTRN_ID = 4382179
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES
    348462584,
    9694297,
    4382179,
    NULL,
    1585,
    405079963,
    '01',
    1,
    TO_DATE(1/31/2009, 'mm/dd/yyyy'),
    '000'
    1998,
    1,
    1,
    '029',
    23,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    1,
    1,
    NULL,
    NULL,
    115,
    NULL,
    1
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES
    348462602,
    9694297,
    4382179,
    NULL,
    1603,
    405079963,
    '01',
    1,
    TO_DATE('1/31/2009','mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '062',
    40,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    672738,
    643304,
    NULL,
    NULL,
    200,
    NULL,
    130
    INSERT INTO RETURN_LINE_ITEMS (
    ID                      ,
    RTSC_ID                 ,
    RTRN_ID                 ,
    SCLI_ID                 ,
    LITM_ID                 ,
    ENTP_ABN                ,
    PROG_PROGRAM_CD         ,
    ACCT_OCCURNC_NBR        ,
    ACPE_END_DATE           ,
    SCHED_NBR               ,
    SCHD_VERSION_YR         ,
    SCHD_VERSION_NBR        ,
    RTSC_OCCUR_NBR          ,
    LITM_LINE_ITEM_NBR      ,
    SLIN_LINE_ITEM_ID       ,
    OCCUR_NBR               ,
    PREV_VAL_MOD_IND        ,
    VIABLE_IND              ,
    ACTIVE_IND              ,
    ACTION_CD               ,
    PREV_VAL_AMT            ,
    REVISE_VAL_AMT          ,
    PREV_VAL_TEXT           ,
    REVISE_VAL_TEXT         ,
    DISPLAY_SEQ_NBR         ,
    SYS_VAL_AMT             ,
    LITM_INNER_PASS_SEQ_NBR  
    VALUES
    348462605,
    9694297,
    4382179,
    NULL,
    1539,
    405079963,
    01,
    1,
    TO_DATE('1/31/2009','mm/dd/yyyy'),
    '000',
    1998,
    1,
    1,
    '066',
    43,
    1,
    'N',
    'Y',
    'Y',
    NULL,
    672738,
    643304,
    NULL,
    NULL,
    215,
    643304,
    200
    );OK. Now once this data is all inserted, comes the real problem and that is:
    a) based on the following requirements
    Requirements: Adhoc Report for Audit on CIT Income Allocation
    1. Select from the RETURNS table:
    • Id > 3600000 and
    • Prog_program_cd = '01' and
    • Return_status in ('ASSESSED', 'DU") and
    • Tax year ending in 2009 (i.e. year portion of the Period_end_date is in 2009)
    2. Retrieve the following fields from the RETURNS table :
    • Id
    • Entp_abn
    • Acct_id
    • Prog_program_cd
    • Period_start_date
    • Period_end_date
    • Amend_ind
    • Return_status
    • Status_date
    • Loctr_nbr
    3. If there are multiple entries from the same account and tax year, only retain the latest record: From the records selected in step 2, if there are multiple records with the same Acct_Id and Period_end_date, only retain the record with the most recent Status_date (i.e. MAX value on the date).
    4. Using the results from step 3, link to the applicable RETURN_LINE_ITEMS table where:
    • RETURNS.Id = RETURN_LINE_ITEMS.Rtrn_Id
    5. From the selected return on RETURN_LINE_ITEMS table, retrieve records where (value on Sch 000 Line 062 > 500,000) and (value on Sch 000 Line 066 < value on Sch 000 Line 062) :
    • Sched_nbr = '000', and Litm_line_item_nbr = '062', and Active_ind = 'Y', get Revise_val_amt as 'ab_taxable_income'
    • Sched_nbr = '000', and Litm_line_item_nbr = '066', and Active_ind = 'Y', get Revise_val_amt as 'amt_taxable_in_ab'
    • Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
    I utilized the following query and I am getting 4 rows (line item numbers 062 and 066 where in ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income) and this is correct
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062',  RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066',  RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
    from returns r1, return_line_items rtlnms
    where
    r1.id = rtlnms.rtrn_id and
    r1.prog_program_cd = rtlnms.prog_program_cd and
    r1.entp_abn = rtlnms.entp_abn and
    r1.id > 3600000 AND r1.prog_program_cd = '01' AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and rtlnms.active_ind = 'Y'
    and r1.id in (4117092,3715944,4382179,3691435)
    and RTLNMS.LITM_LINE_ITEM_NBR IN('062')
    AND nvl(decode(litm_line_item_nbr, '062',  REVISE_VAL_AMT),0) > 500000
    and NVL(RTLNMS.REVISE_VAL_AMT,0) >( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
                                                           FROM RETURN_LINE_ITEMS RTLNMS2 
                                                           WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
                                                           AND  RTLNMS2.LITM_LINE_ITEM_NBR = '066'
                                                           AND SCHED_NBR='000'
    UNION
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062',  RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066',  RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB
    from returns r1, return_line_items rtlnms
    where r1.id = rtlnms.rtrn_id
    AND r1.prog_program_cd = rtlnms.prog_program_cd
    AND r1.entp_abn = rtlnms.entp_abn
    AND r1.id > 3600000 AND r1.prog_program_cd = '01'
    AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and rtlnms.active_ind = 'Y'
    and r1.id in (4117092,3715944,4382179,3691435)
    and RTLNMS.LITM_LINE_ITEM_NBR IN('066')
    and NVL(RTLNMS.REVISE_VAL_AMT,0) <( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
                                                           FROM RETURN_LINE_ITEMS RTLNMS2 
                                                           WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
                                                           AND  RTLNMS2.LITM_LINE_ITEM_NBR = '062'
                                                           and  NVL(RTLNMS2.REVISE_VAL_AMT,0)>500000
                                                           AND SCHED_NBR='000'
    order by IDHowever there is another condition after "5c" i.e. after Retain the return only if (ab_taxable_income > 500,000) and (amt_taxable_in_ab < ab_taxable_income)
    and that is:
    For those returns meeting the criteria in step 5, also retrieve the following from RETURN_LINE_ITEMS table and that is:
    sched_nbr = '000' and Litm_line_item_nbr = '029' and ACTIVE_IND ='Y', get Revise_val_amt as "corp_type"
    and in order to go about this, I utilised the following query:
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062',  RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066',  RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB,
    decode(rtlnms.litm_line_item_nbr, '029',  RTLNMS.REVISE_VAL_AMT)CORP_INCOME
    from returns r1, return_line_items rtlnms
    where
    r1.id = rtlnms.rtrn_id and
    r1.prog_program_cd = rtlnms.prog_program_cd and
    r1.entp_abn = rtlnms.entp_abn and
    r1.id > 3600000 AND r1.prog_program_cd = '01' AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and rtlnms.active_ind = 'Y'
    and r1.id in (4117092,3715944,4382179,3691435)
    and RTLNMS.LITM_LINE_ITEM_NBR IN('062')
    AND nvl(decode(litm_line_item_nbr, '062',  REVISE_VAL_AMT),0) > 500000
    and NVL(RTLNMS.REVISE_VAL_AMT,0) >( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
                                                           FROM RETURN_LINE_ITEMS RTLNMS2 
                                                           WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
                                                           AND  RTLNMS2.LITM_LINE_ITEM_NBR IN( '066')
                                                           AND SCHED_NBR='000'
    UNION
    SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd, r1.period_start_date, r1.period_end_Date, r1.amend_ind, r1.return_status, r1.status_date, r1.loctr_nbr,
    rtlnms.sched_nbr, rtlnms.litm_line_item_nbr,
    decode(rtlnms.litm_line_item_nbr, '062',  RTLNMS.REVISE_VAL_AMT)AB_TAXABLE_INCOME,
    decode(rtlnms.litm_line_item_nbr, '066',  RTLNMS.REVISE_VAL_AMT)AMT_TAXABLE_IN_AB,
    decode(rtlnms.litm_line_item_nbr, '029',  RTLNMS.REVISE_VAL_AMT)CORP_INCOME
    from returns r1, return_line_items rtlnms
    where r1.id = rtlnms.rtrn_id
    AND r1.prog_program_cd = rtlnms.prog_program_cd
    AND r1.entp_abn = rtlnms.entp_abn
    AND r1.id > 3600000 AND r1.prog_program_cd = '01'
    AND r1.return_status in ('ASSESSED', 'DU')
    and r1.period_end_Date between to_date('01-01-2009','DD-mm-YYYY') and to_date ('31-12-2009', 'DD-mm-YYYY')
    and r1.status_date = (select max (status_date) from returns r2 where r2. acct_id= r1.acct_id and r2.period_end_date = r1.period_end_date)
    and rtlnms.sched_nbr = '000'
    and rtlnms.active_ind = 'Y'
    and r1.id in (4117092,3715944,4382179,3691435)
    and RTLNMS.LITM_LINE_ITEM_NBR IN('066','029')
    and NVL(RTLNMS.REVISE_VAL_AMT,0) <  ( select NVL(RTLNMS2.REVISE_VAL_AMT,0)
                                                           FROM RETURN_LINE_ITEMS RTLNMS2 
                                                           WHERE RTLNMS2.RTRN_ID=RTLNMS.RTRN_ID
                                                           AND  RTLNMS2.LITM_LINE_ITEM_NBR='062'
                                                           and  NVL(RTLNMS2.REVISE_VAL_AMT,0)>500000
                                                             AND SCHED_NBR='000'
    order by ID                                                          
    My output is: 7 rows i.e.
    3 rows of return id = 3715944,
    3 rows of return id = 4117092
    and 1 row of return id = 4382179
    It should only retrieve rows for 3715944 and 4117092; not for row =4382179 and this is because based on question in 5 "c", rows retrieved were for return ids' = 3715944 and 4117092
    I know where the problem is:
    As soon as it retrieves rows for returns 3715944 and 4117092 (because REVISE_VAL_AMT is greater than 500,000), it also finds another record with return id = 4382179 with greater than 500,000 and it blindly brings that as well.
    Is there a way around to ensure that I my results are compared only against the return id's retrieved from 5 "c" = 3715944 and 4117092
    Believe me I have tried every option that I could think of to remove return id = 4382179 but somehow could not.
    Dear Gurus @ OTN, please help me.
    Thanks,
    Sandeep

    Thanks for your words of wisdom guys. Appreciate it.
    Anyways what ever I asked, I was able to get solution for it by using an inline query and it's as follows:
    SELECT id, entp_abn, acct_id, prog_program_cd, period_start_date,                 
             period_end_date, amend_ind, return_status, status_date, loctr_nbr,           
             ab_taxable_income, amt_taxable_in_ab                                         
    FROM   (SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,                
                  r1.period_start_date, r1.period_end_date, r1.amend_ind,                    
                  r1.return_status, r1.status_date, r1.loctr_nbr,                            
                  SUM                                                                        
                    (DECODE                                                                  
                   (rtlnms.litm_line_item_nbr,                                                  
                    '062', rtlnms.revise_val_amt)) ab_taxable_income,                           
                  SUM                                                                        
                    (DECODE                                                                  
                   (rtlnms.litm_line_item_nbr,                                                  
                    '066', rtlnms.revise_val_amt)) amt_taxable_in_ab                            
              FROM   returns r1, return_line_items rtlnms                                 
              WHERE  r1.id = rtlnms.rtrn_id                                               
              AND    r1.id > 3600000                                                      
              AND    r1.prog_program_cd = '01'                                            
              AND    r1.return_status IN ('ASSESSED', 'DU')                               
              AND    r1.period_end_date BETWEEN                                           
                  TO_DATE ('01-01-2009', 'DD-MM-YYYY') AND                                   
                  TO_DATE ('31-12-2009', 'DD-MM-YYYY')                                       
              AND    rtlnms.sched_nbr = '000'                                             
              AND    rtlnms.active_ind = 'Y'                                              
              AND    r1.status_date =                                                     
                  (SELECT MAX (status_date)                                                  
                   FROM   returns r2                                                         
                   WHERE  r2. acct_id= r1.acct_id                                            
                   AND    r2.period_end_date = r1.period_end_date)                           
              GROUP  BY r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,               
                     r1.period_start_date, r1.period_end_date, r1.amend_ind,                 
                     r1.return_status, r1.status_date, r1.loctr_nbr)                         
    WHERE  ab_taxable_income > 500000                                                 
    AND    amt_taxable_in_ab < ab_taxable_income                                      
    ORDER  BY id                                                                      
    *OUTPUT*
            ID   ENTP_ABN    ACCT_ID PR PERIOD_ST PERIOD_EN A RETURN_STATU STATUS_DA  LOCTR_NBR AB_TAXABLE_INCOME AMT_TAXABLE_IN_AB
       3715944  401377197     139048 01 01-FEB-08 31-JAN-09 N ASSESSED     30-APR-09 6045574495           1069336              1000
       4117092  400571410      57794 01 01-JAN-09 31-DEC-09 N ASSESSED     27-JUL-10 6053117120            790068               790
    2 rows selected.Anyways I am stuck in another issue and that is:
    Based on what I have received above - I have been given a new requirement and that is:
    retrieve the corresponding Schedule 002 data (if exist) from the RETURN_LINE_ITEMS table:
    *•     Sched_nbr = ‘002’, and Litm_line_item_nbr = ‘001’, and Active_ind = ‘Y’, get Revise_val_amt as ‘special_allocation’*
    *•     Sched_nbr = ‘002’, and Litm_line_item_nbr = ‘002’, and Active_ind = ‘Y’, get Revise_val_amt as ‘ab_salaries_wages’*
    So in order to do this, I committed 5 additional rows with schedule number 002 and they are as follows:
    INSERT INTO RETURN_LINE_ITEMS (                
    ID                      ,                      
    RTSC_ID                 ,                      
    RTRN_ID                 ,                      
    SCLI_ID                 ,                      
    LITM_ID                 ,                      
    ENTP_ABN                ,                      
    PROG_PROGRAM_CD         ,                      
    ACCT_OCCURNC_NBR        ,                      
    ACPE_END_DATE           ,                      
    SCHED_NBR               ,                      
    SCHD_VERSION_YR         ,                      
    SCHD_VERSION_NBR        ,                      
    RTSC_OCCUR_NBR          ,                      
    LITM_LINE_ITEM_NBR      ,                      
    SLIN_LINE_ITEM_ID       ,                      
    OCCUR_NBR               ,                      
    PREV_VAL_MOD_IND        ,                      
    VIABLE_IND              ,                      
    ACTIVE_IND              ,                      
    ACTION_CD               ,                      
    PREV_VAL_AMT            ,                      
    REVISE_VAL_AMT          ,                      
    PREV_VAL_TEXT           ,                      
    REVISE_VAL_TEXT         ,                      
    DISPLAY_SEQ_NBR         ,                      
    SYS_VAL_AMT             ,                      
    LITM_INNER_PASS_SEQ_NBR                        
    VALUES                                         
    626121,                                        
    118320,                                        
    3715944,                                       
    NULL,                                          
    2322,                                          
    401377197,                                     
    '01',                                          
    1,                                             
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),            
    '002',                                         
    1981,                                          
    1,                                             
    1,                                             
    '001',                                         
    78,                                            
    1,                                             
    'N',                                           
    'Y',                                           
    'Y',                                           
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    5,                                             
    NULL,                                          
    40                                             
    INSERT INTO RETURN_LINE_ITEMS (                
    ID                      ,                      
    RTSC_ID                 ,                      
    RTRN_ID                 ,                      
    SCLI_ID                 ,                      
    LITM_ID                 ,                      
    ENTP_ABN                ,                      
    PROG_PROGRAM_CD         ,                      
    ACCT_OCCURNC_NBR        ,                      
    ACPE_END_DATE           ,                      
    SCHED_NBR               ,                      
    SCHD_VERSION_YR         ,                      
    SCHD_VERSION_NBR        ,                      
    RTSC_OCCUR_NBR          ,                      
    LITM_LINE_ITEM_NBR      ,                      
    SLIN_LINE_ITEM_ID       ,                      
    OCCUR_NBR               ,                      
    PREV_VAL_MOD_IND        ,                      
    VIABLE_IND              ,                      
    ACTIVE_IND              ,                      
    ACTION_CD               ,                      
    PREV_VAL_AMT            ,                      
    REVISE_VAL_AMT          ,                      
    PREV_VAL_TEXT           ,                      
    REVISE_VAL_TEXT         ,                      
    DISPLAY_SEQ_NBR         ,                      
    SYS_VAL_AMT             ,                      
    LITM_INNER_PASS_SEQ_NBR                        
    VALUES                                         
    626121,                                        
    118320,                                        
    3715944,                                       
    NULL,                                          
    2322,                                          
    401377197,                                     
    '01',                                          
    1,                                             
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),            
    '002',                                         
    1981,                                          
    1,                                             
    1,                                             
    '002',                                         
    78,                                            
    1,                                             
    'N',                                           
    'Y',                                           
    'Y',                                           
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    5,                                             
    NULL,                                          
    40                                             
    INSERT INTO RETURN_LINE_ITEMS (                
    ID                      ,                      
    RTSC_ID                 ,                      
    RTRN_ID                 ,                      
    SCLI_ID                 ,                      
    LITM_ID                 ,                      
    ENTP_ABN                ,                      
    PROG_PROGRAM_CD         ,                      
    ACCT_OCCURNC_NBR        ,                      
    ACPE_END_DATE           ,                      
    SCHED_NBR               ,                      
    SCHD_VERSION_YR         ,                      
    SCHD_VERSION_NBR        ,                      
    RTSC_OCCUR_NBR          ,                      
    LITM_LINE_ITEM_NBR      ,                      
    SLIN_LINE_ITEM_ID       ,                      
    OCCUR_NBR               ,                      
    PREV_VAL_MOD_IND        ,                      
    VIABLE_IND              ,                      
    ACTIVE_IND              ,                      
    ACTION_CD               ,                      
    PREV_VAL_AMT            ,                      
    REVISE_VAL_AMT          ,                      
    PREV_VAL_TEXT           ,                      
    REVISE_VAL_TEXT         ,                      
    DISPLAY_SEQ_NBR         ,                      
    SYS_VAL_AMT             ,                      
    LITM_INNER_PASS_SEQ_NBR                        
    VALUES                                         
    626121,                                        
    118320,                                        
    3715944,                                       
    NULL,                                          
    2322,                                          
    401377197,                                     
    '01',                                          
    1,                                             
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),            
    '002',                                         
    1981,                                          
    1,                                             
    1,                                             
    '004',                                         
    78,                                            
    1,                                             
    'N',                                           
    'Y',                                           
    'Y',                                           
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    5,                                             
    NULL,                                          
    40                                             
    INSERT INTO RETURN_LINE_ITEMS (                
    ID                      ,                      
    RTSC_ID                 ,                      
    RTRN_ID                 ,                      
    SCLI_ID                 ,                      
    LITM_ID                 ,                      
    ENTP_ABN                ,                      
    PROG_PROGRAM_CD         ,                      
    ACCT_OCCURNC_NBR        ,                      
    ACPE_END_DATE           ,                      
    SCHED_NBR               ,                      
    SCHD_VERSION_YR         ,                      
    SCHD_VERSION_NBR        ,                      
    RTSC_OCCUR_NBR          ,                      
    LITM_LINE_ITEM_NBR      ,                      
    SLIN_LINE_ITEM_ID       ,                      
    OCCUR_NBR               ,                      
    PREV_VAL_MOD_IND        ,                      
    VIABLE_IND              ,                      
    ACTIVE_IND              ,                      
    ACTION_CD               ,                      
    PREV_VAL_AMT            ,                      
    REVISE_VAL_AMT          ,                      
    PREV_VAL_TEXT           ,                      
    REVISE_VAL_TEXT         ,                      
    DISPLAY_SEQ_NBR         ,                      
    SYS_VAL_AMT             ,                      
    LITM_INNER_PASS_SEQ_NBR                        
    VALUES                                         
    626121,                                        
    118320,                                        
    3715944,                                       
    NULL,                                          
    2322,                                          
    401377197,                                     
    '01',                                          
    1,                                             
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),            
    '002',                                         
    1981,                                          
    1,                                             
    1,                                             
    '006',                                         
    78,                                            
    1,                                             
    'N',                                           
    'Y',                                           
    'Y',                                           
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    5,                                             
    NULL,                                          
    40                                             
    INSERT INTO RETURN_LINE_ITEMS (                
    ID                      ,                      
    RTSC_ID                 ,                      
    RTRN_ID                 ,                      
    SCLI_ID                 ,                      
    LITM_ID                 ,                      
    ENTP_ABN                ,                      
    PROG_PROGRAM_CD         ,                      
    ACCT_OCCURNC_NBR        ,                      
    ACPE_END_DATE           ,                      
    SCHED_NBR               ,                      
    SCHD_VERSION_YR         ,                      
    SCHD_VERSION_NBR        ,                      
    RTSC_OCCUR_NBR          ,                      
    LITM_LINE_ITEM_NBR      ,                      
    SLIN_LINE_ITEM_ID       ,                      
    OCCUR_NBR               ,                      
    PREV_VAL_MOD_IND        ,                      
    VIABLE_IND              ,                      
    ACTIVE_IND              ,                      
    ACTION_CD               ,                      
    PREV_VAL_AMT            ,                      
    REVISE_VAL_AMT          ,                      
    PREV_VAL_TEXT           ,                      
    REVISE_VAL_TEXT         ,                      
    DISPLAY_SEQ_NBR         ,                      
    SYS_VAL_AMT             ,                      
    LITM_INNER_PASS_SEQ_NBR                        
    VALUES                                         
    626121,                                        
    118320,                                        
    3715944,                                       
    NULL,                                          
    2322,                                          
    401377197,                                     
    '01',                                          
    1,                                             
    TO_DATE('1/31/2009', 'mm/dd/yyyy'),            
    '002',                                         
    1981,                                          
    1,                                             
    1,                                             
    '008',                                         
    78,                                            
    1,                                             
    'N',                                           
    'Y',                                           
    'Y',                                           
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    NULL,                                          
    5,                                             
    NULL,                                          
    40                                             
    );                                              So based on the requirement I ran the following query in the hope that I should see 8 records but unfortunately I saw none, Can any one help again please??? The query is as follows:
    SELECT id, entp_abn, acct_id, prog_program_cd, period_start_date,      
              period_end_date, amend_ind, return_status, status_date, loctr_nbr,         
              ab_taxable_income, amt_taxable_in_ab,
              CORP_INCOME, AB_ALLOC_FACTOR, AB_TAX_PAYABLE,
              special_allocation, ab_salaries_wages
      FROM   (SELECT r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,              
                  r1.period_start_date, r1.period_end_date, r1.amend_ind,                  
                  r1.return_status, r1.status_date, r1.loctr_nbr,            
                  SUM                                                                      
                    (DECODE                                                                
                  (rtlnms.litm_line_item_nbr,                                                
                   '062', rtlnms.revise_val_amt)) ab_taxable_income,                         
                  SUM                                                                      
                    (DECODE                                                                
                  (rtlnms.litm_line_item_nbr,                                                
                   '066', rtlnms.revise_val_amt)) amt_taxable_in_ab,
                     SUM                                                                      
                    (DECODE                                                                
                  (rtlnms.litm_line_item_nbr,                                                
                   '029', rtlnms.revise_val_amt)) CORP_INCOME,
                   SUM                                                                      
                    (DECODE                                                                
                  (rtlnms.litm_line_item_nbr,                                                
                   '065', rtlnms.revise_val_amt)) AB_ALLOC_FACTOR,
                   SUM                                                                      
                    (DECODE                                                                
                  (rtlnms.litm_line_item_nbr,                                                
                   '080', rtlnms.revise_val_amt)) AB_TAX_PAYABLE,
                   SUM                                                                      
                    (DECODE                                                                
                  (rtlnms.litm_line_item_nbr,                                                
                   '001', rtlnms.revise_val_amt)) SPECIAL_ALLOCATION,
                   SUM                                                                      
                    (DECODE                                                                
                  (rtlnms.litm_line_item_nbr,                                                
                   '002', rtlnms.revise_val_amt)) AB_SALARIES_WAGES
                  FROM   returns r1, return_line_items rtlnms                               
               WHERE  r1.id = rtlnms.rtrn_id                                                     
               AND    r1.id > 3600000                                                    
               AND    r1.prog_program_cd = '01'                                          
               AND    r1.return_status IN ('ASSESSED', 'DU')                             
               AND    r1.period_end_date BETWEEN                                         
                  TO_DATE ('01-01-2009', 'DD-MM-YYYY') AND                                 
                  TO_DATE ('31-12-2009', 'DD-MM-YYYY')                                     
               AND    rtlnms.sched_nbr = '000' 
               AND(rtlnms.sched_nbr = '002' and rtlnms.litm_line_item_nbr in ('001','002','004','006','008') )                                        
               AND    rtlnms.active_ind = 'Y' 
               AND    r1.status_date =                                                   
                  (SELECT MAX (status_date)                                                
                   FROM   returns r2                                                       
                   WHERE  r2. acct_id= r1.acct_id                                          
                   AND    r2.period_end_date = r1.period_end_date)          
               GROUP  BY r1.id, r1.entp_abn, r1.acct_id, r1.prog_program_cd,             
                     r1.period_start_date, r1.period_end_date, r1.amend_ind,               
                     r1.return_status, r1.status_date, r1.loctr_nbr, rtlnms.sched_nbr)
      WHERE  ab_taxable_income > 500000                                               
      AND    amt_taxable_in_ab < ab_taxable_income 
    strangely it's not retrieving any row where as it should have retrieved one row atleast and that is all records pertaining to return_id (return id ) = 3715944
    Can any of the Gurus' please help me out? As said I am really having a bad day on this. Many thanks to any one who can help me see the light today :-)

  • CF Report Builder - multiple queries

    I am a CF developer who has worked a fair bit with coding
    reports manually. Have taken the plunge with report builder and
    generally like what I see, BUT am quite disappointed with an
    apparent lack of documentation or tutorials on complex reporting
    techniques.
    I need to do a report which ideally requires two queries, the
    results of which the report's purpose is to compare.
    The problem is, from what I can tell, a .CFR can only have
    ONE query (which I find odd). Can anyone suggest a way of being
    able to have more than one query result set passed into a .CFR.
    I am starting to wonder that CF Report Builder might be great
    for fairly basic, single data set reports, but no good for large
    complex reports. I would be interested in hearing others opinions
    on this.
    Many Thanks in Advance.

    Thanks tmschmitt. You are right in that I am (was) stuck on
    passing in multiple queries. What I have managed to do is use the
    Advanced option of the query builder to write my two seperate
    queries, then combine them into one recordset by doing a Query on
    the Queries. Not sure if this is the best way around it, but it
    seems to be working fine. Problem now is that I need to manually
    craete 500+ "Query Fields" (yuk).
    I haven't really delved into the sub-reports yet, but have a
    feeling they won't meet my current needs. Basically i have 253
    columns of demographic data. I need one recordset (A) with this
    data from one geographic location with a recordset from a different
    location (B). I then need to lay out the data with each field from
    B beside it's corresponding field from A. In short, it is a
    comparitive report whereby the reader can compare a given value
    (e.g. avg income) from one area with that from another. This would
    be fairly straightforward in a scripted report, but with Report
    Builder appears to be quite cumbersome and potentially unmanagable
    as I need to handle each field explicitly (rather than looping over
    recordsets and structures to generate the different sections of the
    report).

  • A single OBIEE report firing Multiple Queries

    HI All,
    I tried the search option and did not find any questions which gives me what I am looking for. If I missed it and the question is already asked, please redirect me to the thread.
    I had a report which had a data issues. When i checked the log, I was shocked to see it firing 10 different queries. Could you guys please tell me exactly when OBIEE decides to split a single query and fire multiple ones?
    Here's some info on the report:
    1. All the columns are from the same subject area.
    2. All the physical tables are in the same database in the physical layer.
    3. All the tables are from the same physical catalog even.
    4. Majority of the columns are from the same fact. The fact table however has multiple LTS(Over 30) involving both fragmentation and content filters.
    Could you guys please let me know  why multiple queries are fired in the above case as well as generally by OBIEE?
    Thanks,
    Abhiram.

    It is recommended not to edit DB features. If you need to change them you might need to take help of oracle support.
    Else you might induce more erratic behavior.
    Not in agreement here. Depending on how that data sources beneath OBIEE are physically set up and parametrized you may be forced to change this in order to assure performance for example. Not all your BI-analyzed sources will be purpose-built for analytics and hence follow usual modellization rules or approaches. Oracle put the features in the DB objects for exactly that reason. And obviously you don't go and change the features "just like that".
    since fact measures are from multiple LTS, every time you bring a measure from different LTS it is treated as another star. So what OBIEE does is it queries each star separately using alias and then stitch them logically. Thats the reason for fragmented queries and a singel long sql in the end with stitches the other sql results in the end.
    True, but the OP was talking about "firing 10 different queries". Which is a bit vague but sounds more like distinct select statements rather than stich-joined WITHs...that's why I directed him towards the features which can actually change this dramatically. Problem is, that the OP hasn't made that exact point clear yet.

  • Matrix report with Multiple queries

    I have created one cross product group containing 4 subgroups under a single query. Now I have another one query seperately to be joined with the matrix query. Also I have one formula column and summary column with this the cross product group. The logic is if formula condition is true the it should take the 2nd query value in the place holder column otherwise it should take the first query value. is it possible?
    If any one knows about this update me ASAP to [email protected]

    Isn't there a way for you to do this via a Package/Procedure versus having multiple queries?
    Per the BI Publisher guide,
    Following are recommended guidelines for building data models:
    Reduce the number of data sets or queries in your data model as much as possible. In general, the fewer data sets and queries you have, the faster your data model will run. While multiquery data models are often easier to understand, single-query data models tend to execute more quickly. It is important to understand that in parent-child queries, for every parent, the child query is executed.
    You should only use multiquery data models in the following scenarios:
    To perform functions that the query type, such as a SQL query, does not support directly.
    To support complex views (for example, distributed queries or GROUP BY queries).
    To simulate a view when you do not have or want to use a view.
    Thanks,
    Bipuser

  • Creating report with multiple queries in clear quest

    Hi,
    I am new to reports and currently working with creating reports that connect to clear quest(CQ).
    I have successfully created several reports, that connect to the CQ, but they all have data from only one query.
    Now I am trying to create a slightly complex report where I need to fetch data from multiple queries. All these queries use 2 parameter to filter their data. I have dynamic cascading parameters to get them. When just connecting they all work ok. I used the link tab to link them to two fields of one query, to make sure that they all filter to fields from same query.
    The problem is when I drop the fields from the various queries on the form, the data is fetched multiple times.
    I also played with links to make them outer links but in that case I get error and unable to run the report completely.
    Any ideas on how to work with multiple queries and provide same parameters to all of the queries?
    Thanks in advance.
    -PAP

    - How do I make sure that the relationship is not one to many?
    You don't. That's the nature of the data. For example a single person can order multiple items. A simple one to many relationship.
    - In the link tab, I can only point to queries, is there a way I can point the fields to report params?
    You should be seeing tables... I think you're having a tough time with the basic terminology.
    - How does these Enforce Joins (4 options) work.
    There is rarely if ever any reason to switch from the default "not enforced". Leave it alone. The only one you'll touch 90% of the time is the Join Type.
    PAP,
    Based on the questions you're asking, it sounds like you are missing some major database fundamentals. My suggestion would be to step away from CR for the time being and read a little bit about relational databases (what makes them relational) and database normalization. This will also give you an idea about the various join types and when to use one over the other.
    You can know every feature and function in CR, but until you have at least a basic knowledge of how data relates, you'll never pull in the data you need.
    Jason

  • Balance Confirmation Report for multiple vendors

    Hi all,
    I have developed report in FI which gives details about opening balance,fiscal year, document number, posting date and amount in the output.In selection screen I am passing single values of fiscal year(GJAHR), vendor(LIFNR) and company code(BUKLRS). This report is working fine for single vendor but now I need to change it for multiple vendors. I tried but not getting desired result in the output.
    Following is code for single vendor in selection screen.
    SORT t_bsikbsak BY bukrs belnr gjahr buzei.
      LOOP AT t_bsikbsak.
        t_pre_bal-netpr = t_bsikbsak-dmbtr.
        t_pre_bal-sgtxt = 'Opening Balance'.
        IF t_bsikbsak-shkzg EQ 'H'.
          t_pre_bal-netpr = t_pre_bal-netpr * -1.
        ENDIF.
        COLLECT t_pre_bal.
      ENDLOOP.
      LOOP AT t_pre_bal.
        itab-netpr = t_pre_bal-netpr.
        itab-sgtxt = t_pre_bal-sgtxt.
        APPEND itab.
      ENDLOOP.
    SORT t_bseg BY bukrs belnr gjahr buzei.
      CLEAR itab.
      LOOP AT t_bseg.
        ON CHANGE OF t_bseg-bukrs OR t_bseg-belnr OR t_bseg-gjahr.
          READ TABLE t_bkpf WITH KEY bukrs = t_bseg-bukrs
                                   belnr = t_bseg-belnr
                                   gjahr = t_bseg-gjahr.
          IF sy-subrc IS INITIAL.
            itab-budat = t_bkpf-budat.
            itab-belnr = t_bkpf-belnr.
            itab-gjahr = t_bkpf-gjahr.
          ENDIF.
        ENDON.
        IF t_bseg-koart = 'K' AND t_bseg-lifnr = s_lifnr.
          itab-sgtxt = t_bseg-sgtxt.
         READ TABLE t_bsak WITH KEY bukrs = t_bseg-bukrs
                                    belnr = t_bseg-belnr
                                    gjahr = t_bseg-gjahr.
          IF t_bseg-shkzg EQ 'H'.
            t_bseg-dmbtr = t_bseg-dmbtr * -1.
          ENDIF.
          itab-netpr = itab-netpr + t_bseg-dmbtr.
        ELSEIF t_bseg-hkont = '0044100040'.  " G/L for INTEREST EXPENSES
          itab-inamt = t_bseg-dmbtr.
        ELSEIF t_bseg-hkont = '0012300060'.  " G/L for TDS ON INTEREST
          itab-tdamt = t_bseg-dmbtr.
        ENDIF.
        AT END OF bukrs.
          append_flag = 'X'.
        ENDAT.
        AT END OF belnr.
          append_flag = 'X'.
        ENDAT.
        AT END OF gjahr.
          append_flag = 'X'.
        ENDAT.
        IF append_flag = 'X'.
          APPEND itab.
          CLEAR itab.
          CLEAR : append_flag.
        ENDIF.
      ENDLOOP.
    Closing Balance
      LOOP AT itab.
        t_temp-netpr = itab-netpr.
        t_temp-sgtxt = 'Closing Balance'.
        COLLECT t_temp.
      ENDLOOP.
      CLEAR itab.
      LOOP AT t_temp.
        itab-netpr = t_temp-netpr.
        itab-sgtxt = 'Closing Balance'.
        APPEND itab.
      ENDLOOP.
    Kindly provide some input how to do it for multiple vendors in same code otherwise provide some suggestions for new code.
    Thanks in Advance.waiting for response.
    Thanks & Regards,
    Harshada Patil

    Hi,
    Thanks for quick response.Following is the structure of internal tables which I am using in this program.
    TYPES : BEGIN OF ty_bsikbsak ,
            bukrs TYPE bsik-bukrs,
            lifnr TYPE bsik-lifnr,
            umsks TYPE bsik-umsks,
            umskz TYPE bsik-umskz,
            augdt TYPE bsik-augdt,
            augbl TYPE bsik-augbl,
            gjahr TYPE bsik-gjahr,
            belnr TYPE bsik-belnr,
            buzei TYPE bsik-buzei,
            zuonr TYPE bsik-zuonr,
            shkzg TYPE bsik-shkzg,
            dmbtr TYPE bsik-dmbtr,
            END OF ty_bsikbsak.
    TYPES : BEGIN OF ty_bkpf ,
            bukrs TYPE bkpf-bukrs,
            belnr TYPE bkpf-belnr,
            gjahr TYPE bkpf-gjahr,
            bldat TYPE bkpf-bldat,
            budat TYPE bkpf-budat,
            stblg TYPE bkpf-stblg,
            stjah TYPE bkpf-stjah,
            END OF ty_bkpf.
    TYPES : BEGIN OF ty_bseg ,
            bukrs TYPE bseg-bukrs,
            belnr TYPE bseg-belnr,
            gjahr TYPE bseg-gjahr,
            buzei TYPE bseg-buzei,
            koart TYPE bseg-koart,
            shkzg TYPE bseg-shkzg,
            dmbtr TYPE bseg-dmbtr,
            sgtxt TYPE bseg-sgtxt,
            hkont TYPE bseg-hkont,
            lifnr TYPE bseg-lifnr,
            END OF ty_bseg.
    DATA : t_bsik     TYPE TABLE OF ty_bsikbsak WITH HEADER LINE.
    DATA : t_bsak     TYPE TABLE OF ty_bsikbsak WITH HEADER LINE.
    DATA : t_bsikbsak TYPE TABLE OF ty_bsikbsak WITH HEADER LINE.
    DATA : t_bkpf     TYPE TABLE OF ty_bkpf     WITH HEADER LINE.
    DATA : t_bkpf2    TYPE TABLE OF ty_bkpf     WITH HEADER LINE.
    DATA : wa_bkpf    TYPE ty_bkpf     .
    DATA : t_bseg     TYPE TABLE OF ty_bseg     WITH HEADER LINE.
    DATA: BEGIN OF t_pre_bal OCCURS 0,
          netpr TYPE bseg-dmbtr,
          sgtxt TYPE bseg-sgtxt,
          lifnr TYPE bseg-lifnr,
          END OF t_pre_bal.
    DATA: t_pre_bal1 LIKE t_pre_bal.
    DATA: BEGIN OF t_temp OCCURS 0,
          netpr TYPE bseg-dmbtr,
          sgtxt TYPE bseg-sgtxt,
          lifnr TYPE bseg-lifnr,
          END OF t_temp.
    DATA: BEGIN OF itab OCCURS 0,
          gjahr LIKE bsik-gjahr,
          belnr LIKE bsik-belnr,
          budat LIKE bkpf-budat,
          sgtxt LIKE bseg-sgtxt,
          lifnr LIKE lfa1-lifnr,
          netpr LIKE bseg-dmbtr,  " Net Amount
          inamt LIKE bseg-dmbtr,  " Interest Amount
          tdamt LIKE bseg-dmbtr,  " TDS Amount
          END   OF itab.
    RANGES: r_budat FOR bkpf-budat.
    I have Included vendor(LIFNR) in all these structures.Now I am using three internal tables to hold opening balance, Closing balance and line item accounting documents from bseg table respectively.here, I need to collect all these three internal tables into one internal table according to vendor(LIFNR)  with it's opening balance, accounting documents and closing balance. can anyone guide me through this so that I can collect all these three internal tables into single one.
    Thanks & Regards,
    Harshada Patil
    Edited by: Harshada.up on Feb 15, 2011 9:33 AM

  • Alv report for multiple record insertion

    hi,
    i'm new to abap. i'm using alv report for record display and insertion. how can i insert multiple records from alv to my table??

    well that can be achieved only by running BDC inside alv report to enter the entries.and in that too you can append or edit single entries only
    reward if useful
    regards
    vivek

  • Running Scheduled Crystal Reports for Multiple Customers!

    Hi,
    We are trying to accomplish what we felt was a very common practice with reports.
    We have CR 2011, CR 2011 Enterprise, CR Server 2011.
    What we are trying to accomplish is very simple.
    Currently, I have a prompt in my report that prompts me with a dynamic list based on a small sql statement my report, it provides a list of individual customer and their id's. It takes that ID , puts it into another SQL statement in the command and generates just that customers data. it works perfectly!
    What we are trying to do is use crystal server 2011 to take that report in question, schedule it, and have it run for each of the dynamic customer id's that I previously used when it prompted the screen.
    The reports cannot use multiple values as we only want each customer data to be included in the report.
    We need to have the scheduler run this report for our 10 different customer idu2019s and send it to their individual email addresses at a scheduled time each day.
    Is this possible? This has to be a very common request of reporting tools.
    If SAP software cannot do it, is there a 3rd party software that will allow our reports to be ran in the way I am wanting?

    Hi Rsheppick,
    Within CR Server you can use the publication functionality to create a publication and schedule this to external customers - for this you would have to use a dynanic recipient list to map the customers email id's to a field in the source report.
    The workflow is described in the online Publication document, accessible at the SAP Support site.
    I hope this is a very helpful answer to you.
    Kind regards,
    John

Maybe you are looking for

  • Macbook doesn't recognize external display

    I am trying to use my tv as an external display. My Intel Macbook doesn't detect my tv as an external display, this is because I am using an unconventional connector (VGA to RCA connector). Anyways, I am wondering if there is a way to force my laptop

  • Can not open the file

    After the report files were moved to the directory under root in Linux, I can not open the file(.rdf) in my working directory in linux even though it doesn't work in the report builder in window.(it used to work fine) error message the following; rep

  • 10.9.2 stuck FaceTime icons in vcards - can someone help get rid of them

    Had to update due to SSL bug.  Apple snuck in a change to Contacts: after long chat with support today, a higher up confirmed it's a feature introduced by the upgrade, to include icons for FaceTime, video and audio chats right smack among my contact'

  • Downloading music?

    i used to own a pc and i have recently bought an ibook g4. the problem with my old pc is that i downloaded too much music off of limewire and basically killed my computer with spyware. i decided to get a mac because i have been told they dont contrac

  • Good Use for TiBook G4 667Mhz

    Hello all! Aside from the systems listed in my profile below, I still have my first Pro class laptop (15in. Ti Book G4 667, 768mb RAM, 30gb HDD) and was using it daily up until about 2005. It's currently loaded with OSX 10.4 or 10.3. Though it hasn't