Count SO in month in VL01.

hi friends ,
i want to count how many Sale order's generated in month. and want to display it with Sale Order that this is first , second or third........ Sale Order of this month. these should display in screen VL01 , VL02, VL03.
thanks.

First place a select query on VBAK Table with the created on (ERDAT) field between month start date and month end date and get it in internal table itab1.
Month end date may be calculated by function modules: END_OF_MONTH_DETERMINE_2  or LAST_DAY_OF_MONTHS.
Then describe table itab will give you the number of Sale order's generated in a month.
You may sort itab based on ERDAT for display.
I was not able to understand what do you mean by "these should display in screen VL01 , VL02, VL03."
If you need them on some event of VL01, 02 , 03 use some user exit or BADI. Try MV45AFZZ and MV45AFZB.
Hope it helps.

Similar Messages

  • Help for total count in a month

    Hello everyone,I am reposting this message with the hope that I will get some help. Please help me I have a deadline to meet and maybe getting late in meeting the deadline.
    Sometime back I had posted about the date function. I have that problem solved now my problem is that after finding all records which against each record I need to find the total count for that month if no records than I have to set it to a 0.
    Here is how my program has been written.
    PROCEDURE extract_materials
    IS
    CURSOR xyz
    BEGIN
    FOR xyz1 IN xyz LOOP
    -- once inside the loop for each of the record from
    the cursor I need to find a total count for that record for everymonth in the year.
    All these records will be instered in to a staging table
    Can you please help me out with this. I really appreciate this.
    Thanks in advance

    Take a look at analytic functions-- they should be just what the doctor ordered.
    Justin

  • How to get count for missing month

    I created a view as follows:
    CREATE OR REPLACE FORCE VIEW "Vinfection1" ("MONTH", "COUNT") AS
    select "MONTH","COUNT" from (
    select to_char(s.pdate,'Mon-yyyy') as month, count(*) as count
    from surproc s, diagnosis_surproc d
    where s.surprocid = d.surprocid and d.diagnosisid in ('506', '507', '508', '509', '510')
    group by to_char(pdate,'Mon-yyyy'))
    order by to_date(month,'Mon-yyyy')
    Some months are missing in the view. I want to put that month and 0 in the view. How to do it?
    Thanks,
    Jennifer

    Hi, Jennifer,
    You need to outer-join to some table or result set (such as all_months, below) that has one roe per month.
    Here's one way:
    CREATE OR REPLACE FORCE VIEW Vinfection1 (month, month_s, cnt) AS
    WITH    all_months     AS
         SELECT  ADD_MONTHS (first_month, LEVEL - 1)     AS month
         FROM     (
                  SELECT  TRUNC (MIN (pdate), 'MONTH')     AS first_month
                  ,         TRUNC (MAX (pdate), 'MONTH')     AS last_month
                  FROM    surproc
         CONNECT BY     LEVEL <= 1 + MONTHS_NETWEEN (last_month, first_month)
    SELECT  a.month
    ,     TO_CHAR (a.month, 'Mon-yyyy')     AS month_s
    ,     COUNT (*)                 AS cnt
    FROM              all_months      a
    LEFT OUTER JOIN      (     surproc               s
                   JOIN   diagnosis_surproc      d  ON   s.surprocid     = d.surprocid
                                          AND  d.diagnosisid     IN ('506', '507', '508', '509', '510')
               )     ON  a.month     = TRUNC (s.pdate)
    GROUP BY  a.month
    /Avoid table- and column names that are non-standatrd (such as names that need double-quotes), or are built-in function names (such as COUNT).
    Don't use ORDER BY in a view. Almost anything you do with the view will cause the ordering to be lost anyway.
    Even if you do have an ORDER BY clause in the view, you'll often want to ORDER BY month. Rather than call TO_DATE whenever you need to sort, I suggest having two month columns; month (whcih is a DATE) for sorting, filtering and joining, and month_s (whcih is a VARCHAR2) for displaying.
    Use ANSI join syntax, especiallly for outer joins.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Mar 20, 2012 12:03 PM
    Added outer join condition

  • Count Number of Month

    Hi all,
    I have these following column :
    start_cycle_date = 1 Jan 2010
    end_cycle_date = 1 Jan 2011
    I wanna count the total months left everytime i run the query (frequency run = monthly, 29th everymonth).
    The total month is 12 months. After run start_cycle_date will be changed.
    Example :
    First run 29th jan = 11 months left
    Second run 1st Mar = 10 months left
    Third run on 29th Mar = 9 months left
    How can i query to display the correct months left even though i run it on 1st of march for feb??

    You can use the function
    months_between(date1,date2)
    ex: select months_between(sysdate+365, sysdate) from dual;

  • Help in finding the total count for each month

    Hello everyone,
    Sometime back I had posted about the date function. I have that problem solved now my problem is that after finding all records which against each record I need to find the total count for that month if no records than I have to set it to a 0.
    Here is how my program has been written.
    PROCEDURE extract_materials
    IS
    CURSOR xyz
    BEGIN
    FOR xyz1 IN xyz LOOP
    -- once inside the loop for each of the record from
    the cursor I need to find a total count for that record for everymonth in the year.
    All these records will be instered in to a staging table
    Can you please help me out with this. I really appreciate this.
    Thanks in advance.
    -Vani

    Andrew - you missed the tricky bit of the spec - include missing months with a zero.
    You need to do an outer join to a select from any big table with a function involving rownum and add_months to generate all the possible months. However, its time to go home and I can't be bothered to work out the finer details.

  • Count Days in month

    Hi Team members,
    we are working on a budgeting application and stuck on below Research, please assist/advise is there any built-in Function to count Days in a Month which we can use or a work around .
    Requirement:
    To calculate budgeted Expenses per month, user will enter the daily budgeted expenses for a month and it will multiple with total number of days in a month via formula. same thing happens to some revenue items.
    Note:
    every months contains different number of Days which will result in change in Expense/Revenue figures.
    e.g
    Daily Expense for Jan will be $100/day
    total days in Jan = 31
    Result will be 31*100 = $3100 expense in Jan
    but in Feb it will be
    Daily Expense for Feb will be $100/day
    total days in Jan = 28
    Result will be 28*100 = $2800 expense in Feb
    Regards,
    Alee

    Dear Alp,
    Thanks for the Code!!!
    Note:
    In general terms the algorithm for calculating a leap year is as follows...
    A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400.
    Thus years such as 1996, 1992, 1988 and so on are leap years because they are divisible by 4 but not by 100. For century years, the 400 rule is important. Thus, century years 1900, 1800 and 1700 while all still divisible by 4 are also exactly divisible by 100. As they are not further divisible by 400, they are not leap years.
    Regards,
    Alee

  • Calculating count during previous months

    I am working on a report where we need to track the number of tickets that were open at the end of previous months. I have calculated those tickets that were closed in the same month by comparing the month of the ticket's creation date with that of the ticket's close date using a CASE if:
    CASE WHEN MONTH(ticket_fact.Modified) = Month(ticket_fact.Created) THEN 0 ELSE 1 END
    How do I get just the count of all the tickets for this. I have results in a table but now each row shows a 0 or 1 and Pivot table does not seem to work as well.
    If I use Status then I get the status that the ticket is currently in.
    Thank you so much.

    OK, based on what your are asking and what you have done, I have to ask if what you are trying to do is what you really want to track. For one thing, your approach only works "this year." Once the new year comes, using the MONTH function will get you the counts of both "this year" and "last year." So counting only using the "months" of the dates is not correct. You would need the YEAR function as well.
    Second, if you want to know if tickets are being closed in a reasonable amount of time, then you don't want to track just tickets that "opened and closed in the same month." Why? Because what if a ticket opened two days before month end and closed three days later? Wouldn't that be pretty efficient? Yet your report won't track that since the created and closed dates are in different months.
    What I would suggest as a better report is to track tickets that close within certain breakpoints in time, regardless of what day of the month it opened, for example, how many tickets were closed within 30 days? How many were closed in 60 days? etc. This report would give you a better analysis than tickets opened and closed in one month.
    You would need to categorize your tickets with a CASE statement similar to the following:
    CASE WHEN TIMESTAMPDIFF(SQL_TSI_DAY, ticket_fact.Created, ticket_fact.Modified) < 30 THEN 'Less than 30 Days' ELSE CASE WHEN TIMESTAMPDIFF(SQL_TSI_DAY, ticket_fact.Created, ticket_fact.Modified) < 61 THEN '30 - 60 Days'...
    This is what you should count.

  • Count function on months column gives wrong result

    Hi,
    I am on OBIEE 11.1.1.7.150120.
    I used the count function on the month column and rather than getting 12 as the answer i get 365. (i used a filter on the year column to restrict it to one year)
    How could this happen?
    Any help would be appreciated.

    I was able to get the answer as 12 on the month column in the Dim_Time using the count distinct.
    The main reason i was trying this is because i have a VALUE column in VIew_A. I am trying to sum the values of these, but when i use the sum function, the output is quite huge and wrong. I dosen't match with the monthly figures.
    For eg:
    Month
    Income Cost
    JAN
    186.96
    FEB
    309.29
    MAR
    246.82
    APR
    247.95
    998.76
    1,462.74
    MAY
    160.27
    645.60
    1,643.84
    JUN
    172.19
    693.61
    927.12
    JUL
    150.27
    605.32
    855.89
    AUG
    133.61
    483.66
    538.20
    789.22
    SEP
    144.56
    412.42
    582.34
    824.84
    OCT
    264.96
    315.66
    364.00
    631.32
    1,067.32
    1,466.22
    NOV
    240.39
    832.10
    968.32
    1,058.73
    1,638.38
    DEC
    215.81
    857.30
    869.31
    24005.34
    But if i use the sum function on the Income/cost column, the value i get is
    C_MONTH
    SUM(INCOME_COST)
    JAN
    5,795.86
    FEB
    8,660.21
    MAR
    7,651.52
    APR
    81,283.62
    MAY
    75,941.13
    JUN
    53,787.67
    JUL
    49,955.96
    AUG
    60,285.39
    SEP
    58,924.80
    OCT
    127,394.01
    NOV
    142,137.76
    DEC
    60,215.18
    This just doesn't work out. I need the answer to be 24005 by using the sum function

  • Count records per month

    Hi,
    there is two date columns "from" and "to" in the table "contracts" (contract validity, e.g. from 01.03.2012 to 31.12.2014). How to select the count of valid contratc per month ?
    Result:
    month valid contracts
    03.2012 2341
    04.2012 2355
    Thanks in advance,
    Michel

    Hi, Michel,
    Michel77 wrote:
    Hi,
    there is two date columns "from" and "to" in the table "contracts" (contract validity, e.g. from 01.03.2012 to 31.12.2014). How to select the count of valid contratc per month ?So, if the start_date is in March, 2012, and the end_date is in December, 2014, do you want that 1 contract to be counted 34 times, once for each month from March 2012 through December 2014?
    Here's one way:
    WITH     month_range     AS
         SELECT     TRUNC (MIN (start_date, 'MONTH'))     AS start_month
         ,     TRUNC (MAX (end_date,     'MONTH'))     AS end_month
         FROM     contracts
    ,     all_months     AS
         SELECT     ADD_MONTHS ( start_month
                      , LEVEL - 1
                      )          AS this_month
         ,     ADD_MONTHS ( start_month
                      , LEVEL
                      )          AS next_month
         FROM    month_range
         CONNECT BY     LEVEL <= 1 + MONTHS_BETWEEN ( end_month
                                                 , start_month
    SELECT       a.this_month
    ,       COUNT (c.start_date)     AS valid_contracts
    FROM            all_months  a
    LEFT OUTER JOIN contracts   c  ON  c.start_date          <  a.next_month
                                  AND c.end_date          >= a.this_month
    GROUP BY  a.this_month
    ORDER BY  a.this_month
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Point out where the statment above is getting the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Count days per month

    dear members,
    I have been provided with the date range.
    i want to calculate the no. of days for each month, within the above date range.
    e.g. date1='10-01-2011' and date2='18-03-2011'
    for month=01 count days=22
    for month=02 count days=28
    for month=03 count days=18
    thanks
    teefu
    developer

    WITH     parameters     AS
         SELECT     TO_DATE ( '10-01-2011'
                   , 'DD-MM-YYYY'
                   )     AS start_dt
         ,     TO_DATE ( '18-03-2011'
                   , 'DD-MM-YYYY'
                   )     AS end_dt
         FROM     dual
    SELECT     TO_CHAR ( start_dt + LEVEL - 1
              , 'FMMonth YYYY'
              )     AS month
    ,     COUNT (*)     AS days
    FROM     parameters
    CONNECT BY     LEVEL <= 1 + end_dt - start_dt
    GROUP BY TO_CHAR ( start_dt + LEVEL - 1
              , 'FMMonth YYYY'
    ORDER BY MIN (LEVEL)
    duplicate thread already one has given the above answer
    count days of the month
    Edited by: LPS on Jul 21, 2011 2:16 AM

  • Count number of Months

    Dear,
    Please help me for the following issue:-
    I got a column contain lots of date and "July" are occur more then 1 times. I am looking to count the total number of July.
    Thanks

    Hi kinsinglim,
    This is the forum for Numbers for Mac. Are you doing this on an iPhone? Here is a way on a Mac running OS X.
    Table 1 has a Header Row and a Footer Row. Column A is formatted as Date and Time, with Time "None". Column B is formatted as Automatic.
    To find the Month of the year for each date, formula in B2 (and fill Down) is:
    =MONTH(A2)
    Formula in the Footer Cell B7 is:
    =COUNTIF(B,"=7")
    If this does not work on iPhone, try posting your question in this forum:
    iWork for iOS https://discussions.apple.com/community/app_store/iwork_for_ios?view=discussions
    Regards,
    Ian.

  • Extracting a count of distinct values between two date ranges over months

    Hi All,
    I am having a bit of difficulty in figuring out the query to build a list of active campaigns over a date range.
    i.e. I have a table with campaign IDs and their start and end date details like this
    Campaign_id     Start_date     End_date
            10001     1-Jun-09     31-May-11
            10002     1-Jun-09     23-Jun-11
            30041     21-Aug-09     31-Dec-09
            20005     3-Jun-10     31-May-11
            90021     21-Nov-09     30-Nov-10
            54000     1-Jun-11     1-Dec-12
            35600     1-Mar-10     31-Mar-12 What the above data means is, for eg. the campaign 10001 is active from 1-Jun-09 to 31-May-11 i.e. for 24 months (inclusive of the month Jun-09 and May-11)
    What I need to figure out is the counts of active campaigns between a date range and display that active count at a month level (for e.g. lets say we want to see all the campaigns that were active
    between the date range '01-JUN-2007' and '30-APR-2012' ). So the partial output would be as seen below. The list would continue till december-2012
    Month    Year    Count of active campaigns
    Jan    2009    0
    Feb    2009    0
    Mar    2009    0
    Apr    2009    0
    May    2009    0
    Jun    2009    2
    Jul    2009    2
    Aug    2009    3
    Sep    2009    3
    Oct    2009    3
    Nov    2009    4
    Dec    2009    4
    Jan    2010    3
    Feb    2010    3
    Mar    2010    4
    Apr    2010    4
    Dec    2012    1 Could anybody please help me with the right query for this.
    Thanks a lot for help
    Regards
    Goldi

    set pagesize 40
    with tab as
                    select 1 id, sysdate -100 start_date, sysdate end_date from dual
                    union
                    select 1 id, sysdate -200 start_date, sysdate -150 end_date from dual
                    union
                    select 1 id, sysdate -600 start_date, sysdate - 400 end_date from dual
                    union
                    select 1 id, sysdate -300 start_date, sysdate - 150 end_date from dual
                    union
                    select 2 id, sysdate -100 start_date, sysdate-50 end_date from dual
          year_tab as
                        select
                                 add_months(min_date, level -1) m
                        from
                                select min(trunc(start_date,'YYYY')) min_date, add_months(max(trunc(end_date,'YYYY')), 12) max_date
                                from tab
                        connect by level <= months_between(max_date, min_date)
    select to_char(m,'YYYY') year_,
             to_char(m,'Month') month_,
             nvl(act, 0) act
    from   year_tab,
                select m date_,count(*)  act
                from tab, year_tab
                where m between trunc(start_date,'MM') and trunc(end_date,'MM')
                group by m
                ) month_tab
    where m = date_(+)
    order by m;
    YEAR_ MONTH_           ACT
    2010  January            0
    2010  February           0
    2010  March              0
    2010  April              0
    2010  May                0
    2010  June               0
    2010  July               0
    2010  August             0
    2010  September          1
    2010  October            1
    2010  November           1
    2010  December           1
    2011  January            1
    2011  February           1
    2011  March              1
    2011  April              0
    2011  May                0
    2011  June               0
    2011  July               1
    2011  August             1
    2011  September          1
    2011  October            2
    2011  November           2
    2011  December           2
    2012  January            2
    2012  February           2
    2012  March              2
    2012  April              1
    2012  May                1
    2012  June               0
    2012  July               0
    2012  August             0
    2012  September          0
    2012  October            0
    2012  November           0
    2012  December           0
    36 rows selected.

  • Month count

    Oracle -9i Release 2
    How do I write a sql query to get month-wise count for actual working day, i.e. exclude saturday and sundays from the month count, is there a way to do it, i have the following query that gives total count for each month, also it is not ordered by month.
    SELECT TO_CHAR(xmonth.ddate,'MON'),COUNT(1)
    FROM (SELECT TRUNC(SYSDATE,'mon') + ROWNUM - 1 ddate
    FROM ALL_OBJECTS
    WHERE TRUNC(SYSDATE,'mon') + ROWNUM - 1 <= LAST_DAY(TO_DATE('12/31/2005','mm/dd/yyyy')) ) xmonth
    GROUP BY TO_CHAR(xmonth.ddate,'MON')

    The following example should help.
      1  SELECT TO_CHAR(MYDATE,'MONTH YYYY') MONTH, COUNT(*) COUNT
      2  FROM(SELECT DATE '2004-01-01'+ ROWNUM -1 MYDATE
      3         FROM(SELECT 1 FROM DUAL
      4               GROUP BY CUBE(1,2,3,4,5,6,7,8,9)))
      5  WHERE MYDATE < DATE '2005-01-01'
      6  AND TO_CHAR(MYDATE,'DY') NOT IN ('SAT','SUN')
      7  GROUP BY TO_CHAR(MYDATE,'MONTH YYYY')
      8* ORDER BY TO_DATE(TO_CHAR(MYDATE,'MONTH YYYY'),'MONTH YYYY')
    SQL> /
    MONTH                               COUNT
    JANUARY   2004                         22
    FEBRUARY  2004                         20
    MARCH     2004                         23
    APRIL     2004                         22
    MAY       2004                         21
    JUNE      2004                         22
    JULY      2004                         22
    AUGUST    2004                         22
    SEPTEMBER 2004                         22
    OCTOBER   2004                         21
    NOVEMBER  2004                         22
    DECEMBER  2004                         23
    12 rows selected.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production

  • Month count from 0CALMONTH

    I am trying to get the count of the month from 0CALMONTH using an exit variable. Is this code correct? Thanks.
      WHEN 'ZMONTHCT'.
        IF i_step = 2.
    data: month_num type i.
            LOOP AT I_T_var_range
               INTO loc_var_range WHERE vnam = '0PCALMONTH' or
                                        vnam = 'ZCMONTH2' OR
                             vnam = 'ZCMONTH3' OR
                             vnam = 'ZCMONTH4'.
            month_num = loc_var_range-low+4(2).
            l_S_range-low = month_num.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO E_T_range.
            EXIT.
          ENDLOOP.
        ENDIF.

    sohini,
    Instead of doing all that...
    Take the calmonth variable value - have a formula variable in your query to get the text value of the charactewristic..
    Lets take 022007...
    The internal format would be 022007 use the formula to calculate absolute value of (022007 / 10000) you would get 2 which is what you want - you need not use any exit for this or use the other number functions to get the value that you want when you divide this value by 10000 ...
    Arun
    Assign points if useful

  • Current month open sales orders

    Hello Experts,
    I have requirement to build a custom report to calculate open sales order quantity and its count for current month. I know we can use VBBE for open quantity and VBUP for the status to capture the count, however how can i add the logic to get the required information for the current month. Is there a function module or BAPI available which can be of any help, i have to consider the performance issue too, if i were to use multiple tables. Please advise
    Thanks
    Rahul

    HI Rahul,
    There is a standard BAPI available for listing Sales Orders.
    <b>BAPI_SALESORDER_GETLIST</b>
    However to meet your requirement of <b>OPEN sales orders</b>, you will have to modify this BAPI to suit your purpose. You can give appropriate logic to you ABAPer with reference to tables VBUK,VBUP, etc. This means that you will have to create a new Z-BAPI, keeping the above BAPI as the core.
    Once this is done you can wrap Z-BAPI in a transaction code or a program/ report, so that it is ready to use by business.
    Selection Variants can be used to default the date range as 01/MM/XXXXX to 31/MM/XXXX.
    Hope this will prove of some help to you..
    if yes then ..pls reward liberally
    Sachin Bhonsle

Maybe you are looking for