SQL multiple selects in one report?

Hello,
I'm having a problem selecting from the following table (let's call it the dpt_user_role) to be able to create a custom report,
The table looks like the following:
Dpt_id User_id User_is_manager
1 1001 N
1 1002 Y
1 1003 N
2 1001 Y
2 1005 N
2 1006 N
3 1001 Y
3 1007 N
3 1008 N
I would like to build a custom query to fit in just one report that would give me the following results for user_id 1001
Dept_id User_id User_is_manager
2 1001 Y
2 1005 N
2 1006 N
------ (line from the custom report template separating dpts) ------
3 1001 Y
3 1007 N
3 1008 N
As you can see I need to select all the depts where user_id :PX_USER is a manager but also the non manager users in that report.
Any help pointing me in the right direction will be greatly appreciated and sorry for the inconvenience.
Thanks.
Best regards,
NJ

Hello,
Thank you for your fast answers and for helping.
The result of the query returns,
2 1001 Manager
2 1005 Non-Manager
2 1006 Non-Manager
------ (line from the custom report template separating dpts) ------
3 1001 Manager
3 1007 Non-Manager
3 1008 Non-Manager
But I really need something like
Dept_id Manager User_is_manager
2 1001 Y
Dept_id Non-Manager User_is_manager
2 1005 N
2 1006 N
------ (line from the custom report template separating dpts) ------
Dept_id Manager User_is_manager
3 1001 Y
Dept_id Non-Manager User_is_manager
3 1007 N
3 1008 N
So I could pass the results to the custom report like
[begin of template report]
Manager of Dept #Dept_id# is #Manager#
Non managers users are #Non-Manager#
------ (line from the custom report template separating dpts) ------
[end of template report]
And the report would go to Dept_id = 3 and so on. I would have to perform an inner join of some sort to get the Manager and Non-Manager users first and last names from a different table.
Is this all possible in a single query or am I in hyperspace here?
May the good winds of fortune keep blowing your way and inspiring you.
Thank you!
Best regards,
NJ

