Adding to Query

We have this query that pulls up info on BP that have Properties #4 selected. 
SELECT t1.DocDate Date, t1.CardCode Acct#, t1.CardName Company, t3.Name 'Contact Person',t1.DocNum Invoice#, t1.DocTotal '$ Amt', Sum(t0.Quantity) 'Qty Pieces'
FROM dbo.INV1 t0
INNER JOIN dbo.OINV t1 on t1.docentry = t0.docentry
INNER JOIN dbo.OCRD t2 on t2.CardCode = T1.CardCode
LEFT JOIN dbo.OCPR t3 on t3.CntctCode = t1.CntctCode
WHERE t2.Qrygroup4 = 'Y'
GROUP BY t1.DocDate, t1.CardCode, t1.CardName, t3.Name, t1.DocNum, t1.DocTotal
We would like to add PO#, Inv # and SO # to this query.  Help?! 
Thanks,
Mike

Your INV# is in the query already.  If you Invoice is copied from Sales Order, then the following query will give your Sales Order #.  As for PO #, it depends on how you join the tables.
SELECT t1.DocDate Date, t1.CardCode Acct#, t1.CardName Company, t3.Name 'Contact Person',t1.DocNum Invoice#, t5.DocNum SO#, t1.DocTotal '$ Amt', Sum(t0.Quantity) 'Qty Pieces'
FROM dbo.INV1 t0
INNER JOIN dbo.OINV t1 on t1.docentry = t0.docentry
INNER JOIN dbo.OCRD t2 on t2.CardCode = T1.CardCode
LEFT JOIN dbo.OCPR t3 on t3.CntctCode = t1.CntctCode
LEFT JOIN dbo.RDR1 t4 on t4.TrgetEntry = t0.DocEntry and t4.TargetType = 13
LEFT JOIN dbo.ORDR t5 on t5.docentry = t4.docentry
WHERE t2.Qrygroup4 = 'Y'
GROUP BY t1.DocDate, t1.CardCode, t1.CardName, t3.Name, t1.DocNum, t1.DocTotal, t5.DocNum
Thanks,
Gordon

