Number of weekdays

I need to find the number of week days(mon-fri) in a given month. I have used the FM DATE_CONVERT_TO_FACTORYDATE to get the difference between the first and the last day of the month. However it is not giving me the correct output. could someone please let me know how I can get the desired output?

Hello,
In your system, there would be one or more calendars defined, get the 2 byte calendar id to be used to get check the holiday from the functional people (or check txn SCAL, or tables THOC*).
Now, you have some function modules you can use to check the work-days (I do not think you have one which will give you the no of working days for a period, so you may have to run it for each date to count the no of days), the code may look like
*say your period is from w_fromdate to w_todate, and
calendar is in w_calid
data : w_date like sy-datum.
data : no_of_workdays type i.
w_date = w_fromdate.
do.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
         EXPORTING
              DATE                       = w_date
              FACTORY_CALENDAR_ID        = w_calid
              MESSAGE_TYPE               = 'W'
         EXCEPTIONS
              DATE_AFTER_RANGE           = 1
              DATE_BEFORE_RANGE          = 2
              DATE_INVALID               = 3
              DATE_NO_WORKINGDAY         = 4
              FACTORY_CALENDAR_NOT_FOUND = 5
              MESSAGE_TYPE_INVALID       = 6
              OTHERS                     = 7.
    IF SY-SUBRC eq 0.
       no_of_workday = no_of_workday + 1.
    endif.
   w_date = w_date + 1.
   if w_date gt w_todate.
      exit.
   endif.
enddo.
*no_of_workdays shall get you the count of work days
Vasanth

