Count of order number

Hi,
How to get list of year and count of orders_number from a table?
Year       Count
2000        100
2001        150
2002        0
2003        212even though there is no data in table for year 2002, it should display 2002 with 0 count
where to_char(order_year,'YYYY) between 2000 and 2003Thanks
Sandy

I think you need to create a table that holds all the years that you want to count upon. Then you can join your orders table with that "yearlist" table. This "yearlist" table can be a virtual table that is created on the fly useing some different approaches.
example startyear=2000, endyear= 2005
/* using hierarical select with connect by */
with yearlist as (select 2000+level-1 as yr
              from dual
              connect by level <= 2005-2000+1)
select * from yearlist;
YR
2000
2001
2002
2003
2004
2005
/* using a dummy table that has enough rows */
with yearlist as (select 2000+rownum-1 as yr
            from all_objects 
            where rownum <= 2005-2000+1
            order by yr)
select * from yearlist
YR
2000
2001
2002
2003
2004
2005adding your orders table should give someting like this
untested
with yearlist as (select 2000+rownum-1 as yr, to_date('01.01.'||to_char(2000+rownum-1,'fm0000'),'DD.MM.YYYY') as yrDate
            from all_objects 
            where rownum <= 2005-2000+1
            order by yr)
select y.yr , count(*), count(distinct o.order_number)
from yearlist y
left join orders o on trunc(o.order_date,'year') = y.yrDate
group by y.yr
order by y.yrEdited by: Sven W. on Aug 25, 2010 6:49 PM - added example using the orders table

Similar Messages

  • Problem in Shipment purchase order number

    Hello Experts,
    At time of shipment count number(VI02), purchase order and service entry is created automatically. But whenever created new shipment count same purchase order number is updated ie sequentially not taking, but service entry has not problem.
    Pls tell why this problem is occured.

    Hi,
    It depends on customizing settings for the PO for shipment costing. You can set a period for validity of the PO. In standard it is set to a month (I believe). It will split up per forwarding agent.
    Quote of help.sap:
    The purchase order can be valid for the following periods:
    Day
    Week
    Month
    In Customizing the purchasing organization, the purchasing group and the plant must be assigned to the corresponding transportation planning point and the shipment cost type. You make these settings in the IMG. Choose Logistics Execution ® Transportation ® Shipment costs ® Settlement ® Assign purchasing data.
    End quote.
    MdZ

  • COUNT of orders in Report output

    Hi All,
    I want to display number of orders that are displayed in report.
    What formula should i create?
    I just have order number in my Rows and an amount key figure in Columns. I'm using BW 3.5.
    Any help is appriciated.
    Thanks!!

    HI,
    I supposse what you require is a counter along your column..
    For that create a new  CKF and in the formula part asign it the value "1".
    In the calculations tab of the CKF check the box nxt to "cumulated"and also " also apply to results" ie, if you require to treat ur result row ,as anothr row,els dont check that box.
    In the following drop down select "calculate along rows"
    Save the query and your counter is set along the rows.
    Regards,
    Savitha

  • Calculating count of orders using virtual key figures

    Hi All,
    In my report, i need a counter for the number of distinct orders.
    1ROWCOUNT didnt work for me as i want the count of distinct orders alone.
    I am planning to use virtual key figure for this..
    However, i donno how to code this in ZXRSRU02 and ZXRSRZZZ.
    Any help on this would be great!!
    Thanks!
    - Arun KK

    Shana,
    I dont understand your question.
    I'll give an eg.
    this is how the cube is.
    Order | Desc | Location
    101  |   'X'  | loc01
    101  |   'X'  | loc02
    102  |   'Y'  | loc01
    103  |   'Z'  | loc01
    102  |   'Y'  | loc02
    in the report, i need the o/p to  be.
    Order | Desc | count
    101  |   'X'  | 1
    102  |   'Y'  | 1
    103  |   'Z'  | 1
    i cant use 1rowcount as that counts each row and not the service orders.
    Hope this answers your question.
    Please let me know if there is a solution for this.
    Thanks!
    ~ Arun KK

  • How to determine count for the number of rows

    Appreciate if any of you could think of a way of determining the count for the number of rows in the subquery without having to run another query.
    SELECT *FROM
    (SELECT rownum, rn, rlp_id, rlp_notes, cad_pid, status, jurisdiction_id, s.state_abbr, rlp_address, rlp_route_id, rlp_route_section, psma_version FROM ipod.relevant_land_parcels r, state s WHERE s.state_pid = r.state_pid(+) AND rlp_route_id = 'SM1' AND status = 'CURRENT')WHERE rn > 200 AND rn < 216
    And I want to import this into.net and C# environment.

    Something like this,.....????
    SQL> select * from emp;
    EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
    7369 SMITH      CLERK      7902 17/12/1980     800,00               20
    7499 ALLEN      SALESMAN   7698 20/02/1981    1600,00    300,00     30
    7521 WARD       SALESMAN   7698 22/02/1981    1250,00    500,00     30
    7566 JONES      MANAGER    7839 02/04/1981    2975,00               20
    7654 MARTIN     SALESMAN   7698 28/09/1981    1250,00   1400,00     30
    7698 BLAKE      MANAGER    7839 01/05/1981    2850,00               30
    7782 CLARK      MANAGER    7839 09/06/1981    2450,00               10
    7788 SCOTT      ANALYST    7566 19/04/1987    3000,00               20
    7839 KING       PRESIDENT       17/11/1981    5000,00               10
    7844 TURNER     SALESMAN   7698 08/09/1981    1500,00      0,00     30
    7876 ADAMS      CLERK      7788 23/05/1987    1100,00               20
    7900 JAMES      CLERK      7698 03/12/1981     950,00               30
    7902 FORD       ANALYST    7566 03/12/1981    3000,00               20
    7934 MILLER     CLERK      7782 23/01/1982    1300,00               10
    14 rows selected
    SQL>
    SQL> select max(rw) from
    2 (
    3 select empno , row_number () over (order by empno) rw from emp
    4 where job='CLERK'
    5 )
    6 /
       MAX(RW)
             4Greetings...
    Sim

  • Count PM Orders for monthly report

    Hi  all
    Is there any option or standard report to show the number of closed PM Orders (Work Orders) for a monthly period, equally count PM Orders raised and Outstanding for a month period  ??
    Any assistance is most welcome
    John

    Hi
    Yeah, I've been manually counting them so far, but was hoping there may have been some sort of report that would give an actual figure

  • ACCOUNT - MISSING ORDER, HAVE ORDER NUMBER CANT FIND ORDER

    Hi Adobe,
    I ordered LightRoom4 for my daughter (I have the order number) and her processor was too old to handle the mac software updates necessary to run LR4, so she just bought a new computer and would like to install it on her new computer. Previously, she downloaded it and was getting an error message telling her she couldn't open the installer program to install/run the software. Now that she has an up-to-date computer, we'd like to install the purchased product we haven't yet been able to use but it isn't showing up in my order history or downloads anymore. PLEASE HELP. (I tried calling but was less than impressed with the automated phone service that doesn't have options for download/order/account help! Not a happy customer.)

    Lightroom 4 -
        Mac: http://www.adobe.com/support/downloads/detail.jsp?ftpID=5566
        PC:  http://www.adobe.com/support/downloads/detail.jsp?ftpID=5567
    Although I don't think this will be considered an order after this amount of time has passed... Get help with orders, refunds, and exchanges (non-CC)
    http://helpx.adobe.com/x-productkb/global/service-b.html ( http://adobe.ly/1d3k3a5 )

  • Report for Asset number and its Purahcse order number

    Hello Friends,
    Please give me details of report for Asset number and its Purchase order number .
    Regards
    Nilesh Vakil

    hi,
    GO to ME2N...
    use SHIFT + F4..
    there check for the acc. assign cata. field and input the asset  and execute..
    Regards
    Priyanka.P

  • Report for displaying the order number & order date..

    HI ALL,
    can any body help me for displaying the order number,customer name,material name & order date..in report
    i dnt know the which are the table i need to use...
    can anybody tell me which are table do i need to use and fields in tables
    input to report from the user are cutomer number,purchase order numbervendor number & sales number
    waiting for positive reply form u people.....
    thanks
    Zabeerulla
    Moderator message: "spec dumping", please work yourself first on your requirement, do some research, talk to a functional consultant near you.
    Edited by: Thomas Zloch on Feb 28, 2011 2:14 PM

    Thx  dharma raj  ...
    problem is ,input to report from the user are cutomer number,purchase order number,vendor number & sales number
    report should contain
    customer name
    order date
    order #
    vendor name
    material name
    can u please tell me which are the table do i need to use...
    i have ,please look into it...let me know if am incorrect
    customer name -> kna1_name where kna1_kunnr=knagv_kunnr
    order date -> vbak_audat
    order nunber->vbak_vbeln
    vendor name -> LFA1_NAME where LFA1_LIFNR=MEPO_TOPLINE(superfileld)
    material # -> VBAP_ARKTX where VBAP_VBELN=VBAK_VBELN
    HELP ME OUT...
    THX
    ZABEER

  • Invoice numbers to generate Sales Order Number

    I work for a billing department and we use SAP to key our invoices however we have a sales order that has a different number that corresponds with each invoice.
    If i get a list from my manager that has a bunch of invoice numbers, is there a way i can load them into sap and have it create something where it tells me the sales order number that goes with the invoice number? If it can work with multiple numbers at once will be best..
    what if the invoice numbers have a customer name in the Bill To line that i want to see as well. can that happen?

    Hello,
    Yes, I'm struggling to understand what you're after too. You could create a z table to keep track of the number if it's bespoke. Otherwise try these tables: FBN1, NRIV (intervals), T161 (po) TNRO (linked to NRIV).
    Good luck!
    Ash Thomas
    http://www.ashthomas.com
    Sap Abap Developer & Sap Abap Programmer

  • How to look for sales order number if I know outbound delivery number?

    How to look for sales order number if I know outbound delivery number?

    Hi ,
        If you want to see the Sales order Number from Outbound delivery or invoice,go to their respective T-codes,say for example,
    for delivery,Goto Tcode: VL02N / VL03N.There you will find Document Flow Icon,click on that,or press F7.
    You will get a window,there you can see the Sales order Number before your outbound delivery Number
    With Thanks and Regards,
    Priya

  • How to add an order number to each page of an adobe doc?

    I have a customer that is requiring us to add their order number to every page of multipage documents we send them.  Right now we're using typewriter and pasting the order number to each page individually.  Is there an easy way to automate this process?  So that for each order number, we just type in the order number once and each page subsequently has the order number stamped on it.
    Thanks in advance for any and all help.
    We are running both Adobe Acrobat 7.0 and 8.0.

    Perfect.  That's exactly what I was looking for.
    Thanks a lot.

  • How to trace purchase order number with respect to Purchase requestion numb

    Hi friends,
    Can u please help me how to Trace purchase order number with respect to purchase Requetuion  number. Is there any standard report  available in R/3

    Hi Vamsi,
    Thats what!!!
    Goto SE16 - EBAN - Give PR number in the iput screen.
    In the output screen you will have to do field selection from Menu - Settings - formatlist - choose fields.
    There you choose Purchase Order.
    So the output will display for you POs for the PR that you entered.
    Regards,
    Vishal

  • How to update sales order number (KAUFN) characteristic in the profitability segment of the PA document created at the time of service entry sheet confirmation, as a result of shipment cost document

    Hi,
    We have a scenario wherein we create shipment cost documents against delivery. As a result of shipments fully transferred, a PO for freight vendor is automatically created and a service entry sheet confirmation happens. As a result of service entry sheet confirmation, we have Financial accounting, Controlling and profitability analysis documents created. We have a requirement wherein we need to have the characteristic “sales order number (KAUFN)” populated in the profitability analysis document created as a result of service entry sheet confirmation.
    Could someone please advice how could this be attained in COPA. Thanks for your help in advance.
    Regards,
    Sandeep

    Hi Ajay,
    Thank you for the quick update.
    The document is updated to COPA through OKB9 settings. The profitability segment is updated with fields like customer, product, company code, plant, sales area data, profit center, etc; however the sales order number is missing.
    Could you please elaborate further how could FI substitution be implemented to call for the FM COPA_PROFITABILITY_SEGMENT through user exit? Are you recommending the substitution through GGB1? What could be the possible validation to call for the user exit to be implemented?
    Regards,
    Sandeep Kulkarni

  • WBS Element - Order Number Relationship

    Hi,
    I need to know the specific Order Number (example: PM order) with cost posting on WBS element.  I am use COVP / COEP field OBJNR to see the WBS Element (those starts with PR*), but I do not know which field is the Order Nmber contained in the table.
    Please advise in which table can I see the linkage between WBS and Order number for cost postings.
    Thanks!
    Regards,
    Vivian

    hi,
    plz go thru following thread.Might be it will help u
    WBS Conversion Routines
    Conversion - Internal number to External number
    WBS element
    <b>plz reward if useful</b>

Maybe you are looking for