Similar Messages

  • Could not load data from database after adding a query

    Dear all,
    I have a working crystal reports 2011 report. This report get its data from a BW 7.01 system provided by three bex queries. Everything works as expected but not I have to add a fourth query to the report then I get the following messages:
    I try to translate it because I user the german version:
    INFORMATION: In this report a stored procedure is used. Ensure that no SQL expression was added and no grouping on server side will be done.
    WARNING: Data could not be load from the database.
    WANING: Invalid argument provided. Details: The key figure structure isn't a valid field for report generation. Use instead the real keyfigures with teir units.
    Has anyone an idea what can be the reason for my issue?
    Thanks and regards!

    hi Gerrit,
    a couple of questions...
    1) are you adding all 3 queries (and then the 4th) in the same data connection or are each of these additional queries in a subreport?
    2) if all 3 queries (and then the 4th) are in the same data connection are you linking them?
    3) most importantly, if you create a brand new report off of the 4th query, is it successful?
    it's been quite a while since I've worked with bex queries but in general adding multiple queries (or stored procs or commands or combinations thereof)  to the same report is probably not a good idea. there ends up being a lot of processing happening in the crystal reports designer itself as a large virtual record set is created by the individual queries.
    -jamie

  • Can you control a URL in eloqua from being adding the query string??

    If I am inserting a URL in an email, i cant seem to stop eloqua from adding extra parameters in the form of query string in eloqua.
    I want to make this happen because the URL doesnt seem to work if we add any extra parameter using query string.

    I've tired doing this and it did not work for me. However, I was able to find a solution that helped me a whole lot.
    After running all test runs - I found a solution that helped me take off the extra parameters that Eloqua adds to all URL's.
    I created my urls without placing "http://" or "https://" or http://www." or "https://www." and that helped take off all tracking.
    Re: Use of tinyUrl

  • Cfquery results ordered by column added after query run

    I have a function that returns a recordset, adds a column
    using QueryAddColumn then loops through the recordset and reorders
    the items using QuerySetCell.
    Once the function has run, the output shows the items in
    their natural order and lists the new order as a table column.
    How would I then do the equivalent of ORDER BY myNewColumn
    since the query has already run.
    My code is attached.
    Thanks,
    Paul

    Never mind, sussed it!
    Added the following for query of query:

  • Dashboard Prompt - Getting error for Adding SQL query in "Default to"

    Hello Oracle,
    I am facing some problem in Dashboard Prompt. Like when i add some sql query in "Default to" in Dashboard prompt and for the next prompt when i check for Contrain option i get error in the second prompt. but it works fine when i hard-code a value in "Default to" options.
    For Example:
    Like when we consider a two prompts :
    1) Year -> (In Default to i select SQL Query and enter the query as SELECT "YTD Dim"."Fiscal Year" FROM "YTD Report" WHERE "YTD Dim"."Fiscal Year" = Year(Current_Date)
    2) Business Unit -> (In specific value i give as some hard code value of Business Unit and check the contrain option)
    i get error as
    Business Unit
    Error Generating Drop Down Values
    A numeric value was expected (received "SELECT "YTD Dim"."Fiscal Year" FROM "YTD Report" WHERE "YTD Dim"."Fiscal Year" = Year(Current_Date)"). Error Details
    Error Codes: EHWH2A7E
    but i get correct value for Year as 2011.
    I need to use SQL query in default to option and need to check the constrain option too.
    Looking for positive feedback.

    You need to create a dashboard prompt and in Default To -> select SQL Results
    Click on the ... (three dots ) underneath it and put in your sql
    For Example , I have a Table called "Sales Date" in my "ABC" presentation folder. This has a column called "Year" and "Date". If I want to have a Year prompt with the default value set to current year, here is what the syntax of my sql result will be :-
    SELECT "ABC"."Sales Date".YEAR
    FROM "ABC"
    WHERE "Date" = current_date
    In SQL, we cannot put SQL as we know of in terms of Oracle, Sql Server etc. The SQL here refers to sql as OBIEE understands it and should be in the form of Select "Presentation foler"."Table Name".ColumnName from "Presentation Folder"
    Hope this helps

  • Adding a query to the approval template

    Hello
    I'm trying to setup an approval template for AR Invoices based on a UDF.
    Basically I want to add a query to the approval template that will trigger an approval request based on the following query
    but i don't know how to set it properly.
    trigger an approval when:
    select * from OINV where u_ordertype = 'sub'
    any help would be appreciated it!
    Mike

    Hi Mike,
    Try this:
    select 'true' from OINV T0 where T0.u_ordertype = 'sub' and T0.DocNum = $[$8.0.0\]
    Thanks,
    Gordon

  • Adding a Query to a Role

    Hi gurus
    Can anyone please let me know how to add a query to a role in Bw 3.x.

    Hi Rajat,
           In the Query Designer tool bar, you will see Create, Open, save, save as, delete and Publlish Icon.Next to the publish Icon, you will see downward arrow. If you click that, then it will show Publish in Role, Publish in portal/.If you click 'publish In Portal' then it will show you roles available and choose the role and save it.
          Or else you can even do in PFCG.
    In PFCG, give the role and choose change.
    Goto Menu tab. Choose the folder under which you want to save your query, select insert report option and give your report name.
           Hope it helps you. Assign points if it helps you.
    Regards,
    Yokesh

  • Adding multiple query into a role

    hi gurus,
    is there any way that i can use to add multiple query (100+) into a role
    Please advice
    thank you

    Dear Ramasamy,
    Please check SAP note   588144, this explains the complete procedure:
    Regards,
    Arvind

  • WAD(BI7)- adding dataprovider (Query)

    Hi Experts,
    In WAD,
    I need to find a solution to add 2 queries as a dataprovider to 1 navigation pane so that when i filter/navigate by a characteristic of this pane, both the underlined queries should change.
    Is there a possibility- If Yes-How ?
    Regards,

    You can only have one dataprovider per navigation pane.  Although, you might try to add a second nav pane for the second dataprovider.  Not sure if it will work, but it's worth a try.
    Also, you might want to use the same variable in both queries and change the variable value rather than use a filter.
    Brian

  • Adding query to the view

    Hi,
    I'll appreciate your advice regarding the following:
    I am using a View which consists of several UNION statements.
    for example:
    create or replace view VI_TEST
    as
    select name,lname from Test1
    union all
    select name,lname from Test2
    The questions is: if I am getting a new table, Test3, and want to include it in VI_TEST view - do I have any option (using PL/SQL or other) to make this addition incrementally? (not doing "create or replace view" again but adding the query of Test3)
    Thanks

    Here's the main idea. Hope you get the gist:
    -- create some tables and data:
    SQL> create table test_1 as select 'test_1' data from dual
    Table created.
    SQL> create table test_2 as select 'test_2' data from dual
    Table created.
    -- the pipelined function
    SQL> create or replace function view_pipe return sys.dbms_debug_vc2coll pipelined
    as
      data_col sys.dbms_debug_vc2coll;
    begin
      for c in (select * from user_tables where table_name like 'TEST_%') loop
        execute immediate 'select * from ' || c.table_name bulk collect into data_col;
        for i in 1..data_col.count loop
         pipe row(data_col(i));
        end loop;
      end loop;
      return;
    end view_pipe;
    Function created.
    -- a view based on the pipelined function
    SQL> create or replace view v_myview as select substr(column_value,1,7) my_data from table(view_pipe)
    View created.
    SQL> select * from v_myview
    MY_DATA
    test_1
    test_2
    2 rows selected.
    -- add another »entity«
    SQL> create table test_3 as select 'test_3' data from dual
    Table created.
    -- data is appended in orginal view:
    SQL> select * from v_myview
    MY_DATA
    test_1
    test_2
    test_3

  • Trouble adding multiple parameters to Command Query

    <p>I am trying to calculate the calendar days each unit is in use.  For each job a unit has a arrival date and a departure date. A unit may work on more than one job in a day, or on 1 job for more then 1 day</p><p>For example the table look like this, if I have unit #10 and it works as follows<br />Unit   Job        Arrival        Departure<br />10        1         Jan 1            Jan 1<br />10        2         Jan 2            Jan 3<br />10        3         Jan 3            Jan 3<br />10        4         Jan 5            Jan 6           <br /><br />And I want my report to show<br />Unit       Days worked<br />10         5<br /><br />So the Unit actually works on 5 days beween Jan 1 and Jan 6.  I am able to write a query to get this information but I am having trouble creating this in Crystal Reports XI.  I have tried adding my query to the report using "add Command" however when I try to replace my hard coded dates with parameters, I am able to add 1 parameter (From Date) but when I add the (To Date) paramater I get an error "Failed to retrieve data from database ORA00911- Invalid Character"  I&#39;m not sure why it doens&#39;t allow me to add the second date parameter.  I don&#39;t know if there is a better wa to do this within Crystal reports itself.</p>

    Please re-post if this is still an issue and please specify versions.

  • Adding query to Favourites

    Hey..
    I would want to add a query to my favourties list. I do not want to create a tcode for it. Is there any way other than creating a tcode for adding a query to the favourites list.
    Alternatively, can we add it directly to an area menu or any other suggestion?
    Thanks.
    Edited by: sreelakshmi shilpa on Aug 27, 2008 7:27 AM

    hi,
    we can add only transactions in favourites list.
    so u have 2 options.
    either create a transaction for query and attach it or attach transaction SQ01 in the favourites.

  • Is it possible to open a query from sap menu favorite to excel?

    Hi all
    I have added a query in favorite . From the favorite in sap menu , i want to open the query in excel.
    Is is possible?
    Currently the query open in web.
    Please revert back if you have any idea
    Thanks
    ajay

    Hi Daya Sagar,
    You said the query saved in favorite from query designer will open in browser and the one saved from analyzer will open in bex excel. But it does not work for me. It saves as web icon and both query is opening in browser.
    Hi All,
    The different story for me is I have problem of opening the web browser by running a query from favorite or user menu because in the url I have different Client. Is there any way to fix this url problem. Any one in this thread can help me on this issue and will be awarded. Thanks.
    Raj

  • Getting error while running crystal reports on SAP BW Query

    Hi
    I have installed Crystal Reports 2008 SP3 and then SAP Integration Kit. I'm able to connect to SAP BW but after adding the query to crystal and while refreshing the report i'm getting an error
    Database Connection Error: 'BAPI Error #:0' Error occured when starting the parser: timeout during allocate/CPIC-CALL:'ThSAPCMRCV'.
    Please help how to overcome this error.
    Thanks
    Raghavendra.G

    Check the following SAP note
    https://service.sap.com/sap/support/notes/1032461
    Regards,
    Stratos

  • How to configure search results web part to display results only after a query is generated from user?

    Hi All,
    I am crawling documents from a file server. I created a new content source and crawled the documents. All documents are crawled successfully.
    Then I went to my enterprise search center site collection and created a new result source. I have added the query to use above content source.
    After that, on a page I am trying to configure the search results web part to display documents using this result source. Now the problem is:
    It displays all the documents that are crawled without searching for anything. I mean first it should not display any results. If a user searches for something , then according to that search it should display results.
    Any idea how to do this in the web part? I am using SharePoint 2013 on premise enterprise edition. No code. Totally OOTB.

    Hi Mohan,
    What did you use for the Query text in the result source?
    I could reproduce this issue when I used Query text like: {searchTerms} Path:”http://sps2k13sp/sites/First/Shared%20Documents”
    Then I changed the Query to
    {?{searchTerms}
    Path:"http://sps2k13sp/sites/First/Shared%20Documents"}
    , then Search result web part didn’t return results without searching.
    So , check your result source, and use the Query like the above(adding "{?...}").
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for

  • Problem in developing a simple ejb app

    Hi readers, i am new to ejb technology, so have doubt in developing and deploying a simple ejb application i am using EJB 2.0, JBOSS 4.0 , eclipse 3.2 and java 1.5 i searched in the net , got through many materials that can guide to develop one of it

  • I get "kernel Panic" the moment I'm connecting an external (m-audio) audio drive

    I get "kernel Panic" the moment I'm connecting an external (m-audio) audio drive

  • How to set a different SUSP character? (job control)

    Stopping the foreground job associated with a terminal can be done by typing 'C-z', which is the default special character for suspending or resuming it (using the 'SIGSTOP' signal). Documentation says: The functions, data structures, and symbolic co

  • Best Table to use in form for Column Comments maintenance

    Hi, I want to create an Oracle Form to maintain Comments for each column in all of user_tables. eg. Order Entry, Customer. What would be the best table to use for this excercise. All of our developers will need this form to be used each time a new ta

  • Windows 2008 R2 gp diagnostics

    Windows 2008 R2 this link Group Policy Diagnostic Best Practice Analyzer for Windows Server 2003 (KB940122) i'm looking for the equivalent for Windows Server 2008 R2. my GPO settings are not being received by several computers although some of them a