Similar Messages

  • Determine number of weekdays between two dates

    I have LiveCycle 8.0 ... I have a form with two date fields called "FirstDayOff" and "LastDayOff". I want to determine the number of weekdays between those two dates and then convert to number of workday hours (based on an 8 hour day) ... I am using this for a "time off" request sheet for my company ...
    Also, can I use Formcalc to automatically give me the previous weekday to "FirstDayOff"
    Thanks.

    I have LiveCycle 8.0 ... I have a form with two date fields called "FirstDayOff" and "LastDayOff". I want to determine the number of weekdays between those two dates and then convert to number of workday hours (based on an 8 hour day) ... I am using this for a "time off" request sheet for my company ...
    Also, can I use Formcalc to automatically give me the previous weekday to "FirstDayOff"
    Thanks.

  • Number of a day of an year without saturday and sunday

    Hi,
    How can I get the number of the day of an year?
    How can I remove, from this number the saturday and the sunday? Should I check day by day?
    Thanks, bye bye.

    Or you can function NEXT_DAY, some math and table dual:
    to_char(to_date(6,'j'),'Day') is NLS independent way of representing Sunday and to_char(to_date(5,'j'),'Day') is NLS independent way of representing Saturday.
    NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day')) is first sunday >= start_date. NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) is last Sunday <= end_date. Therefore:
    (NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 is number of Sunday's between start_date and end_date. Same way:
    (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1 As a result, number of weekdays between start_date and end_date is:
    end_date - start_date + 1 -((NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 + 1 +
    (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 + 1) or
    end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) / 7 -
    (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) -
    NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7 or:
    SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,to_char(to_date(6,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(6,'j'),'Day'))) /
           7 - (NEXT_DAY(end_date - 7,to_char(to_date(5,'j'),'Day')) - NEXT_DAY(start_date - 1,to_char(to_date(5,'j'),'Day'))) / 7
    FROM DUAL; Now:
    WITH t AS (
               SELECT  to_char(to_date(6,'j'),'Day') sunday,
                       to_char(to_date(5,'j'),'Day') saturday,
                       DATE '2009-01-01'             start_date,
                       DATE '2009-12-31'             end_date
                 FROM  dual
    SELECT  end_date - start_date - 1 -(NEXT_DAY(end_date - 7,sunday) - NEXT_DAY(DATE '2009-01-01' - 1,sunday)) /
            7 - (NEXT_DAY(end_date - 7,saturday) - NEXT_DAY(start_date - 1,saturday)) / 7
      FROM  t
    END_DATE-DATE'2009-01-01'-1-(NEXT_DAY(END_DATE-7,SUNDAY)-NEXT_DAY(DATE'2009-01-0
                                                                                 261
    SQL> SY.

  • How to calculate the no. of weekdays between two active dates

    Hi all,
    I need to calculate the no. of weekdays between two days.
    For Example:
    If i want to know the number of weekdays between 17-NOV-2008 to 7-DEC-2008 its 10 excluding sat and sun.
    how to do that if the period is more?
    like 1-JAN-2006 to 12-APR-2007
    Thanks in advance..
    Regards,
    Manoj

    NEXT_DAY(start_date - 1,'SUNDAY') is first sunday >= start_date. NEXT_DAY(end_date - 7,'SUNDAY') is last Sunday <= end_date. Therefore:
    (NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 + 1 is number of Sunday's between start_date and end_date. Same way:
    (NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 + 1 As a result, number of weekdays between start_date and end_date is:
    business_day_count := end_date - start_date + 1 -((NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 + 1 + (NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 + 1) or
    business_day_count := end_date - start_date - 1 -(NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 - (NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 or:
    SELECT end_date - start_date - 1 -(NEXT_DAY(end_date - 7,'SUNDAY') - NEXT_DAY(start_date - 1,'SUNDAY')) / 7 - (NEXT_DAY(end_date - 7,'SATURDAY') - NEXT_DAY(start_date - 1,'SATURDAY')) / 7 FROM DUAL; The above code assumes business day count between two dates includes both start and end dates. Keep in mind, the above code is NLS dependent.
    SY.

  • Formula to count weekdays in a range of dates?

    I am a fairly new Crystal user (Crystal Reports 11) and not very technical.
    I have created a report with parameter prompts to enter a starting and ending date, and want to calculate the number of weekdays within that range (to determine the number of regular work hours within that time frame).
    I can calculate the total number of days, and have a parameter for the number of holidays to reduce my day count accordingly, but would like to use a formula to count the number of weekdays.  Is this possible?
    Thanks!
    Lois

    Thanks Abhilash,
    I have copied that formula in and put my parameters in place of the "({?DateParameter})" in your formula.  When I check the formula for errors, I get an error message highlighting the first instance of my date parameter with the message "This field cannot be summarized".  I tried to check the formula to be sure I didn't miss anything, but here is how it is in my reports:
    Numbervar Days := DateDiff("d", Minimum({?Starting date}), Maximum({?Ending date})) -
    DateDiff("ww", Minimum({?Starting date}), Maximum({?Ending date}), crsaturday) -
    DateDiff("ww", Minimum({?Starting date}), Maximum({?Ending date}), crsunday);
    Can you tell me how to resolve that error?
    Thanks so much,
    Lois

  • Weekdays between dates

    Does anyone know how to determine the
    number of weekdays between two dates. Does
    an Oracle function already exist. I don't want weekends to be included.
    Thanks.

    =========
    Abstract:
    =========
    The function in the script below will accept two date values and return the
    number of business days between the two.
    =============
    Requirements:
    =============
    CREATE PROCEDURE
    ===============
    Version Testing
    ===============
    This script has been tested on Oracle Versions 7.3.4.X - 8.1.6.XX.
    =======
    Script:
    =======
    ----------- cut ---------------------- cut -------------- cut --------------
    SET ECHO off
    REM NAME: TFSBSDAY.SQL
    REM USAGE:"@path/tfsbsday"
    REM ------------------------------------------------------------------------
    REM REQUIREMENTS:
    REM CREATE PROCEDURE
    REM ------------------------------------------------------------------------
    REM PURPOSE:
    REM The function created by this script will reutrn the number of
    REM business days between two dates.
    REM ------------------------------------------------------------------------
    REM EXAMPLE:
    REM SQL> @dates.sql
    REM
    REM Function created.
    REM
    REM SQL> select num_Business_Days('20-jun-95','28-jun-95') "Business
    REM Days" from dual;
    REM
    REM Business Days
    REM
    REM -------------
    REM 5
    REM ------------------------------------------------------------------------
    REM DISCLAIMER:
    REM This script is provided for educational purposes only. It is NOT
    REM supported by Oracle World Wide Technical Support.
    REM The script has been tested and appears to work as intended.
    REM You should always run new scripts on a test instance initially.
    REM ------------------------------------------------------------------------
    REM Main text of script follows:
    create or replace function
    num_Business_Days(start_date in date, end_date in date)
    return number is
    currdate date := start_date; /* holds the next date */
    theDay varchar2(10);/* day of the week for currdate */
    countBusiness number := 0; /* counter for business days */
    begin
    /* start date must be earlier than end date */
    if end_date - start_date <= 0 then
    return (0);
    end if;
    loop
    /* go to the next day */
    currdate := to_date(currdate+1);
    /* finished if end_date is reached */
    exit when currdate = end_date;
    /* what day of the week is it? */
    select to_char(currdate,'fmDay') into theDay from dual;
    /* count it only if it is a weekday */
    if theDay <> 'Saturday' and theDay <> 'Sunday' then
    countBusiness := countBusiness + 1;
    end if;
    end loop;
    return (countBusiness);
    end;
    ----------- cut ---------------------- cut -------------- cut --------------
    =========
    Examples:
    =========
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.5.1.0 - Production
    With the Partitioning and Java options
    PL/SQL Release 8.1.5.1.0 - Production
    SQL> @TFSBSDAY.sql
    Function created.
    SQL> select num_Business_Days('20-july-00','28-july-00')"Business Days" from dual;
    Return...
    Business Days
    5
    1 row selected.
    null

  • Usage of Query Rewrite in Materialized Views

    Hi,
    I have a star schema with fact table and and dimensions tables.
    One of the dimension tables is time_dimension and I have created
    a materialized view(time_sales_mv) on it and the fact table. I
    have also created a dimension(time_dim) on the
    table 'time_dimension' with hierarchies and attributes.
    Following are the syntaxes -
    --Dimension table
    CREATE TABLE TIME_DIMENSION (
    TIME_KEY NUMBER(9) NOT NULL,
    DAY_OF_MONTH NUMBER(9),
    WEEKDAY NUMBER(9),
    WEEKEND NUMBER(9),
    JULIAN_DAY NUMBER(9),
    JULIAN_WEEK NUMBER(9),
    JULIAN_YEAR NUMBER(9),
    MONTH_NUMBER NUMBER(9),
    MONTH_NAME VARCHAR2(15),
    WEEK_OF_THE_YEAR NUMBER(9),
    WEEKDAY_NAME VARCHAR2(10),
    WEEK_DAY_NUMBER NUMBER(9),
    THE_YEAR NUMBER(9),
    DAY_OF_THE_YEAR NUMBER(9),
    THE_DATE DATE,
    THE_QUARTER NUMBER(9),
    PRIMARY KEY ( TIME_KEY )) ;
    --Fact table
    CREATE TABLE SALES_FACT (
    TIME_KEY NUMBER(9) NOT NULL,
    PRODUCT_KEY NUMBER(9) NOT NULL,
    PROMOTION_KEY NUMBER(9) NOT NULL,
    CUSTOMER_KEY NUMBER(9) NOT NULL,
    DOLLAR_SALES FLOAT,
    UNIT_SALES NUMBER(9),
    DOLLAR_COST FLOAT)
    -- Dimension created
    CREATE DIMENSION Time_dim
    LEVEL THE_DATE IS TIME_DIMENSION.THE_DATE
    LEVEL WEEK_OF_THE_YEAR IS time_dimension.WEEK_OF_THE_YEAR
    LEVEL MONTH_NUMBER IS time_dimension.MONTH_NUMBER
    LEVEL THE_QUARTER IS time_dimension.THE_QUARTER
    LEVEL THE_YEAR IS time_dimension.THE_YEAR
    HIERARCHY calendar_rollup (
         THE_DATE CHILD OF
         MONTH_NUMBER CHILD OF
         THE_QUARTER CHILD OF
         THE_YEAR )
    HIERARCHY weekly_rollup (
         THE_DATE CHILD OF
    WEEK_OF_THE_YEAR )
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.DAY_OF_MONTH
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.WEEKDAY
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.JULIAN_DAY
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.DAY_OF_THE_YEAR
    ATTRIBUTE MONTH_NUMBER DETERMINES
    time_dimension_sagar.month_name
    ATTRIBUTE THE_YEAR DETERMINES
    time_dimension_sagar.JULIAN_YEAR;
    -- Materialized View
    CREATE MATERIALIZED VIEW time_sales_mv
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    ENABLE QUERY REWRITE
    AS
    SELECT t.month_number, SUM
    (dollar_sales) AS sum_dollar_sales
    FROM sales_fact s,time_dimension t
    WHERE t.time_key =
    s.time_key GROUP BY
    t.month_number
    Now if I use the same query as in the MV and see the explain
    plan it shows the MV is being used instead of the underlying
    tables which is as expected. But if I change 'month_number'
    to 'month_name' in the above query, the explain plan does not
    use the MV which is not as expected. Since 'month_name' is an
    attribute of 'month_number'(defined in the dimension
    definition), we can use it and query rewrite feature will join
    the MV to the time_dimension table. But in the actual plan, it
    uses the fact table 'sales_fact' instead of the MV. Even when I
    use the rewrite hint on the query it does not use the MV. I want
    know why this is happening??
    Query-
    SELECT t.month_number, SUM(dollar_sales) AS
    sum_dollar_sales FROM
    sales_fact s, time_dimension t
    WHERE t.time_key = s.time_key
    GROUP BY t.month_number
    Explain Plan -
    SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=82 Bytes=2132)
    TABLE ACCESS (FULL) OF TIME_SALES_MV (Cost=1 Card=82
    Bytes=2132)
    Query(using month_name instead of month_number)-
    SELECT t.month_name, SUM(dollar_sales)
    FROM sales_fact s, time_dimension t
    WHERE t.time_key = s.time_key
    GROUP BY t.month_name
    Explain Plan -
    SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
    Bytes=307802)
    SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
    HASH JOIN (Cost=16 Card=9053 Bytes=307802)
    TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
    Card=82 Bytes=1804)
    TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
    Bytes=132480)
    Query (using rewrite hint in the above query) -
    SELECT /*+ rewrite(time_sales_mv)*/
    t.month_name, SUM
    (dollar_sales)
    FROM sales_fact s, time_dimension t
    WHERE t.time_key = s.time_key
    GROUP BY t.month_name
    Explain Plan -
    SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
    Bytes=307802)
    SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
    HASH JOIN (Cost=16 Card=9053 Bytes=307802)
    TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
    Card=82 Bytes=1804)
    TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
    Bytes=132480)

    Hi,
    I have a star schema with fact table and and dimensions tables.
    One of the dimension tables is time_dimension and I have created
    a materialized view(time_sales_mv) on it and the fact table. I
    have also created a dimension(time_dim) on the
    table 'time_dimension' with hierarchies and attributes.
    Following are the syntaxes -
    --Dimension table
    CREATE TABLE TIME_DIMENSION (
    TIME_KEY NUMBER(9) NOT NULL,
    DAY_OF_MONTH NUMBER(9),
    WEEKDAY NUMBER(9),
    WEEKEND NUMBER(9),
    JULIAN_DAY NUMBER(9),
    JULIAN_WEEK NUMBER(9),
    JULIAN_YEAR NUMBER(9),
    MONTH_NUMBER NUMBER(9),
    MONTH_NAME VARCHAR2(15),
    WEEK_OF_THE_YEAR NUMBER(9),
    WEEKDAY_NAME VARCHAR2(10),
    WEEK_DAY_NUMBER NUMBER(9),
    THE_YEAR NUMBER(9),
    DAY_OF_THE_YEAR NUMBER(9),
    THE_DATE DATE,
    THE_QUARTER NUMBER(9),
    PRIMARY KEY ( TIME_KEY )) ;
    --Fact table
    CREATE TABLE SALES_FACT (
    TIME_KEY NUMBER(9) NOT NULL,
    PRODUCT_KEY NUMBER(9) NOT NULL,
    PROMOTION_KEY NUMBER(9) NOT NULL,
    CUSTOMER_KEY NUMBER(9) NOT NULL,
    DOLLAR_SALES FLOAT,
    UNIT_SALES NUMBER(9),
    DOLLAR_COST FLOAT)
    -- Dimension created
    CREATE DIMENSION Time_dim
    LEVEL THE_DATE IS TIME_DIMENSION.THE_DATE
    LEVEL WEEK_OF_THE_YEAR IS time_dimension.WEEK_OF_THE_YEAR
    LEVEL MONTH_NUMBER IS time_dimension.MONTH_NUMBER
    LEVEL THE_QUARTER IS time_dimension.THE_QUARTER
    LEVEL THE_YEAR IS time_dimension.THE_YEAR
    HIERARCHY calendar_rollup (
         THE_DATE CHILD OF
         MONTH_NUMBER CHILD OF
         THE_QUARTER CHILD OF
         THE_YEAR )
    HIERARCHY weekly_rollup (
         THE_DATE CHILD OF
    WEEK_OF_THE_YEAR )
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.DAY_OF_MONTH
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.WEEKDAY
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.JULIAN_DAY
    ATTRIBUTE THE_DATE DETERMINES
    time_dimension_sagar.DAY_OF_THE_YEAR
    ATTRIBUTE MONTH_NUMBER DETERMINES
    time_dimension_sagar.month_name
    ATTRIBUTE THE_YEAR DETERMINES
    time_dimension_sagar.JULIAN_YEAR;
    -- Materialized View
    CREATE MATERIALIZED VIEW time_sales_mv
    BUILD IMMEDIATE
    REFRESH COMPLETE ON DEMAND
    ENABLE QUERY REWRITE
    AS
    SELECT t.month_number, SUM
    (dollar_sales) AS sum_dollar_sales
    FROM sales_fact s,time_dimension t
    WHERE t.time_key =
    s.time_key GROUP BY
    t.month_number
    Now if I use the same query as in the MV and see the explain
    plan it shows the MV is being used instead of the underlying
    tables which is as expected. But if I change 'month_number'
    to 'month_name' in the above query, the explain plan does not
    use the MV which is not as expected. Since 'month_name' is an
    attribute of 'month_number'(defined in the dimension
    definition), we can use it and query rewrite feature will join
    the MV to the time_dimension table. But in the actual plan, it
    uses the fact table 'sales_fact' instead of the MV. Even when I
    use the rewrite hint on the query it does not use the MV. I want
    know why this is happening??
    Query-
    SELECT t.month_number, SUM(dollar_sales) AS
    sum_dollar_sales FROM
    sales_fact s, time_dimension t
    WHERE t.time_key = s.time_key
    GROUP BY t.month_number
    Explain Plan -
    SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=82 Bytes=2132)
    TABLE ACCESS (FULL) OF TIME_SALES_MV (Cost=1 Card=82
    Bytes=2132)
    Query(using month_name instead of month_number)-
    SELECT t.month_name, SUM(dollar_sales)
    FROM sales_fact s, time_dimension t
    WHERE t.time_key = s.time_key
    GROUP BY t.month_name
    Explain Plan -
    SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
    Bytes=307802)
    SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
    HASH JOIN (Cost=16 Card=9053 Bytes=307802)
    TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
    Card=82 Bytes=1804)
    TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
    Bytes=132480)
    Query (using rewrite hint in the above query) -
    SELECT /*+ rewrite(time_sales_mv)*/
    t.month_name, SUM
    (dollar_sales)
    FROM sales_fact s, time_dimension t
    WHERE t.time_key = s.time_key
    GROUP BY t.month_name
    Explain Plan -
    SELECT STATEMENT Optimizer=CHOOSE (Cost=151 Card=9053
    Bytes=307802)
    SORT (GROUP BY) (Cost=151 Card=9053 Bytes=307802)
    HASH JOIN (Cost=16 Card=9053 Bytes=307802)
    TABLE ACCESS (FULL) OF TIME_DIMENSION_SAGAR (Cost=1
    Card=82 Bytes=1804)
    TABLE ACCESS (FULL) OF SALES_FACT (Cost=10 Card=11040
    Bytes=132480)

  • Array or not an Array

    Afternoon all,
    I would like to know if to use an array or not on my report. I am designing a report which will show total number of jobs and those jobs divided in weekdays. i.e.
    Total number of jobs =100
    Weekdays - Number of jobs
    1  -              25 jobs
    2  -              25 jobs
    3  -              30 jobs
    4  -              10 jobs
    5  -              10 jobs
    Can I use an alternative method to an array to display number of weekdays in line? and setup in such a way that the report shows how many jobs took 1 day and how many took 2 days etc.
    any advise will be really appreciated.
    please note the total number of jobs is working fine, just need to know how to make the weekday to show all 5 working days in a row and records along side it.
    Many thanks
    Regards
    Jehanzeb

    Morning Graham,
    I am really thankful for your patience and help.
    I am using tabs now, specially when I found out that with tabs I could find out exact number of orders shipped, the exact order numbers and the dates when they were shipped.
    However, the method I would like to use was to find out how many days 1 single job took, and then iterate it to find out how many jobs took how many days.
    I tried your method by using a formula within tabs and put the formula within a row and summary field (with count option), however it didn't work. Well it does show number of orders i.e. 5 however, it doesn't show how many days each order took (which I am after). here is the code I used:
    if {order_header.order_status}>=77 then
    datediff('d',{order_header.date_entered},{order_progress.date_created})
    I also used
    if {order_header.order_status}>=77 then
    datediff('d',{order_header.date_entered},currentdatetime)
    and
    if {order_progress.order_status}=77 then
    datediff('d',{?Start Date},{?End Date},crMonday)
    and
    if {order_progress.order_status}=77 then
    datediff('d',{?Start Date},{?End Date})
    none of them are working - The days are shown as 0.00 and the total order number is showing 5.
    The order number 5 is fine because that is the total number of orders from 01/06/2008 to 30/06/2008. however this total number of order should be divided in days, showing
    Day 1 - 0
    Day 2 - 1
    Day 3 - 4
    Day 4 - 0
    The above division of days and orders is definitely right because I checked it using our old system.
    As oppose to Shipped Date, we don't have any field instead we have a field called Order Status, when an order reaches its status value (77), it is already marked as shipped.
    Date entered is the field in which order dates are placed when an order is placed with us. Date Created is the field which holds when the date of order progress is created.
    any other ideas which I can try? I know this would be very stupid suggestion but can you try something as a sample test on your crystal report and see if it shows number of days as oppose to orders?
    I mean only if you have anything like that (a sample), at least that will clear my head that there is def problem at my end and the formula i am using is correct.
    Many thanks once again
    Regards
    Jehanzeb
    Edited by: Jehanzeb Navid on Jul 18, 2008 10:08 AM
    Here is the SQL query:
    SELECT order_header.order_no, order_header.order_status, order_header.date_entered, order_header.account_no, order_progress.order_status
    FROM   maxmast.order_header order_header, maxmast.order_progress order_progress
    WHERE  ((order_header.order_no=order_progress.order_no) AND (order_header.order_status=order_progress.order_status)) AND (order_header.date_entered>={ts '2008-06-01 00:00:00'} AND order_header.date_entered<={ts '2008-06-30 00:00:00'}) AND order_header.account_no='0010065'

  • # of days

    How can I retrieve the number of weekdays in oracle?
    like friday till wednesday is 3 workingdays....plz help

    Hi,
    You can use the query:
    SELECT COUNT (gtd.transaction_date) balance_date
    FROM gl.gl_transaction_calendar gtc,
    gl.gl_transaction_dates gtd,
    gl.gl_sets_of_books sob
    WHERE sob.transaction_calendar_id = gtd.transaction_calendar_id
    AND gtc.transaction_calendar_id = gtd.transaction_calendar_id
    AND gtd.business_day_flag = 'Y'
    AND gtd.transaction_date BETWEEN '01-SEP-2007' AND '20-SEP-2007'
    AND sob.set_of_books_id = 22 --( Enter the set of book id you have )
    Hope this helps!
    Yogini

  • Get weekday number having date

    Hi SAPpers I have a code
    DATA: dayattr TYPE casdayattr OCCURS 0 WITH HEADER LINE.
    DATA: hcal LIKE scal-hcalid, fcal LIKE scal-fcalid.
    fcal = 'CZ'.
    hcal = 'CS'.
    CALL FUNCTION 'DAY_ATTRIBUTES_GET'
      EXPORTING
        factory_calendar = fcal
        holiday_calendar = hcal
        date_from        = '20071025'
        language         = sy-langu
      TABLES
        day_attributes   = dayattr.
    WRITE: / dayattr-weekday.
    I need to get weekday-number, but no matter which date I give to the function (date_from) it returns '1'. 20071025 is thursday, so I assume that dayattr-weekday should be '4' (or '5' if sunday is the first day). What am I doing wrong? Greetings

    Hi Piotr,
                 I am not sure based on what requirement you are using it but i just  tested the FM 'DAY_ATTRIBUTES_GET' in SE37 to get proper output i.e to get the day num' for the same i did some small changes as follows:
    <b>1.</b> <b>date_from</b> - here don't pass SAP format date instead give as <b>mm/dd/yyyy</b> format. Inorder to convert the SAP date format to mm/dd/yyyy use CONVERSION_EXIT_PDATE_OUTPUT FM i.e.
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
        EXPORTING
          input  = <b>lv_date</b>    " say this has your date 20071025
        IMPORTING
          output = <b>lv_cdate</b>. " This wud have 10/25/2007
    <b>2. Also pass date_to value in the FM</b> with same date value
    CALL FUNCTION 'DAY_ATTRIBUTES_GET'
      EXPORTING
        factory_calendar = 'CZ'
        holiday_calendar = 'CS'
        date_from        = <b>lv_cdate</b>
        <b>date_to           = lv_cdate</b>
        language         = sy-langu
      TABLES
        day_attributes   = dayattr.
    WRITE: / dayattr-weekday. " I had value as 4 here
    If this answers your query inform me.
    Regards,
    Bharathy.

  • Does anyone know of an ap that will auto call forward all voice calls from my iphone4 to a different number (office) at set times each day? IE - i want my business iphone to automatically call forward at 0830am weekdays and cancel the call forward at 6pm

    I am trying to find an app that will automatically forward all voice calls at preset times each day
    IE - at 083am weekdays
    and automatically cancel the call forward at 6pm weekdays
    At the moment i am doing it manually with alarms set to remind me
    Seems a pretty basic "want" but - i cant find anything
    And APPLE - make it easier to find APPS in the APP store - wy not have a search feature that you can type in what you are looking for??
    Thanks!!

    There are no apps to do what you want, that's why you can't find any. No app would have access to the necessary API's to do this, thus only Apple could implement such. You can suggest such to Apple here:
    http://www.apple.com/feedback/iphone.html
    Another suggestion is to look at Google Voice. I don't know if it offers these specific features or not, but it is highly customizable.

  • Number of the week in Ical

    Howcome the number of the week isn´t shown in Ical????

    there's no option for a week view in iCal, but John Maisey wrote this applescript.
    paste it in the Script Editor (Applications --> AppleScript --> Script Editor) and run it once...
    if your weekview starts on an other day change this line:
    set daysText to "MonTueWedThuFriSatSun"
    to (example)
    set daysText to "SunMonTueWedThuFriSat"
    --Copy below this line into Script Editor and click run --
    --Annual Week numbers
    --John Maisey
    --4/2/5
    set numberOfWeeks to 1000 -- change as needed
    set daysText to "MonTueWedThuFriSatSun"
    set aDate to (current date)
    set day of aDate to 1
    set month of aDate to January
    set aDay to weekday of aDate
    set weekNo to 1
    --Day of week as num. starting with 0
    set aDayText to (characters 1 thru 3 of (aDay as text)) as text
    set dayOff to ((offset of aDayText in daysText) - 1) / 3 as integer
    if dayOff is less than 5 then
    set StartDate to aDate - dayOff * days
    else
    set StartDate to aDate + (7 - dayOff) * days
    end if
    tell application "iCal"
    set newCal to make new calendar at end of calendars with properties {title:"Week No."}
    set myCal to (count of every calendar)
    end tell
    repeat with myCount from 1 to numberOfWeeks
    if (month of StartDate is December) and (day of StartDate is greater than 28) then set weekNo to 1
    if (month of StartDate is January) and (day of StartDate is less than 5) then set weekNo to 1
    set weekText to "Week No. " & weekNo
    tell application "iCal"
    tell calendar myCal
    make new event at end of events with properties {start date:StartDate, allday event:true, summary:weekText}
    end tell
    end tell
    set weekNo to weekNo + 1
    set StartDate to StartDate + 7 * days
    end repeat
    --

  • Day link - want Item to contain day number from calendar

    I'm a bit stymied here.
    Using the calendar, I would like to add a branch to a page based on the DAY of the calendar that the user clicks on. For example, if the calendar is on the screen, and the user clicks on day number 15, then I would like that "15" passed to the page that the user is sent to.
    Being a little more specific:
    Page 1 is a calendar page. When the user clicks on a day number in the calendar, I want it to branch to Page 2.
    Page 2 contains a text field for the calendar day. I would like to populate this field with the day number selected on Page 1.
    I can't seem to get ApEx to do this, but it seems like an obvious feature that users would want if they're using the Day Link functionality at all.
    Can anyone help??
    thanks,
    bruce

    I just tried creating a custom calendar template. There I changed the Weekday Attributed / Day Title Format to the following:
    &lt;a href="f?p=&APP_ID.:2:&SESSION.::&DEBUG.::P2_DAY:#DD#">&lt;div class="t10DayTitle">#DD#&lt;/div>&lt;/a>
    and this worked out.
    You also need to change the
    Non-Day Title Format and
    Weekend Title Format
    the same way, in order to cover all dates.
    Denes Kubicek

  • IPCC 7 Determine the week number of a month

    Hello,
    I am working towards determine the week number of month and make appropriate routing changes only for that specific week. I have tried using the trunc(), getdate() and weekday(). But i fail to get the week number of a month, but I believe I have managed to the week number of a year.
    The example I have considered is: On Tuesday and Thursdays in second week of every month the calls to be routed to a different skillgroup.
    Please let me know if anyone has any suggestion for this.
    Thanks,
    FYI,
    CM 4.1, CRS 3.5, ICM 7.1

    Hi buddy,
    Great stuff!! Your link gave me another hint of the possible solution, I was working on ICM but not sure why i did not consider CRS for this requirement , The CRS has a builtin function, I have used this builtin Methods which provided me what i expected.
    The debug on the script resulted the week of the month for today which is "4".
    Please let me know your view.
    Thanks again!

  • How to know the number of the week in iCal ?

    Hi !
    I'm very enjoying iCal. But, there is something very important for me that I can't find in iCal !
    I need to know the number of the week (in Month, Week or Day views).
    Is that a way to easily see it ?
    Regards,
    ant
    iMac G5   Mac OS X (10.4.2)  

    there's no option for a week view in iCal, but John Maisey wrote this applescript.
    paste it in the Script Editor (Applications --> AppleScript --> Script Editor) and run it once...
    if your weekview starts on an other day change this line:
    set daysText to "MonTueWedThuFriSatSun"
    to (example)
    set daysText to "SunMonTueWedThuFriSat"
    --Copy below this line into Script Editor and click run --
    --Annual Week numbers
    --John Maisey
    --4/2/5
    set numberOfWeeks to 1000 -- change as needed
    set daysText to "MonTueWedThuFriSatSun"
    set aDate to (current date)
    set day of aDate to 1
    set month of aDate to January
    set aDay to weekday of aDate
    set weekNo to 1
    --Day of week as num. starting with 0
    set aDayText to (characters 1 thru 3 of (aDay as text)) as text
    set dayOff to ((offset of aDayText in daysText) - 1) / 3 as integer
    if dayOff is less than 5 then
    set StartDate to aDate - dayOff * days
    else
    set StartDate to aDate + (7 - dayOff) * days
    end if
    tell application "iCal"
    set newCal to make new calendar at end of calendars with properties {title:"Week No."}
    set myCal to (count of every calendar)
    end tell
    repeat with myCount from 1 to numberOfWeeks
    if (month of StartDate is December) and (day of StartDate is greater than 28) then set weekNo to 1
    if (month of StartDate is January) and (day of StartDate is less than 5) then set weekNo to 1
    set weekText to "Week No. " & weekNo
    tell application "iCal"
    tell calendar myCal
    make new event at end of events with properties {start date:StartDate, allday event:true, summary:weekText}
    end tell
    end tell
    set weekNo to weekNo + 1
    set StartDate to StartDate + 7 * days
    end repeat
    --

