Calculate x working days before date

Dear experts,
I am trying to find a date that is x working days before another.
Is that a function module about this?
Thank you in advance,
Roxani

Hi Roxani,
You can use FM END_TIME_DETERMINE.
There:
- Insert in duration the number of days that you want to subtract with the minus sign (ex: -1 for previous working day)
- Also, insert your factory calendar that you want to be the source of your working days.
- And, of course, the desired starting date.
Hope that helps!
Kind regards,
Garcia

Similar Messages

  • Sales order schedule date is a (working) day before Scheduled ship date

    In MRP/MPS planning, the forecast consumption is occuring for all sales orders at a date (sales order schedule date) which is always a working day before the Scheduled Ship Date (SSD). What is the logic?
    Time fences are not used.
    E.g. Sales order is scheduled to ship (SSD) on 30th Nov, in forecast set > Forecast items > Consumptiion > Detail, the sales order schedule date is a day before SSD.

    Hi,
    This is a complex issue; best solution is by using APO/GATP.
    If not, then in ERP only, the second best is:
    1) Work with assembly processing in SO, meaning that a production/planned order is automatically created in the customer order during order creation.
    2) Then, after the order is created it is scheduled, and the delivery date proposal is based on that.
    3) Now you can check in the order that there are no capacity overloads, and all capacity required to produce on the proposed date is available. If yes, you're done. If not, it gets a bit complex, since you actualy need to switch to capacity planning, do capacity leveling and dispatch (PP), and the you get a new feasible schedule proposal based on that.
    APO/GATP could do all that automatically!
    Regards,
    Mario

  • Calculate the working days having the start and end dates only

    Hi,
    Can BIP be able to calculate the working days having the start and end dates only? It is like the NETWORKDAYS function in Excel. (i.e. excluding weekends and holidays).
    Thanks.

    Not out of the box.
    But You could extend your BIP functions
    Look at here:
    http://blogs.oracle.com/xmlpublisher/2009/05/bip_by_extension.html
    Based on that what you need is similar to the following Java code:
    http://objectlabkit.sourceforge.net/
    regards
    Jorge A.

  • Date1+5 working day = new date.

    Hi all ,
    I have once date field .and want to add 5 working day in that and calculate new date
    i.e date1+5 working day = new date.
    How i can do the same
    thanx

    First of all pass the dates
    like pass date to this Fm and check whether it is a working day or not .
    <b>
    DATE_CHECK_WORKINGDAY</b>
    if sy-subrc eq 0 ""---> working day
    then add that date to date1 -->
    else
    increment the date and again call the fm in the perform routine ..
    endif .
    u need to set a counter for 5 working days to make this count and skip the perform .
    2. Use this Fm and some code logic will solve ur query .
    3. Remember before using this Fm try to know the calender id for that specific country .
    Regards,
    Vijay.

  • Cancelled one item 5 working days before, when receive the refund

    I cancelled one item 5 working days before, when will I receive the refund

    Not Enough Memory typically refers to RAM.  How much RAM do you have on your 64-bit OS computer?  Do you have other programs running that may be using most of the memory?

  • Calculate next working day in future

    Hi,
    I hope somebody of you could help me here. I have the requirement to find the next working day 2 days after the visit. I need to join two tables which have an N to N relation.
    This is the first source table tbl_cust with customer and visiting day:
    customer_id    Name     visit_day       company_id
    1                   Tobias    27.08.2011  100
    2                   Hans      30.08.2011  100
    3                   Lars       27.08.2011   200
    4                   Dave      29.08.2011   200The second table tbl_comp_days includes the days where the different companies work:
    company_id  company_day    working_day (yes/no)
    100             27.08.2011       no
    100             28.08.2011       no
    100             29.08.2011       yes
    100             30.08.2011       yes
    100             31.08.2011       yes
    100             01.09.2011       yes
    200             27.08.2011       yes
    200             28.08.2011       yes
    200             29.08.2011       no
    200             30.08.2011       yes
    200             31.08.2011       yes
    200             01.09.2011       yesNow I want to calculate the second next work of the company joined with the customer visit_day
    Means: tbl_cust.visit_day + 2
    when tbl_comp_days.working_day is yes
    if tbl_cust.visit_day is not a working day find the next possible working day + 2 working days
    Output example:
    customer_id    Name     visit_day       visit_day_plus_2
    1                   Tobias    27.08.2011  31.08.2011
    2                   Hans      30.08.2011  01.09.2011
    3                   Lars       27.08.2011   30.08.2011
    4                   Dave       29.08.2011   01.09.2011Thanks for your help
    Tobias

    Hi, Tobias,
    Here's one way:
    WITH     got_r_num    AS
         SELECT     c.customer_id, c.name, c.visit_day, d.company_day  AS visit_day_plus_2
         ,     ROW_NUMBER () OVER ( PARTITION BY  c.customer_id
                                   ORDER BY          d.company_day
                           )         AS r_num
         FROM    tbl_cust       c
         JOIN     tbl_comp_days  d  ON   c.company_id  = d.company_id
                                 AND  c.visit_day   < d.company_day
                          AND  c.visit_day   >= d.company_day + 10     -- See note
         WHERE   d.working_day       = 'yes'
    SELECT     customer_id, name, visit_day, visit_day_plus_2
    FROM     got_r_num
    WHERE     r_num     = 2
    ;If you'd post CREATE TABLE and INSERT statements for the sample data, then I could test it.
    The last join condition ( c.visit_day >= d.company_day + 10) isn't strictly necessary. Depending on the size of the company_day table, it may make execution faster, by limiting the join to days soon after visit_day, rather than any time after visit_day. As I wrote it, it assumes that there will always be at least 2 working days in any period of 10 consecutive days. (In my company, there are always at least 2 working days in a period of 5 consecutive days.) You cam change the "magic number" 10 to anything else, or you can omit that condition altogether.
    Edited by: Frank Kulash on Aug 23, 2011 10:49 AM
    Added note.

  • Confused - How to Calculate Number of Days Between Dates but Exclude Weekend Dates If There Hasn't Been a Weekend Update

    Hello -
    I've been tearing my hair out over this problem i'm trying to solve, probably just been staring at it too long which is making it worse -
    I have a series of open support tickets which are supposed to be updated on a daily basis, the problem is that they aren't always being updated daily.  So, the business wants to know the number of days from when a ticket was last updated and today's
    date.  I have this basic calculation and it's working fine, however now the business wants to exclude weekends from the calculation.  The other problem is that some reps DO go in on weekends and update their tickets, so sometimes there will be updates
    made on weekend dates.
    To give an example -
    Today's date is 2014-02-10 (Monday).  A ticket was last updated last Thursday, 2014-01-30.  The difference between the two dates is 11, so it's been 11 days since the ticket was last updated.  Now, if I exclude Saturdays and Sundays, then
    it's actually been 7 days since the ticket was last updated.  I'm not sure how to do this in T-SQL.
    Now, to further complicate the problem, sometimes a ticket IS updated on a Saturday or Sunday.  So, if a ticket was updated on 2014-02-02 (Sunday), then it should be counted.  Again i'm not sure how to do this. 
    What gets me is that this is probably fairly simple and i've just been staring at it too long.  In the meantime, can someone offer some guidance?
    Thanks!!

    I've adapted this from a function on my blog. you will need to add set the YourTicketTable to where ever your tickets are stored.
    CREATE
    FUNCTION [dbo].[CalcWorkDaysBetween](@StartDate
    As DateTime,@EndDate
    AS DateTime)
    RETURNS
    INT AS
    BEGIN
    SET @EndDate
    =DATEADD(DAY,1,@EndDate)
    DECLARE @Count
    AS Int= 0
    DECLARE @Date
    As Date=@StartDate
    WHILE @Date
    < @EndDate
    BEGIN
    IF (DATEPART(WEEKDAY,@Date)IN(1,7)
    OR (SELECT
    Count(*)
    FROM YourTicketTable WHERE TicketDate=@Date)=1)
    BEGIN
    SELECT @Count = @Count
    + 1
    END
    SELECT @Date=DATEADD(Day,
    1,@Date)
    END
    RETURN
    DATEDIFF(DAY,@StartDate,@EndDate)- @Count
    END
    Regards,

  • Half working day before a holiday

    Hi All,
    I have a scenario wherein client wants employees to work half day before every public holiday ( holiday class 1 ).
    I am trying to create a variant of Normal ( 5days X 8hrs ) WS by following rule.
    Rule   No    Holiday Class        Holiday Class ( Next Day )    Day            Variant
    AA     01     XXXXXXXXXX      _X__________                      XXXXX__    C
    Above rule is good to replace WS with variant (reduced hour) if holiday is falling between Tuesday to Thursday.
    What i am unable to implement is when Holiday falls on Monday and I want WS to reflect half day on Friday.
    Appreciate if anyone can share his/her expertise in implementing this scenario.
    Thanks
    Abhay

    Hi Abhayadeep,
    We will have to use a workaround to achieve this.
    If your public holiday is falling on Monday, then create a dummy public holiday for Saturday with public holiday class 9. Ensure that you keep the day type blank for public holiday class 9 in your day type selection rule.
    Then in your variant condition, write the below condition:
    Rule   No    Holiday Class        Holiday Class ( Next Day )    Day            Variant
    AA     01     XXXXXXXXXX      _X__________                      XXXXX__    C
    AA     02     XXXXXXXXXX      ___________X                      _____X__   C
    Please do generate your WSR after making the above changes. I hope this will resolve your issue.
    Regards,
    Vivek                                                  

  • Due date column to calculate 7 working days

    Can you help me with formula to calculate the Due date default to 7 business days from created date. and due date should not be in weekend.

    Refer to the following post, hope it helps
    http://sharepoint.stackexchange.com/questions/88149/formula-to-show-differens-between-dates-without-weekends-and-holidays
    Cheers,

  • Working day formula that excludes weekends and holidays in WEBI

    Hi Guys,
    Can we calculate a working day formula that excludes weekends and holidays in WEBI OR in Universe?
    The universe I am working on is using stored procedures, so there are no joins or modelling done. Although there is a workday stored proc  that I can bring in the universe.
    I am just thinking if there is no modelling or joins done in the universe how will this help me in webi?
    Your suggestions will be very helpful.
    Thanks,
    Jitan

    One more suggestion I need from you  -
    I have a Work_Calendar_VW that has the following columns -
    Calendar_Date - 5/1/2014
    Calendar_Year - 2014
    Calendar_Month - 5
    Calendar_Day - 1
    Work_Day - 1
    Day_Type - WD (Work Day)  For Weekends this will be displayed as WE
    The columns have all dates for current year in SQL Server.
    I am going to pull this into the universe and create 2 derived tables to calculate MTD Day counts.
    Derived Table 1  - Calculate Yest Work Day... this will remove all the weekends and holidays and give me the last working day. This includes couple of case statments to check each day if it's a working day or weekend.
    For Work Day the above code will be 1 and for weekend 0
    Derived Table 2  - This will give me the count of working days in current month using the above view and Derived table 1 Below is the code  -
    SELECT COUNT(*)
    FROM Work_Calendar_VW
    WHERE [Work_Day] = 1 AND
       (Calendar_Date BETWEEN CAST(CONVERT(VARCHAR(25),MONTH(LastWoringkday()),101) + '/01/'
       + CONVERT(VARCHAR(25),YEAR(LastWoringkday()),101) AS DATE)
      AND LastWoringkday()).
    I cannot do joins because this universe has been built using stored proc and would like to implement this in BO universe.
    let me know if this is the right approach.
    Thanks,
    Jitan

  • Query to retrieve previous working day?

    I need to write a query that will retrieve the previous working day. Therefore, it must exclude weekends and holidays.
    For example, the previous working day for Saturday, February 19 or Sunday, February 20 would be Friday, February 18. And since Monday, February 21 was a holiday for us then the previous working day would also be Friday, February 18.
    I've found some queries that allow me to find the previous working day excluding weekends, but I'm having difficulty with the holidays aspect. We have a table called CORPHOLIDAY that contains a field HOLIDAY that stores the holiday dates.
    Can I do this with a simple query? I'm not proficient with Oracle, so any and all help is appreciated. Thanks!

    Welcome to the forum!
    As Dan said, whenever you have a question, it really helps if you post CREATE TABLE and INSERT statements to create whatever tables you need, so people can re-create the problem and test their ideas. Also post the results you want from that data, and your version of Oracle.
    The sample data might be as simple as this:
    CREATE TABLE     corpholiday
    (     holiday     DATE
    INSERT INTO corpholiday (holiday) VALUES (DATE '2011-02-21');Here's one way to get the results you want. You enter a starting date (such as February 22, 2011) and the query produces the last working day before that date (in this case, February 18).
    WITH     consecutive_days     AS
         SELECT     TO_DATE ( '22-Feb-2011'     -- Input parameter
                   , 'DD-Mon-YYYY'
                   ) - LEVEL     AS a_date
         FROM     dual
         CONNECT BY     LEVEL     <= 4     -- 1 + Max. possible non-work days
    SELECT     MAX (a_date)     AS prev_work_day
    FROM           consecutive_days     c
    LEFT OUTER JOIN      corpholiday          h  ON     c.a_date     = h.holiday
    WHERE     TO_CHAR ( a_date
              , 'Dy'
              , 'NLS_DATE_LANGUAGE=ENGLISH'     -- If necessary
              )     NOT IN ('Sat', 'Sun')
    AND     h.holiday     IS NULL
    ;What you might really like for this job is a WHILE loop, something that would start at the given date, subtract one, test if that day was a work day, and, if necessary, repeat until it did find a work day. That's how you might do it in a procedural language, like PL/SQL, and that's exactly what a lot of people would do: write a PL/SQL function, that could us a WHILE loop. SQL is a non-procedural language, so it doesn't have anything like a loop. Using a CONNECT BY query, as shown above, we can simulate the behavior of a FOR loop, where we do a fixed number of iterations. The query above works by using CONNECT BY to generate the last 4 dates before the given starting date. What is that magic number 4? It's the worst case of how many consecutive days there can be (at least where I work) that is sure to have at least one work day. Where I work, holidays are always at least a week apart, so the longest you can go without a work day is like the example you gave: a Monday (or Friday) holiday, adjacent to the 2 weekend days. You may need to change the number 4 to something higher if, say, December 25 and 26 were both holidays, or if Good Friday and Easter Monday were both holidays.
    As posted, the query above works in Oracle 9 (and up), but it can be modified for earlier versions.
    Edited by: Frank Kulash on Feb 23, 2011 8:57 PM
    Added explanation

  • FM for Holiday & Next Working day

    HI All,
    Please suggest any  single FM, which can give the current day is Holiday or not. If, Yes, the what is the next working day for a Facorty calender ID.
    Both validation should be happend in a single FM.
    Thanks & Regards,
    Prabhakar.
    Moderator message: FAQ, please search for previous discussions of this topic.
    Edited by: Thomas Zloch on Apr 18, 2011 6:13 PM

    hi ,
    Pls check this FM
    CALL FUNCTION 'BKK_CHECK_HOLIDAY'
            EXPORTING
              i_date            = wf_cntdt
              i_calendar1       = 'B1'
            IMPORTING
              e_x_no_workingday = wf_holi.
    *get actual working days upto report date.
      it_act_work_days-dat_from  = w_date-low.
      it_act_work_days-dat_to    = w_date-high.
      APPEND it_act_work_days.
    *calculate actual working days.
      CALL FUNCTION 'WFCS_FCAL_WDAYS_GET_S'
        EXPORTING
          pi_time_interval = it_act_work_days
          pi_fcalid        = 'B1'
        IMPORTING
          pe_wdays         = wf_actdays.
    regards
    Deepak.
    Edited by: Deepak Dhamat on Apr 18, 2011 12:31 PM

  • Working Days 0NUMWDAY

    Hi,
    Just realize there is an attribute called 0NUMWDAY under 0FISCPER, does any one know how system calculate this working days. I tested it, some holiday is excluded (such as Jan 01), however some holiday is not.
    Victor

    try this
    with t as (
    select to_date('01/01/2009','dd/mm/yyyy') + level - 1,to_char(to_date('01/01/2009','dd/mm/yyyy') + level - 1,'Day') from dual
    where trim(to_char(to_date('01/01/2009','dd/mm/yyyy') + level - 1  ,'Day'))  not in ('Saturday', 'Sunday')
    connect by to_date('01/01/2009','dd/mm/yyyy') + level < add_months(to_date('01/01/2009','dd/mm/yyyy'),1) + 1
    select * from tEdited by: alvinder on Mar 25, 2009 4:07 PM

  • Payment terms should calculate Payment due date based on working days

    Hi Experts,
    As we know that standard SAP calculates Payment due date= base line date + number of days maintained in payment terms. In this payment days are considered as calendar days and not the working days.
    Example: If base line date is Thursday, payment terms says 3 days then payment due date is calculated as Sunday ( which is not a working day as per the factory calendar I use). The requirement is that payment date should be calculated as following Tuesday considering Satuarday and Sunday are not working days as per the calendar.
    Can you please suggest how can we achieve this?
    Thanks,
    Ravi

    You can not acheive from config pooint of view but you can use BADI and get the solution
    use BAdI MRM_PAYMENT_TERMS to set terms of payment
    You can use this Business Add-In to change the following fields for the 
    terms of payment in the invoice document header:                        
    o  ZFBDT: Base date for due date calculation                            
    o  ZBD1T: Discount days 1                                               
    o  ZBD1P: Discount percentage 1                                         
    o  ZBD2T: Discount days 2                                               
    o  ZBD2P: Discount percentage 2                                         
    o  ZBD3T: Deadline for net condition                                    
    o  ZLSPR: Key for payment block

  • Calculate Working Days between Two Dates

    Hi All,
    I'm creating a crystal report where I have to calculate the Number of Working Days between a date range, this should exclude the Weekends(done) but also exclude the public holidays which have defined in Holidays Calender.
    I'm not using procedure or command, Operating directly with tables.
    Any help would be appreciated.
    Regards
    Edited by: Pari Minhas on Nov 24, 2011 12:00 AM

    Hi All,
    I'm creating a crystal report where I have to calculate the Number of Working Days between a date range, this should exclude the Weekends(done) but also exclude the public holidays which have defined in Holidays Calender.
    I'm not using procedure or command, Operating directly with tables.
    Any help would be appreciated.
    Regards
    Edited by: Pari Minhas on Nov 24, 2011 12:00 AM

Maybe you are looking for

  • How do I access my online Palm account?

    I need to change the credit card number in my Palm account because my other one expired. I do not see a link anywhere on Palm's web site to access my online account to do this. I know I set it up and even have my password, just don't know the url for

  • Problem in delivery creation against stock transfer PO

    Hi, Scenario: - We have 5 material and make the PO for stock transfer yesterday. After that we made the delivery against that PO. Problem it this....today we need to make the another PO related to last one (all same material number's) but diff. qty.

  • Updated to 10.5.1, now apple menu commands don't work

    Hi, updated to 10.5.1, and now when I choose "About This Mac", "Restart", "Shutdown", or "Logout", I just get the spinning beach ball for a few seconds, and then nothing else happens. No dialogs, no restart... the only way I can restart is to either

  • Where can I get a Displayport to HDMI adaptor? (NOT a Mini one!)

    I want to connect a Macbook (13 inch mid-2009 2.13 Ghz Intel Core 2 Duo) to my TV. I have an HDMI cable but I can't seem to find an adaptor that fits the Macbook. The 'Mini Displayport' one doesn't fit, and I am told that I need a 'Displayport to HDM

  • BADI calls to Syncronous scenario in XI/PI

    Can anyone explain how to use the BADI to make a call to get the info in Syncronous communication Thanks RP