Creation of query base on quarters

Hi
  we have to create a query which shows sales of customer for last four quarters.
can you pls tel me how to get the data for last four quarters

Hi HariPriyasS  ,
Take 0CALMONTH and restrict it with variable 0CMCQUAR.
Now in the same same where you have selected this variable 0CMCQUAR, there is a button called "Set Offset for Variable", use this button to set the offset. Now take the offset as "-12". So this will give you "the Current Quarter in Last year".
Now again do the same activity as described above but with offsets as -9 , -6 , -3  and at last use same variable with no offset that will represent current quarter.
Hope this gives you a better clarity.
Regards,
Pratap Sone

Similar Messages

  • SQL Query base Finish goods year wise report

    Hi
    I want to make query base year wise report  of Finish Goods.
    example like :
    Item Name     Year2010-11                           Year2011-12
       abc         Sep   Oct   Nov                 Sep    Oct   Nov 
        xyz        5     0      10                   2    5      0
    Why this report is need to me because i want to see How old Finish Goods are in the Stock. so that when a delivery make, the person can delivery from old stock first.
    Our FY is from September to August
    Please help me
    Regards,
    Mizan
    Edited by: mizan700 on Nov 15, 2011 3:28 PM

    Hi Eva,
    As Sybrand mentioned, you can't create DDL inside a procedure, and you probably don't need a temporary table. Temporary tables in SQL server used to be used to create a read consistent view for the duration of the procedure, but Oracle's multi version concurrent consistency model eliminates this as a need in all but the most remote cases.
    Your create table only seems to be used to take arguments from the user, which I don't see in your code.
    If I am looking at your code correctly, all you really want to ask the database is the following:
    select nvl(sum(dc.daily_count),0)
      from daily_counts_summary dc, branch br, division div
      where dc.branch_ky = br.branch_ky
        and br.division_ky = div.division_ky
        and dc.transaction_dt = t.trndt
        and dc.commission_cd = 'R'
        and div.division_ky = nvl(v_div_ky,div.division_ky)
        and dc.member_type_cd, 'P'
        and dc.expiration_dt between v_exp_start_dt and v_exp_end_dt;You can do this in Crystal Reports by writing a procedure that has an out parameter of type sys_refcursor. All you have to do is:
    create or replace procedure my_proc(p_curs in out sys_refcursor,v_exp_start_dt date,v_exp_end_dt date) is
    begin
      open p_cur for
    select nvl(sum(dc.daily_count),0)
      from daily_counts_summary dc, branch br, division div
      where dc.branch_ky = br.branch_ky
        and br.division_ky = div.division_ky
        and dc.transaction_dt = t.trndt
        and dc.commission_cd = 'R'
        and div.division_ky = nvl(v_div_ky,div.division_ky)
        and dc.member_type_cd, 'P'
        and dc.expiration_dt between v_exp_start_dt and v_exp_end_dt;
    end;
    /...or something close to that, with perhaps calls to your date functions to extract what you need.
    You also have several syntax errors in your code. I would recommend you get two books if your are going to work with Oracle:
    Anything by Tom Kyte
    Anything by Steven Feuerstein
    These would both be available on amazon.com
    HTH,
    Steve

  • Authorization Object for role creation for query display?

    Hi,
    Can Anybody here tell me what is the Authorization object that we use for role creation for query display?
    I want to assign a role to the newly designed query! that query does not have any role so far!
    Pls suggest me
    Thanks,
    Ravi

    Hi,
    I could make the authorization tab green by entering the authorization object!
    But user tab still remains red as it is not allowing me to enter my username in the user tab!
    in the user tab  i am unable to enter my user name?
    Any suggestions?
    Thanks,
    Ravi

  • Query base approval for PO Unit Price

    Dear All,
    I want a Query Base approval
    Scenario: If Purchase Order Unit Price Exceed form 10000/- INR then Purchase Order Goes to the  Approval
    Do any one have a Query base approval for above Scenario?

    In an approval query you can not access all the row level data. (Only the first line.)  So you can not connect your approval on row level conditions.
    I can suggest one (but a little uncomfortable and complicated) workaround for approval on line level:
    1. Create a header level UDF e.g. named ForApproval with possible values Y and N, with default value N.
    2. Write code in the SBO_SP_TransactionNotification stored procedure, that signals an error message u2018You should set ForApproval to Y!u2019  if U_ForApproval=u2019Nu2019 and there is any line with fulfilling your criteria.
    3. Set an approval procedure according to the header level ForApproval field.

  • How to make query base delivery monthly report  link with delivery return

    Hi,
    I have facing some problem in Sales delivery report monthly. Problem is:
    1) When i make Monthly query delivery report without any delivery return and AR Credit memo, it is Fine.
    2) When i make Monthly query delivery report with any delivery return and AR Credit memo, it is not showing proper. Its showing in report including return quantity or AR Credit memo quantity.
    So, How to make query base delivery monthly report  link with delivery return and AR Credit Memo?
    Please help me regarding this.
    Mizan
    Edited by: mizan700 on Dec 18, 2010 2:50 PM
    Edited by: mizan700 on Dec 18, 2010 2:50 PM

    Hi,
    try this.
    SELECT DISTINCt T1.CARDCODE, T1.CARDNAME , T1.DOCNUM DELIVERY#,T1.DocStatus 'DELIVERY STATUS', T1.DOCDATE 'DELIVERY Date', T1.DocTotal 'DELIVERY Total', T3.DOCNUM Return#,T3.DocStatus 'Return Status', T3.DOCDATE 'Return Date', T3.DocTotal 'Return Total',T5.DOCNUM Invoice#,T5.DocStatus 'Invoice Status', T5.DOCDATE 'Invoice Date', (T5.DocTotal-T5.VatSum-T5.TotalExpns-T5.DiscSum) 'Total Before Discount', T5.VatSum 'Tax', T5.TotalExpns 'Freight', (T5.DocTotal - T5.PaidToDate) 'Total Payment Due', T7.DOCNUM AS 'CREDIT MEMO#', T7.DOCDATE
    FROM DBO.DLN1 T0
    INNER JOIN DBO.ODLN T1 ON T1.DOCENTRY = T0.DOCENTRY
    LEFT JOIN DBO.RDN1 T2 ON T2.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.ORDN T3 ON T2.DOCENTRY = T3.DOCENTRY
    LEFT JOIN DBO.INV1 T4 ON T4.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.OINV T5 ON T5.DOCENTRY = T4.DOCENTRY
    LEFT JOIN DBO.RIN1 T6 ON T6.BASEENTRY = T5.DOCENTRY
    LEFT JOIN DBO.ORIN T7 ON T7.DOCENTRY = T6.DOCENTRY
    WHERE  T1.DOCDATE >= [%0] AND  T1.DOCDATE <= [%1]
    Thanks,
    Joseph

  • Approval Templates On Query Base Not working..

    hi.
    Plz have a look on uploaded image.
    here i had highlighted that no of approvals are required at approval stages form
    what is the meaning of 2 ,
    ->i think the  2 people approval we need compulsorily.  Am i currect.
    ->In approval Stages i added two persons but i given no of approval need 1
    what will happen . If any body one person will approve , will it approve the document am i currect.
    And one more thing In Approval template under terms i am using query based on this one
    the document should be approve if i give Doctotal total Greater than amount  working fine
    but i need query base approve..
    what i need while adding the sales quotation if project code is not empty
    it will take the approval
    select  t0.docentry from oqut t0 inner join qut1 t1 on t0.docentry=t1.docentry where t1.Project <>''
    the above scenarios i will check it..
    but i need your valuable suggestions...

    Thank u working fine..
    last Question plz reply to me.
    1)Is Approval Stages are unique means
    in approval template if i use one approval stage in another approval template can i use same approval stage  will it work...
    2) in approval stage
    Total authorization persons are 2
    The below scenarios i am able to add the document i can able to update it.
    no of approval 1
    no of reject 1
    what is the meaning
    if out of 2 persons if any body approve the document document will add
    if out of 2 if any one person reject then  the document will reject
    no of approval 2
    no of reject 2
    Two users should approve the document otherwise document should not be add
    Two users should reject the    document otherwise document should not be reject
    no of approval 2
    no of reject 1
    two users should approve the document otherwise document should not be add
    out of 2, one user should reject the document no need second users reject
    no of approval 1
    no of reject 2
    one user is enough
    two users need to approve the document
    Plz clarify my doubt.
    I am waiting for your reply..

  • Creation of Installation base automatically

    Hi Friends,
    I am exploring the solution for customer installation. With respect to that I want a installation base creation as automatic after customer master creation. The installation base should be equavelent to customer master, All partner data at customer master should copy automatically. In fact client has 8000 customer master. If the customer is removed , deleted then it should impact the Ibase.
    Also when ever the sales delevery completed with respect to the equipment(material serial no combination) , the same should go as component under installation base.Also equipment should get all partner detail from the installation base.
    If the equipment is removed via sales document then all partner details should be removed.However the usage records hass to be captured like previous partner etc. In addition what is the way to create the measurements points, maintenance plan in equipment.
    Regards
    Thenna

    Hi,
    I think your requirment can be met only with CRM services module,  However Automatic installed base gets created through maintaining Serial no. profile for Equipment, use "oein" T-code and while making delivery to customer through SD process, when you select the serial no.s just tick mark on the left box in "delvery > Extras>Serial Numbers."
    Prior to this process please maintain proper serial no. profilein MM for the material.(Euipment)
    regards
    DSR
    Edited by: D.Srinivasa Rao on Oct 28, 2011 12:36 PM

  • Bapi / F.M. for creation of install base for equipment (CS, not CRM)

    Hi everybody,
      Do you know any bapi / F.M. for the creation of an istall base, with one equipment and several materials?
    Thank you
    Andrea

    Hi everybody,
      Do you know any bapi / F.M. for the creation of an istall base, with one equipment and several materials?
    Thank you
    Andrea

  • Import query from BICA, quarterly

    Hi experts,
    I need to import a group of measures with no dimensions and the frecuency is quarterly, the query works fine, because the data shows what Im waiting for, the problem is that when I check the dataview in pas, the periodicity is monthly. By the way, I uploaded data only for Mar, Jun, Sept and Dec.
    Any Idea?
    thanks a lot!!
    Att Ingrid J.

    I have not used BICA so can't comment on why the BICA load created monthly variables. However there are a couple of possible work-arounds.
    One option is to create a second set of variables (quarterly) and then use a procedure to copy from the monthly to the quarterly.
    A second option is to treat he monthly variables as if they were quarterly. If a monthly variable is used in a quarterly report:
    if the time consolidation is SUM() the three months (two are empty) will be summed and so the quarter will be the sum of the three months.
    if the time consolidation is AVERAGE() I think there is an option to ignore empty and so they may still be usable
    Cliff

  • POWL creation from Query

    Hi,
    I had created a query using SQ01. Now i want to create the POWL from this query and from the existing queries.
    Is there any document to create it.
    Anurodh

    hi,
    Use the below link. It has the document for POWL creation from Infoset query:
    [Powl from Infoset Qery|http://help.sap.com/bp_ekit604/BBLibrary/Documentation/k52_How_to_Guide_EN_DE.doc]
    Regards,
    MAdhu

  • Approval Procedures - Query Base Issue

    Hello Experts,
    I have Set the Approval Procedures in SAP base on One Query
    Query is If Purchase Order Document No > then 29000 then go for Approval Process other wise not going for Approval Procedures
    My Query is
    < SELECT DISTINCT 'True' FROM OPOR N0 where N0.Docnum >'29000' >
    NOW PROBLEM IS WHEN DOCUMENT NO IS 321 THEN SYSTEM GOING FOR Approval Procedures,
    this is to be worng.
    Please guide me
    Dixit Patel

    Hi Dixit.........
    Try this......
    Select Distinct 'True' From OPOR T0 Where T0.DocNum>29000 and
    T0.DocNum=$[OPOR.DocNum.Number]

  • Creation d'une base de données

    Bonjour,
    Dans le cadre de mon projet qui est un banc de test, je souhaiterais  créer une base de données danslaquelle je peux stoker les différents références des produits que je vais tester  et leurs associer les tests correspondants.  Cela peut paraitre simple à certain mais je ne sais pas comment m'y prendre puisque je suis débutante. merci de me mettre sur le bon chemin.
    merci d'avance 

    merci pour votre réponse
    en fait j'ai fait recourt à Database Connectivity Toolkit, j'ai fait une petite recherche et mon premier essai était ci-joint. il consiste en la creation d'an tableau dans access qui va contenir tous les données et qu'il doit fonctionner normalement. mais c'était pas le cas chaque fois, lors de la simulation, une erreur se produit
    Attachments:
    applicationForm.vi ‏14 KB

  • Creation of query

    Hi Friends,
    Consider the following scenario.Following are the stock values on each day in an ODS.
    <b>DATE     MATERIAL     QTY
    1-Jan     A     100
    1-Jan     C     1000
    5-Jan     A     110
    8-Jan     B     50
    9-Jan     B     75
    9-Jan     C     1100
    11-Jan     A     120
    18-Jan     B     10
    19-Jan     A     75
    26-Jan     A     225
    29-Jan     C     750</b>
    (Note: MATERIAL refers to compound of Material, plant, storage location, etc.)
    the user runs the query on Jan 7 for balance on Jan 6 (through a date variable) the max date in the ODS for Material A is Jan 5 and that for material C is Jan 1. The query should retrieve 110 units for A and 1000 for C.  The front end variable controls the time slice....
    <b>How do I put this in a query</b>? Any help will be appreciated.

    Hi,
    Try the following approach. This is just an idea.I never used this in my project.
    1) Use one z Key figure to represent the Quantity. This KF should have 'Last Value' for Exceptional Aggregation and 0calday as the 'Agg Reference char'.
    2) In the query define a variable on 0calday to take user single entry(say ZVAR1)
    3) Define restriction on quantity(z KF) with this variable like as follows:
    KF : ZKeyFigure
    0calday  > ZVAR1.
    With rgds,
    Anil Kumar Sharma .P

  • Need help in creation of query

    Hi Experts,
    Can you please let me know, how to create a query for the following requirement .. I have a XXX -DSO, on which i have to take no of records for the particular date of loading for company code & account document type ...
    Please let me know ASAP ..
    Thanks & Regards
    PT

    Hi,
    I am trying to understand your requirement.  Are you trying to get the count for the day with respect to company code and document type?
    Do you need count which matches both the company code and document type?
    Regards.
    Shanker

  • Automatic creation of installed base?

    Dear all,
    We are using CRM 5.0
    We are creating BOM for material in R3.
    Line :10 --> Header level item
    Line : 20 --> Parent item 1
    Line : 30 --> Parent item 2.
    Now as per standard When we are doing the delivery of any item in R3, A Installed base is created in CRM (Based on Delivery).
    But we are using BOM so line item 20 and 30 is attached to header item 10.
    and when we are creating delivery, three different installed base are creating.
    Actually i want One Installed base of item 10 and Attached item 20 & 30 becomes a component
    How can i do?
    Pls reply. I will reward the points
    Regards
    Jayesh

    Hi Jayesh,
    Use any of the following FM:
    IB_COM1_CHANGE_IBASE_ONLY  
    IB_COM2_CHANGE_IBASE_ONLY  
    IB_COM2_CREATE_IBASE       
    IB_COM_CREATE_IBASE_INITIAL
    Best Regards,
    Pratik Patel
    <b>Reward with Points!</b>

Maybe you are looking for