Maybe you are looking for

  • HP Officejet 6500 E709n

    I'm trying to install Officejet 6500 e709n.  My OS is Vista. I keep getting: Issues Stopping installation: print spooler.  This service is stopped and needs to be running for installation to continue.  Then below that: Service: Spooler, Manufacturer:

  • Pictures in iPhoto Missing

    I had my MacBook Pro reset, before I had it reset I saved all of my pictures to my iPhoto and deleted the pictures off of my iPhone. When I got my computer back all of the pictures that were on my computer were gone. How do I get them back?

  • Download of  Java Server part 1 fails( size to small )

    Hi, I'm trying to download the SAP NetWeaver 7.0 Java Trial Version. When I start downloading part 1 of the server, the filesize is said to be about 1.677.721.600 bytes. But my download file's size is just 127 MB. I checked the ftp(hftp://ftp.sap.com

  • Sidebar region with scrollbars

    I am using the 'Sidebar with no tabs' template on my pages. My sidebar region has moe items verticallly than the other regions. Why am I not seeing a scrollbar in my sidebar region, so it can scroll indepenently of the other regions? Currenly ,the sc

  • ODBC 10gR2 64bit Windows 2008 EE (64bits) to to sql server 2005 (32bits)

    Hi all, I am having trouble with creating an ODBC connection from 10gR2 64bits Windows 2008 to sql server 2005 Win 2003 32 bits 1. I create a listener.ora like the following the port 1521 is for oracle DB and the 1522 is for sql server SID_LIST_LISTE