Query Help in Report

Hi guys ,
I need to make a matrix report like the following
Description Year(2002 Full),Year(2002 Till Date),Year(2002 Till Month),Year(2003 Full),Year(2003 Till Date),Year(2003 Till Month)
Year its easy to get in the query as the following
select item,sum(qty)to_char(v_date,'YYYY') from table group by item v_date
but how will i get the year to date and year till month
item wuill be my row
qty will be cell
and year will be column

If the current date is 25th oct 2004 so in above query i need as
2002 Full Year i.e jan 2002 to dec 2002
2002 YTD Jan 2002 - 25t oct 2002
2002 Year To Month - jan2002 oct 2002
2003 Full Year i.e jan 2003 to dec 2002
2003 YTD Jan 2003 - 25t oct 2003
2003 Year To Month - jan 2003 oct 2003
Any help will be appreciated

Similar Messages

  • Query Help for reporting on last receipt qty

    SBO Version: 8.82 PL11
    Hello Forum,
    I am looking for some help devising a command behind a crystal report. We are hoping to achieve the last receipt quantity. To arrive at this we would like it to get the last GRPO for an item and total the quantity on that particular GRPO. In addition to this, we want to consider all the lines on the document and SUM them.
    At present, the query I have is as follows:
    Select SUM(c0.Quantity) from PDN1 c0 WHERE c0.ItemCode = T1.ItemCode AND Shipdate = (select Max(ShipDate) from PDN1 C0  INNER JOIN OPDN c1 ON c0.DocEntry = c1.DocEntry where C0.Itemcode =T1.ItemCode AND c1.DocStatus <> 'C'))
    Any assistance would be greatly received.
    Thanks
    Sarah

    Hi Sarah,
    Please repost to the SAP Business One Application  space.
    -Abhilash

  • FIFO Query to generate report Which relates the out-quantity to in-quantity

    Dear Experts,
    I am trying to generate a report to find out the Inward documents of Items which are issued or transfered. Items are managed with FIFO. Certain Items are serially managed and certain not.
    I am using the tables OIVL, OIVE and OIVQ for getting the details.
    Now my problem is in certain situations the relation between OIVE and OIVQ returns more line items than required and not able to specifically found out the rows. (Same TreeID is used for several transactions)
    Please help
    Thanks and regards
    Ajith Gopalakrishnan

    Hi,
    This Query help you a lot as I made this query for displaying the recieve and out quantity of an item as per the date i.e. On which date you recieve how much quantity of an item and how much quantity you release of an item. and please amend the remaining transtype from the transaction table (OINM).
    In case of FIFO you know that First IN First OUT is followed so you can easily see that which item on a particular date you recieve and which item on a particular date you release...and if any more further enhancement you required then please let me know ....if will definitely make out some time to help you out.
    select distinct SUM(InQty)as InQty,SUM(OutQty)as OutQty,ItemCode,Dscription,DocDate, TransType,
    case TransType
    when '-2' then 'opening Balance'
    when '20' then 'Goods Reciept PO '
    when '59' then 'Reciept From Production/Good Reciept '
    when '15' then 'Deliveries '
    end as 'TransName'
    from (
    select ItemCode,Dscription,DocDate, InQty,OutQty,TransType from oinm ) as OINM
    group by DocDate,ItemCode,TransType,Dscription order by  docdate asc
    Thanks
    Randy

  • See sql query from crystal report without crystal report

    see sql query from crystal report without crystal report 

    Hi,
    Depends on datasource type but you could have a look at ODBC trace or if you have access to the SQL Server you could use profiler to monitor the session.
    Regards,
    Craig
    And this will only be of use if you know which Server/Insstance/Database the Report is connecting to...
    Please click "Mark As Answer" if my post helped. Tony C.

  • RWI 00200 Error while scheduling the Bex Query based Webi report

    Dear All,
    I am facing the below error while scheduling the Bex Query based Webi report.
    Error:RWI 00200
    We are using BO XI 4.0 Sp05.
    Please advise

    Hi,
    I am on BO 4.0 SP05 Patch 6. Webi reports are just showing processing but not giving results. When I try to create new report it is throwing java security error.
    Tried applet patch upgrade(From link : https://websmp207.sap-ag.de/~sapidb/011000358700000902752013E) for webi certificate but didn't help.
    Please suggest what could be done.
    Thanks and Regards,
    Ankit Sharma

  • How to write REF-CURSOR Query in Oracle Reports

    Hello Guys!!
    I have a form in which you can select regions/divisions/locations etc by the use of check boxes. And the selected values will be inserted into a table, and based on the selected values of the table the report is run.
    The issue I have is with the query inside the Oracle reports(attached to this file).
    The query works fine until the last two EXISTS conditions.
    IF a region exists In the table report_param then it works fine but if there are no divisions in it , then the query returns no values, which is not correct.
    Someone has advised me to use a ref-cursor query inside reports tool, which I am not aware off. So, anykind of suggestions or advises are welcome. Please let me know about it as it is very urgent issue for me. Anykind of help would be greatly
    appreciated.
    Thanks,
    Vishal
    -------------------------------------------------------Query in Oracle Reports---------------------------------------------------------
    select c.key_segment, p.supplier_id,
    decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>')) COL_NM,
    sum(a.ext_price) sales_dols,
    sum(comp_allow_pkg.get_comp_allow_stddiv(a.control_loc_id, a.product_id, a.sold_to_customer_id,
    a.doc_dt, a.ext_price, a.units)) cust_reb_dols,
    sum(a.units) units,
    sum(a.ext_cost) cost_dols
    from sales a, key_segment_plns c, product p, rep_wrtr_dw_cust h
    where a.doc_dt between :in_start_dt and :in_end_dt
    and a.customer_oc = h.control_loc_id
    and a.sold_to_customer_id = h.sold_to_cust_id
    and a.ship_to_customer_id = h.ship_to_cust_id
    and ((:in_dg_cd = 'B' and h.dealer_grower_cd in ('D','G')) or h.dealer_grower_cd = :in_dg_cd)
    and a.product_id = p.product_id
    and p.product_gl_class_cd = 'CHEM'
    and p.product_legal_name = c.product_legal_name
    and c.key_segment in ('GLYPHOSATE','PLANT HEALTH/RUST FUNGICIDES','PYRETHROIDS','STROBI FUNGICIDES')--&IN_KEY_SEGMENTS
    -- and (:in_oc = 'ALL' or (a.control_loc_id in (select control_loc from control_loc_comb_ocs where control_loc_comb = :in_oc)))
    -- SALES DATA FILTERS TO MATCH ACCUM_SALES_DG_MV
    and a.sale_type_cd in ('02','08')
    and a.document_type_cd in ('I','C','D')
    and (substr(a.product_id,-1) in ('0','1') OR nvl(upper(trim(p.product_brand)),'X') = 'TECH FEE')
    and a.units <> 0
    and a.unit_cost <> 0
    and a.unit_price <> 0
    -- NEW FILTERS ADDED 9/11/07: LOCATION(BRANCH), BUSINESS TYPE, RSM/ASM/REP
    and ((:in_loc = 'ALL') or (nvl(a.warehouse_id,'<blank>') in (SELECT param_value
    FROM report_param
    WHERE report_id = :IN_REPORT_ID
    AND session_id= :IN_SESSION_ID
    AND USER_ID = :IN_USER_ID
    AND param_name='LOCATION_TYPE')))
    and ((:in_uhs_ag = 'ALL') or (:in_uhs_ag = 'NA' and p.product_uhs_ag != 'A') or (p.product_uhs_ag = :in_uhs_ag))
    and ((:in_sales_rep = 'ALL') or (nvl(a.territory_id,'<blank>') in (SELECT param_value
    FROM report_param
    WHERE report_id = :IN_REPORT_ID
    AND session_id= :IN_SESSION_ID
    AND USER_ID = :IN_USER_ID
    AND param_name='SALES_REP_TYPE')))
    and EXISTS
    (SELECT '1'
    FROM locations l, report_param rp
    WHERE rp.report_id = :IN_REPORT_ID
    AND rp.session_id= :IN_SESSION_ID
    AND rp.user_id = :IN_USER_ID
    AND rp.param_value = l.region
    AND rp.param_name = 'REGION_TYPE'
    AND a.warehouse_id = L.ARS_LOCATION)
    and EXISTS
    (SELECT '1'
    FROM locations l, report_param rp
    WHERE rp.report_id = :IN_REPORT_ID
    AND rp.session_id= :IN_SESSION_ID
    AND rp.user_id = :IN_USER_ID
    AND rp.param_value = l.region
    AND rp.param_name = 'DIVISION_TYPE'
    AND a.warehouse_id = L.ARS_LOCATION)
    group by c.key_segment, P.supplier_id,
    decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>'))

    Hi,
    I need your help to create a report using Ref-Cursor. please see the below thread
    Report using ref cursor or dynamic Sql

  • How to enable show SQL Query in Crystal report tool

    Hi,
    How can we enable the show SQL Query under Database tab in crystal report...
    We have a requirement to modify the SQL query in Crystal reports.
    Thanks,
    Gana

    Gana,
    CR has an "Add Command" feature that will allow you to use hand-coded SQL as your data source.
    Look at Defining an SQL Command in CR's online help (F1).
    If a command was used in the original report creation, it's a simple matter to go in and edit that SQL.
    If the report was not originally built w/ a Command you may find it difficult to switch over. In most cases it easier to start over from scratch, creating a new, blank report, that uses the command.
    Jason

  • How to see views created on query in a report.

    Hi
    Could you please help me out urgently?
    I have a question regarding how to see views created on query in a report.
    Is there any table or query through which we can see views created on Query?
    Thanks & Regards
    Neha

    Hi,
    If you created a view on any query,
    What is view ?
    once you execute the query and save the output as view right ?
    But we can not see the view in query output.
    Insted of executing the query, directly we can execute the view which you have saved as query output.
    Open the BEX and search for the view insted of query then it will give you the out put directly.
    I hope it will help you.
    Regards,
    Yerrabelli.

  • Getting Java error while connect BEx query to WebI report (SAP BI4.0 )

    Not able to connect BEx query to WebI report (SAP BI4.0 ) . Below is the error I get while creating a new BEx connection to BOBJ WebI report .
    Please find the below error and help me ,
    "Select a BW Bex query window box "  displayed "Nothing to display " and server error as mentioned below
    Java.uti.concurrent.executionException: Com.sap.sl.sdk.repository.service.repositor******
    at Java.uti.concurrent.futuretask (Unknown source )
    at java.swing.swing.timer.fireactionperformed(Unknown source )
    at java.awt.event.invocationEvent.dispatch(Unknown Source)
    Thanks ,
    Pradeep Gorpadu

    Hi,
    I am on BO 4.0 SP05 Patch 6. Webi reports are just showing processing but not giving results. When I try to create new report it is throwing java security error.
    Tried applet patch upgrade(From link : https://websmp207.sap-ag.de/~sapidb/011000358700000902752013E) for webi certificate but didn't help.
    Please suggest what could be done.
    Thanks and Regards,
    Ankit Sharma

  • Query regarding Crystal Reports Server

    Hi,
    I am new to Crystal Reports.
    I have created a couple of .rpt files using CR2008 and I am loading these report files in my aspx pages using CrystalReportViewer control.
    I am planning to host my webApp on IIS in production environment. Maximum simultaneous/concurrent connections to my reports would be 1 or 2.
    My question is:
    1. Do I need Crystal Reports Server in this scenario?
    2. In future if the number of concurrent users to report increases then do I need to go for Crystal Reports Server? Will just buying and installing the Crystal reports server on production server work? or will I have to do some configuration or some other changes in the existing deployed reports? OR Will I have to deploy my existing reports on Crystal Report Server again?
    Any help will be highly appreciated.
    Thanks in advance,
    Manish

    Manish, please do not cross post:
    Query regarding Crystal Reports Server
    See the [Rules of Engagement|http://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] for more details.
    Marking this thread as answered and locking...
    - Ludek

  • ABAP Query and ABAP Report

    Hi,
    1.What is the difference between ABAP Query and ABAP report?
    2.What are the advantages of LSMW over BDC?
    Regards,
    Ajit

    Hi,
    Please read the rules of engagement before you post.
    Step 1: Finding An Answer
    Rule number one: Try to find the answer first. There are tons of resources out there, show that you have tried to find the answer. A question that shows that the person is willing to try and help themselves is more likely to be answered than one which simply demands information. Tell us what you have done to try and solve the problem yourself - often we can learn from that too!
    Search the forums, the articles, the blog posts and the Frequently Asked Questions (FAQ) in the Wiki for your topic.

  • Creating search help through reports

    Hello experts,
    Is there a method so that I can create search help through reports?
    Thanks,
    Mohit.

    hi,
    we can create F4 help through report and also we can create Input Help from the ABAP Dictionary  .
    please check this link for Input Help from the ABAP Dictionary  .
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaa5435c111d1829f0000e829fbfe/content.htm
    and for F4 help in reports you can use some function modules:
    select-options :                 so_selgp FOR t458a-selgp  /
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_selgp-low .
      REFRESH gt_auskt[].
      here insert select query to fill your internal table .
      IF so_selgp[] IS NOT INITIAL.
        DELETE gt_t458a1  WHERE selgp NOT IN so_selgp[].
      ENDIF.
      SELECT aussl auslt FROM t458b INTO CORRESPONDING FIELDS OF  TABLE gt_t458b WHERE spras = 'E'.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
        DDIC_STRUCTURE         = ' '
          retfield               = 'SELGP'
        PVALKEY                = ' '
         dynpprog               = 'ZPPGL_MRP_LIST '
         dynpnr                 = '1000'
         dynprofield            = 'SO_SELGP'
         value_org              = 'S'
      IMPORTING
        USER_RESET             =
        TABLES
          value_tab              = gt_auskt   " internal table.
      EXCEPTIONS
        PARAMETER_ERROR        = 1
        NO_VALUES_FOUND        = 2
        OTHERS                 = 3

  • Mapping relation from sap bw query to crystal report

    Hello Gurus,
            will you please describe mapping relation for following items from sap bw query to crystal report? it is better to provide a instance for each one.
               (1) character   (2) key figure  (3) navigation attribute  (4) display attribute (5) charater with hiararchy
    Many thanks

    This blog may be helpful:
    /people/ingo.hilgefort/blog/2008/10/03/businessobjects-and-sap-part-1-of-4--creating-a-xcelsius-dashboard-on-top-of-sap-bi

  • Ref cursor help in Reports/pl sql

    Hello , i am new to this , please help!
    From oracle forms, we have a table and one of the columns from that table returns rows and the result are like ( select name, messaging_id, listing_id from dynamic_message group_query) ..I am trying to join this table with other tables based on a group type, based on if it returns 'D' or 'S' to other groups in report.
    I am getting the following error when I uncomment the open cursor statemnt
    PLS-00455: cursor 'TEMP_GRP_REC_REFCUR' cannot be used in dynamic
    SQL OPEN statement
    This is what i have so faar:
    create or replace PACKAGE grp IS
    TYPE grp_rec IS RECORD
    (listing_id varchar2(16 ),
    messaging_id varchar2(16 ),
    name varchar2(256 ) ,
    group_number Number);
    TYPE grp_rec_refcur is REF CURSOR RETURN grp_rec;
    function grprefc(P_group_number NUMBER, P_group_type CHAR) return grp_rec_refcur;
    END;
    CREATE OR REPLACE PACKAGE BODY grp IS
    function grprefc(p_group_number Number )
    return grp_rec_refcur
    IS
    temp_grp_rec_refcur grp.grp_rec_refcur;
    v_stmt_str VARCHAR2(2000) := NULL;
    v_cov_name listing.name%TYPE := NULL;
    v_cov_mid listing.messaging_id%TYPE := NULL;
    v_cov_lid listing.listing_id%TYPE := NULL;
    v_grpnum message_group.group_number%TYPE := NULL;
    BEGIN
              v_stmt_str:='SELECT dmgq.resolved_query
              INTO v_stmt_str
              FROM dynamic_message_group_query dmgq
              WHERE dmgq.group_number = p_group_number';
    OPEN temp_grp_rec_refcur FOR v_stmt_str;
         LOOP
         FETCH temp_grp_rec_refcur INTO v_cov_lid , v_cov_mid ,v_cov_name, v_grpnum ;
         EXIT WHEN temp_grp_rec_refcur %NOTFOUND;
         END Loop;
         RETURN temp_grp_rec_refcur;
    END;
    END;
    show errors;
    if there are any examples done by someone in reoprts or if you can help me solve the above, i would higghly appreciate it .
    Thanks and Good Day!

    Maybe something like my second example "Dynamic Table in the Second Query with Oracle Reports"
    - ref cursor or "simple" query Q1, which has a column "group_type", linked to a ref cursor query Q2.
    Ref cursor query Q2 - pseudo code for function:
    CREATE OR REPLACE PACKAGE BODY grp IS
    FUNCTION A_join_B_or_A_join_C_join_D
      (p_group_type CHAR(1), p_group_number NUMBER)
      RETURN dynamic_refcur
    IS
      l_refcur dynamic_refcur;
      l_stmt_str VARCHAR2(2000) := NULL;
    BEGIN
      IF p_group_type = 'S' THEN
        -- join A and B
        OPEN l_refcur FOR
          SELECT ...
            FROM A, B
           WHERE A.x = B.y;
      ELSE -- p_group_type = 'D'
        SELECT resolved_query
          INTO l_stmt_str
          FROM dynamic_message_group_query
         WHERE group_number = p_group_number;
        -- join A, C and D (= dynamically created SELECT)
        OPEN l_refcur FOR
          'SELECT ...
             FROM A, C, (' || l_stmt_str || ') D
            WHERE A.x = C.y
              AND A.z = D.t';
      END IF;
      RETURN l_refcur;
    END;
    END; Regards,
    Zlatko

  • Improving a query for a report in b1

    Dear All,
    We have a query  for a report. this report display all invoices with it´s Dscription in the system just have 3 descriptions so i need the the report display the this description in column not in row and then have the sum by  description. i dont know how can i put a picture for showing the example.
    Some one knows how can i do? down the code.
    Regards
    NANCY
    SELECT distinct  T1.visorder as 'No. Linea',
                            T0.DocNum as 'No. Factura',
                            T0.DocDate as 'Fecha',
                            T0.CardName as 'Cliente',
                            T1.U_CANTIDAD as 'Tonelaje',
                            T0.U_OPERACION as 'No. Operación',
                            T0.DocCur as 'Moneda',
                            T0.GrosProfit as 'Ingreso total de factura',
                            T1.ItemCode as 'Código',
                            T1.Dscription,
                            T1.Quantity*T1.Price as 'Importe por Servicio',
                            T1.LineVat as 'IVA por servicio',
                            T0.VatSum as 'IVA por factura',
                            T2.PlngGroup as 'Cuenta SUN'
    FROM OINV T0 LEFT JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    inner join OCRD T2 ON T0.CardCode = T2.CardCode
    WHERE T0.Series = 49 and
                T0.DocDate BETWEEN [%0] AND [%1]

    Hi Nancy,
    I'm not sure that I understand your requirement 100% but assuming you only have 3 descriptions then the following would give you totals for your different descriptions...
    Simply replace the text ' etc in the code below with the descriptions values.
    SELECT distinct 
         T1.visorder as 'No. Linea',
            T0.DocNum as 'No. Factura',
            T0.DocDate as 'Fecha',
            T0.CardName as 'Cliente',
            T1.U_CANTIDAD as 'Tonelaje',
            T0.U_OPERACION as 'No. Operación',
            T0.DocCur as 'Moneda',
            T0.GrosProfit as 'Ingreso total de factura',
            T1.ItemCode as 'Código',
            CASE
                   WHEN T1.Dscription = '<description1>'
                   THEN T1.Quantity*T1.Price
                   ELSE 0
              END as '<description1>',
              CASE
                   WHEN T1.Dscription = '<description2>'
                   THEN T1.Quantity*T1.Price
                   ELSE 0
              END as '<description2>',
              CASE
                   WHEN T1.Dscription = '<description3>'
                   THEN T1.Quantity*T1.Price
                   ELSE 0
              END as '<description3>',
            T1.LineVat as 'IVA por servicio',
            T0.VatSum as 'IVA por factura',
            T2.PlngGroup as 'Cuenta SUN'
    FROM OINV T0 LEFT JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    inner join OCRD T2 ON T0.CardCode = T2.CardCode
    WHERE T0.Series = 49 and
                T0.DocDate BETWEEN [%0] AND [%1]
    Hope this helps.
    Regards,
    Sean

Maybe you are looking for

  • Drill Down Report through Report Painter

    Dear All I am looking solution for Drill Down Reporting through Report Painter. Kindly Help me for the same. Thanks in Advance Alok

  • Getting Invalid Registry Object while uninstalling plugins programatically

    When a specific condition is hit (while the user is trying to open our perspective), we uninstall the plugins using the below code: Platform.getBundle(<Bundle name>).uninstall(); When we run this code on Juno 4.2.2, we are hitting the below exception

  • How to download photos from iphone 4s to pc

    How do you download photos from iphn 4s to my windows 7 pc?  How can if the Camera Roll is being downloaded as opposed to the Photo Stream? Please advise... and thanks! Also - where in the phone can I see how much video space I have used or have left

  • "option+drag" audio vs. time machine?

    I have used the "option+drag" to adjust the length of audio regions, stretching the audio itself. I can definitely notice a change in pitch. I am not stretching it far. Would I have better results maintaining the integrity of the audio by instead usi

  • XDCAM export

    Dear colleagues, I was very happy with my DigiBeta but XDCAM seems to be unavoidable. Bought a Sony PDW-D1. Installed all latest versions of the software -PC utility 1.5.0 -XDcam Transfer PDZK-P1 version 2.5 for my FC pro (6.0.2) -FAM driver 1.1.2 Wh