Similar Messages

  • Multiple selection in interactive reports

    hi,
    how can we do multiple selection in interactive reports using check box?
    my first list will have a list of account numbers along with the check box. if few check boxes are clicked then the other fields from the table for the checked account numbers . kindly help me with this.

    Hi,
    REPORT zbcd .
    data : BEGIN OF ITAB OCCURS 0,
            VAR1(4) TYPE C,
            VAR2(4) TYPE c,
           END OF ITAB,
           LINE1 TYPE I,
           VAR3(4) TYPE C,
           VAR4(4) TYPE C,
           FLAG TYPE C,
           CURRENT TYPE I.
    data : BEGIN OF WA OCCURS 0,
           XYZ(100) TYPE C,
           END OF WA.
    MOVE: '1234' TO ITAB-VAR1,
          'ABCD' TO ITAB-VAR2.
    APPEND ITAB.
    MOVE: '5678' TO ITAB-VAR1,
          'EFGH' TO ITAB-VAR2.
    APPEND ITAB.
    MOVE: '9999' TO ITAB-VAR1,
          'IJKL' TO ITAB-VAR2.
    APPEND ITAB.
    SET PF-STATUS 'BUTTONS'.
    *HERE PF-STATUS CONSIST OF PUSHBUTTON WITH USERCOMNAD 'DISP'.
    LOOP AT ITAB.
    WRITE: / FLAG AS CHECKBOX, ITAB-VAR1, ITAB-VAR2.
    ENDLOOP.
    DESCRIBE TABLE ITAB LINES LINE1.
    REFRESH ITAB.
    CLEAR ITAB.
    CURRENT = 0.
    CLEAR: VAR3, VAR4.
    AT USER-COMMAND.
    CASE SY-UCOMM.
    WHEN 'DISP'.
    DO LINE1 TIMES.
    CURRENT = SY-INDEX + 2.
    READ LINE CURRENT LINE VALUE INTO wa.
    IF wa-XYZ(1) EQ 'X'.
      WRITE: wa-XYZ+2(4) TO VAR3,
             wa-XYZ+7(4) TO VAR4.
      WRITE: VAR3 TO ITAB-VAR1,
             VAR4 TO ITAB-VAR2.
      APPEND ITAB.
    ENDIF.
    ENDDO.
    ENDCASE.
    THEN U SECONDARY LIST VALUE SELECTION TAKES PLACE
    SELECT * FROM MARA INTO TABLE ITMARA FOR ALL ENTRIES IN ITAB WHERE MATNR = ITAB-MATNR.
    LOOP AT ITMARA.
    WRITE:-----FIELDS TO BE DISPLAY IN OTHER LIST...
    ENDLOOP.
    *NOTE :-1.PLEASE EXECUTE ABOVE PROGRAM WITH OUT CHANGES IN DEBUG MODE TO CLEARLY UNDERSTAND. 
    2.ALSO U CAN MOVE ABOVE ITAB REQUIRED FIELD VALUES INTO ONE OF INTERNAL TABLE(BY LOOPING) WHICH IS LIKE SELECTOPTIONS MARA-MATNR(ie TB_MATNR) AND USE*
    (AND INSTEAD OF VAR1 AND VAR3 U CAN PLACE THE MATNR)
    SELECT * FROM MARA INTO TABLE ITMARA WHERE MATNR IN TB_MATNR.*
    Edited by: Vijay Mekala on Feb 1, 2008 5:16 PM

  • How to create multiple selection screens in reports

    How to create multiple selection screens in reports
    Thanks,
    Sridhar

    Ex: hope you will find an idea from the below example :
    SELECTION-SCREEN BEGIN OF BLOCK SEL1 WITH FRAME TITLE TIT1.
    PARAMETERS: CITYFR LIKE SPFLI-CITYFORM,
                CITYTO LIKE SPFLI-CITYFORM.
    SELECTION-SCREEN end OF BLOCK SEL1
    SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.
    SELECTION-SCREEN INCLUDE BLOCKS SEL1.
    SELECTION-SCREEN BEGIN OF BLOCK SEL2 WITH FRAME TITLE TIT2 .
    PARAMETERS: AIRPFFR LIKE SPFLI-AIRPFROM,
                AIRPTO LIKE SPFLI-AIRPTO.
    SELECTION-SCREEN END OF BLOCK SEL2
    SELECTION-SCREEN END OF SCREEN 5000.
    INITIALIZATION.
    TIT1 = 'ITIES'.
    aT SELECTION-SCREEN.
    CASE SY-DYNNR.
    WHEN '0500'.
       MESSAGE W159(at) WITH 'SCREEN 500'.
    WHEN '1000'.
       MESSAGE W159(at) WITH 'SCREEN 1000'.
    ENDCASE.
    START-OF-SELECTION.
    TIT1 = 'CITIES FOR AIRPORTS'.
    TIT2 = 'AIRPORTS'.
    CALL SELECTION-SCREEN 500 STARTING AT 10 10.
    TIT1 = 'CITIES AGAIN'.
    CALL SELECTION-SCREEN 1000 STARTING AT 10 10.

  • Results of multiple queries in one report

    Hi
    I would like to create one report with multiple rows and each row should display result of a different query.
    I guess I can use multiple report on one region or multiple regions in one place.
    (1)However is there a more elegant way of creating a single report look and feel...eg like it would happen in excel.
    (2)Is it better to have one page with multiple regions or multiple reports in one region.
    Thanks
    Faizi

    I'm not sure if it suite your needs,
    but maybe you can use UNION in your queries to get them together in one report ??
    Second option:
    Denes did great work and he created some how-to about putting mulitple reports in one region:
    http://deneskubicek.blogspot.com/2007/06/multiple-reports-in-one-region.html
    Hope this helps.
    Tomasz K.

  • Multiple Queries in one Report

    What is the best way to show the data of 2 queries in one report?

    Hi Frank,
    It purely depends on the reporting needs I would say. You could simply add the two queries, create joins in Crystal Reports and drag the required fields in the details section.
    The joins in this case, however, would be executed by Crystal Reports, unlike when the report is created off a Relational database.
    -Abhilash

  • Multiple SELECTS or one Procedure to generate Count Statistics?

    I've got an application showing purchases from a catalog. I
    need to show statistics on those purchases -- the number of
    buyers by product by month, the number of buyers by source
    (space ads, direct mail, telephone, online) by month, the number
    of buyers by state by month, etc. In other words, there are a
    lot of row counts to generate.
    The question is, am I better off creating an SQL statement for
    each count request, or, since I have so many counts to generate,
    am I better off writing an SQL Procedure to loop through all the
    rows with a single table scan and update tables with the counts?
    An example count request -- counts by product code by month:
    SELECT TO_CHAR(purchdate, 'YYYYMM'), prodcode, count(*)
    FROM transactions
    GROUP BY TO_CHAR(purchase,'YYYYMM'), prodcode
    Oracle is pretty good at optimizing SQL, and it's certainly
    easier to focus on each SQL statement one at a time. But, it
    will require many full-table scans (and/or many indexes). The
    Procedure route is much more difficult to write in a general way
    (since I really have 30 or 40 different tables to do these
    statistics on with different columns to count in each table,
    with more coming in all the time).
    One more bit of info -- these counts are only generated after
    the file is updated. These updates are done monthly or
    quarterly, so these counts are not run all the time and are not
    generated on demand. We save them as PDF files for viewing.
    Any advice is greatly appreciated! :-)
    PS. I currently do this using Oracle Reports. This ends up as
    the "one SQL statement per count" method. But, I've just gotten
    a file in with 4 million records, and I don't want to wait until
    next year for the report to finish! :-)

    Dear Mr. Nagrajan,
    Thank you for your response. I have already gone through documents but not able to understand. Is there any setup for this ? or its just work around i.e. using template and special field in JV i.e. Ref. 1 /2
    My doubts :
    I understand that Chart of Account structure is one and common for IFRS and other accounting method. We need to create only those account separately ( 2 times with prefix like IFRS revenue account, GAAP Revenue account).
    Now at time of entry, Assume some entries / adjustment are specifically for IFRS and not for other ledger. In this case, What need to do ?
    You have mentioned about DTW approach but do we need to insert all JV's again with other ledger ?
    Someone suggested that if any entry which are specific to IFRS Ledger, We need to user Ref.1 /2 column or Transcation code column and in which we can put IFRS
    Based on this, Need to create 2 seperate template for IFRS and other ledger for all report.
    This is my understanding of Solution in SAP B1. Please help me to clarify my though process
    Please do needful.If you have done implemenation and if you can share doucment, it would be great help.
    Email :[email protected]

  • PDF Maker in Excel 2003 prompts to save multiple files for one report

    It seems each time i try to PDF multiple tabs I end up having to save more than one copy of the report in order to get all the sheets in PDF form.  I then have to merge all the PDF copies into one file and save it.  Does anyone know why it is generating multiple reports for the tabs in excel and how to get all the tabs to load as one PDF file from the get-go?

    Jeffrey and Karen ... I've used Preview for years but recently upgraded to OS Snow Leopard (I am reluctant to change software!). I used to freely drag and drop pages from the sidebar one pdf file open in Preview to the sidebar of another - as you recommend - without problem. Now if I do that, the caption in the bar at the top of the document says "2 documents, 5 (or whatever) open pages", and I can't save the whole thing as one document - Preview wants to save the tranferred pages as their own document. What has changed? What am I not understanding here?

  • Multiple selection screens for report

    I need to display 2 separate selection screens prior to executing the report.
    1. A selection screen to enter the material & plant
    2. Based on the material and plan another selection screen to display the inspection characteristics associated with the material and be able to select (as checkbox) the inspection characteristic that needs to be used as filtering criteria.
    The first selection screen I can do. But how do I invoke the second selection screen that displays the insp. char. Also how do I design such a selection screen and populate the contents
    I would like something like
    [CheckBox] Inspection Plan Inspection Characteristic [Editable upper limit] [Ediatable Lower Limit]
    But other ideas to implement this are welcome as well.

    Megan,
    Say thanks to SDN.No need to give points to this.
    TABLES:EBAN.
    SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    PARAMETER:rad1 RADIOBUTTON GROUP rad USER-COMMAND frad1 DEFAULT 'X',
              rad2 RADIOBUTTON GROUP rad .
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    PARAMETER: mtr AS CHECKBOX MODIF ID g3 USER-COMMAND chk1,
               p_matnr TYPE eban-matnr MODIF ID g1,
               sloc AS CHECKBOX MODIF ID g3 USER-COMMAND chk2,
               str_loc TYPE eban-lgort MODIF ID g4.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
    SELECT-OPTIONS: matnr1 FOR eban-matnr MODIF ID g2.
    SELECTION-SCREEN END OF BLOCK b3.
    SELECTION-SCREEN PUSHBUTTON /20(10) name USER-COMMAND UCOM.
    SELECTION-SCREEN END OF SCREEN 100.
    *name = 'FETCH'.
    title = 'Test Report'.
    CALL SELECTION-SCREEN '100'.
    TYPE-POOLS slis.
    AT SELECTION-SCREEN OUTPUT.
      IF rad1 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G1' OR screen-group1 = 'G4'.
            screen-active = '1'.
            screen-input = 0.
          ELSEIF screen-group1 = 'G2'.
            screen-active = '0'.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ELSEIF rad2 = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G1'  OR screen-group1 = 'G4' OR screen-group1 = 'G3' OR screen-group1 = 'G5'.
            screen-active = '0'.
          ELSEIF screen-group1 = 'G2'.
            screen-active = '1'.
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
      IF mtr = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G1'.
            screen-input = 1 .
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
      IF sloc = 'X'.
        LOOP AT SCREEN.
          IF screen-group1 = 'G4'.
            screen-input = 1 .
          ENDIF.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    clear sy-ucomm.
      iflag = 1.
    K.Kiran.

  • Multiple facts on one report

    We have three fact tables Daily Sales, daily shipments and Monthly Sales Projections:.
    They all have common dimensions like Data, Region and Product.
    Say I have the following
    Daily Sales: Date, Product, Sales amount
    Daily Shipments: Date, Product, Region, Shipped amount
    Monthly Sales Projections: Month, Product, Region, Projected Sales
    Date: Date, Month, Quarter, etc..
    How do I get to show all three on one Measure in the Subject area/Presentation layer?
    Do I do the complex joins in the BMM layer? In one diagram?
    Do I do three separate star schemas with their aliases (only one set of aliases for the Dimensions in the Physical layer?
    Please do answer. i promise to mark all helpful replies.
    Edited by: Mid Atlantic on Feb 15, 2012 11:04 AM

    Hi,
    you can use the different sections for different paper orientation. So you can use the header section for your portrait layout and the main section for your landscape orientation.
    Regards
    Rainer

  • How to generate one report in multiple formats with FOP or BIP?

    Hi all,
    Is it possible to generate multiple formats of one report in a single "call" using Apache FOP or BI Publisher? (something similar to reports bursting).
    Right now I can only select one format at a time.
    Thank you,
    Ana-Maria

    Hi Ana-Maria,
    When you enable printing on a report region or add a button to download a report query to your application, then you get a single document download. How would you see this working with "multiple formats"? Given that APEX is a development environment, you can pretty much implement anything you like. The built-in printing capabilities in APEX come with an API that allow for customization of the default functionality, e.g. you can use apex_util.download_print_document to dynamically assign report layouts at rumtime or to use you own XML data sources or XSL-FO style sheets. More relevant to you question though, there's also apex_util.get_print_document. What that allows you to do is to generate report documents inside the database and e.g. store them in database tables or email them out to a list of recipients. You can call this API as often as you like to, requesting any combination of available report formats.
    The API function is documented here:
    http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_util.htm#CHDDECIA
    Regards,
    Marc

  • Hide multiple selection of parameter related to Standard Report Category.

    Hi,
    I have created the report program with the logical database PNPCE , report category HRF_PNOC having PNPPERNR in the selection screen With Multiple selection. I want to hide the multiple selection button  for this PNPPERNR in the selection screen.
    For example: we hide the multiple selection button in report program with the no-extension. The syntax for no-extension is shown below 
    select-options : p_kunnr for kna1-kunnr no-extension.
    Can any one help me out of this?
    Thank You,
    Swetha.C
    Edited by: Swetha Chevuru on Oct 28, 2011 12:22 PM

    Hi,
    Please see the below blog for detailed description of the problem that i am facing now
    http://swethacblog.blogspot.com/2011/10/how-to-hide-multiple-selection-button.html#!/2011/10/how-to-hide-multiple-selection-button.html
    Thank You,
    Swetha.C

  • Multiple selection for report

    we need multiple selection for the report about the RMA - bill to location ID, we would like to select by service order , currently is there no field for selection, in search-term we have to enter our code. it does not work if we enter the service order.
    thanks for help

    we need multiple selection for the report about the RMA - bill to location ID, we would like to select by service order , currently is there no field for selection, in search-term we have to enter our code. it does not work if we enter the service order.
    thanks for help

  • Multiple instances of Crystal Reports Viewer possible in WPF?

    Hi, I've dragged and dropped three Crystal Reports Viewer controls on my WPF application. The goal is to be able to select up to 3 reports from a listbox and click run to generate the reports simultaneously. When I select just one report, it works fine. However when I select multiple reports it throws errors (object not found, etc). It seems there is a problem with multiple threads. Is it possible to have multiple instances of the Crystal Report Viewer display reports simultaneously? I am using version 13.0.9.1312 from the link below along with VS2013 C# WPF.
    SAP Crystal Reports, developer version for Microsoft Visual Studio: Updates & Runtime Downloads
    Thanks,
    Syed

    I was able to quickly cobble together a two viewer app that looks like this:
    The code is like this:
    Public Sub New()
            ' This call is required by the designer.
            InitializeComponent()
            ' Add any initialization after the InitializeComponent() call.
            Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            crReportDocument.Load("C:\tests\formulas.rpt")
            CrystalReportsViewer1.ViewerCore.ReportSource = crReportDocument
            Dim crReportDocument2 As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            crReportDocument2.Load("C:\tests\report1.rpt")
            CrystalReportsViewer2.ViewerCore.ReportSource = crReportDocument2
        End Sub
    For more details see the document WPF Project Using the Crystal Reports WPF Viewer in 8 Easy Steps
    Now a couple of things to keep in mind;
    1) The report engine is based on 3 Concurrent Processor License (CPL) model. Meaning you can process at most three reports at the same time. In my test, doing the above code for four reports worked, but the reports are very, very simple - and with saved data. What a "real" world reports will do, I am not sure. I do know that in a web app, the reports are queued up until one report is done and thus a CPL is freed up. You will also need to keep in mind any database connection limits, etc.
    2) There is also a Print Job limit. This by default is set to 75. In a nutshell, almost anything done with a report is a Print Job. E.g.; paging, zooming, drilling, searching, etc., etc. In addition subreports are considered to be Print Jobs. Thus a report with one subreport in a detail section that returns a thousand rows of data and therefore running 1000 subreports will error out.
    You can read more about Print Job limits here:
    Crystal Reports Maximum Report Processing Jobs ... | SCN
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Insert items from two different Multiple Select Lists into a single table

    I need help. I have a training tracking system that tracks the courses taken by employees.
    I have created two multiple select lists, one is SelectEmployees and the other is SelectCourses. I want to insert
    the selected item from those two multiple select lists into Training_Record table.
    Note, SelectEmployees" is from Employee table and SelectCourses is from Courses table. Those two table has no intersetion.
    Train_Record is the table that joins those two together.
    Please advice and your help is appreciate.

    Thank you for your help.
    I tried your code and changed the table/field name to my actual table/field name and the iitem name to actual item name.
    declare
    cursor c_Employees is
    select PERSONNEL_NEW.EMPLOYEEID from PERSONNEL_NEW where PERSONNEL_NEW.EMPLOYEEID in (:P15_SELECTEDEMP);
    cursor c_Courses is
    select COURSES.COURSE_ID from COURSES where COURSES.COURSE_ID in
    (:P15_SELECTEDCOUR);
    begin
    foreach :=r_employee in c_Employees loop
    foreach :=r_course in c_Courses loop
    insert
    into COPYOFTRAINREC ( EMPLOYEEID, COURSEID )
    values ( r_employee.EMPLOYEEID, r_course.COURSE_ID );
    end loop;
    end loop;
    end;
    I got error message as :
    ORA-06550: line 12, column 25: PLS-00103: Encountered the symbol "C_EMPLOYEES" when expecting one of the following: (
    Error
    OK

  • Multiple Selections

    I am following a tutorial which calls for multiple selections on one layer as seen here:
    http://www.pixentral.com/show.php?picture=10OuFfXZsVAdtugJaVg26Thjv0EJr0
    Is it possible to do this in Elements, as the selections don't intersect?
    I did a work-around be copying each selection to a new layer, then merging the layers. Perhaps the tutorial requires full Photoshop for execution.

    For every tool that you select, the options are displayed in the options bar which is the horizontal bar at the top of the application UI below the menu bar. When you select any selection tool, there are four small thumbnails at the right of the options bar which function as follows in order from left to right-
    Simple selection(previous selection will be discarded whenever you make a new selection.
    Add to selection(You can make multiple selections)
    Subtract from selection (All the areas that you select after the forst selection you make ,will be removed from your selection.)
    Intesection og selections.
    From amomgst these, you need the second options.
    Cheers!!

Maybe you are looking for