Pass working day to get factory calendar date

Hello Experts,
I wish to get the factory calendar date, specific to a factory calendar, based on a working day.
Basically, if i pass say 4, then i want to get the date for the 4th working day based on a specific factory calendar.
Can someone throw some light on possible function module that i can use?
Thanks

I want to pass sy-datum to get factory date and then check if this factory date is the 4th busiess day for that month based on a specific calendar.
Or if i can pass in 4th bus day for a month (just pass 4) based on a specific factory calendar (just pass calendar id), then i would want the factory date, which i want to compare against sy-datum in my subsequent logic.
I am trying to trigger a data load stating if factory date for this month = 4th business day, then run load, else dont. And this in BW.
I dont have the FM that you mentioned above, in BW and is available only in R/3

Similar Messages

  • Working day to factory calendar date

    Hello Experts,
    I wish to get the factory calendar date, specific to a factory calendar, based on a working day.
    Basically, if i pass say 4, then i want to get the date for the 4th working day based on a specific factory calendar.
    Can someone throw some light on possible function module that i can use in BW ?
    Thanks

    That's what I was giving you, you give the working day and the factory calendar and you get the date, or you can use this function and you can do it the other way:
    (Unless I'm completely missing your point here...)
        CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
      EXPORTING
        CORRECT_OPTION                     = '+'
        DATE                               = G_WORKAREA3-CREATEDON
        FACTORY_CALENDAR_ID                = L_S_PLANT-FACTCAL_ID
      IMPORTING
    *   DATE                               =
       FACTORYDATE                        = L_FCDATE
      EXCEPTIONS
        CALENDAR_BUFFER_NOT_LOADABLE       = 1
        CORRECT_OPTION_INVALID             = 2
        DATE_AFTER_RANGE                   = 3
        DATE_BEFORE_RANGE                  = 4
        DATE_INVALID                       = 5
        FACTORY_CALENDAR_NOT_FOUND         = 6
        OTHERS                             = 7.
      ENDIF.

  • Working day for a Holiday Calendar

    Hi, experts.
    I'm looking for a FM that returns me the next working day based on a Holiday Calendar (SCAL).
    It should have the same functionality as Factory Calendar FM FIMA_DAY_CONVERT_TO_WORKINGDAY.
    Can you help me out?
    Thanks in advance,
    Flavia

    Use this function module & make sure you pass the plant details, as factory calendar mostly depeneds on the Plant.
    Below is just an example to get the plant depending on Requisition & pass it to the function module.
    Createdate --> will be the current date.
    SELECT SINGLE t~fabkl
           INTO lv_fabkl
           FROM ( t001w AS t
             INNER JOIN eban AS e ON ewerks = twerks )
           WHERE banfn = reqnumber.
    CALL FUNCTION 'FKK_ADD_WORKINGDAY'
      EXPORTING
        i_date            = createdate
        i_days            = days
        I_CALENDAR1       = lv_fabkl
      I_CALENDAR2       =
    IMPORTING
       E_DATE            = workingday.
      E_RETURN          =

  • Get the number of working days based on factory calendr for a range of mont

    Dear all,
    We are using BI7.00 . In one of our reports we have the following requirement.
    The range of months will be given in the selection screen for example 01.2008 to 11.2008, when the query is executed, i want system to calculate the number of working days for each month of the year (for what values provided in the selection field ) and display the same. i.e., as mentioned below.
    Month                         days.
    01.2008                        22
    02.2008                        18
    03.2008                        25  etc., Kinldy provide steps for adopting the same. If it can be adopted only through customer exit also provide the code and parameters that has to be used.
    Regards,
    M.M

    hi,
    Try the following logic to find out the no.of working days in a month based on your calendar.
    parameters : mny(6).    " input format should be  yyyymm
    data : d1 like sy-datum,
           d2 like sy-datum,
           d3 like sy-datum,
           v_nds type i.
    concatenate  mny '01' into d1.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
      EXPORTING
        DAY_IN            = d1
      IMPORTING
        LAST_DAY_OF_MONTH = d2
      EXCEPTIONS
        DAY_IN_NOT_VALID  = 1
        OTHERS            = 2.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    do 30 times.
      CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
        EXPORTING
          CORRECT_OPTION      = '+'
          DATE                = d1
          FACTORY_CALENDAR_ID = ' A'    " your factory calendar ID
        IMPORTING
          DATE                = d3.
      if d1 = d3.
        d1 = d1 + 1.
        v_nds = v_nds + 1.
      else.
        d1 = d3.
      endif.
      if d3 ge d2.
        exit.
      endif.
    enddo.
    write : 'No of working days ', v_nds.
    hope it helps...
    regards,
    raju

  • Get working day of month for specific date

    Hi,
    I need to get the working day of a month for a specific date. For example: Which working day is the 15th of september 2005...
    Is there any function module, I could use?
    Cheers Arne

    HI arne,
    1.  DATE_CHECK_WORKINGDAY
        This is the FM.
    2. Along with that u will have to use some logic.
    3. Just copy paste in new program
       (it will help in the logic)
    <b>It will list out
    all the working days
    between two given dates</b>
    REPORT abc.
    data : num type i.
    parameters : frdate type sy-datum default '20051216'.
    parameters : todate type sy-datum default '20051221'.
    perform getinfo using frdate todate changing num.
    break-point.
    *&      Form  getinfo
          text
    FORM getinfo USING fromdate todate CHANGING numofdays type i.
      DATA :  d TYPE sy-datum.
      d = fromdate - 1.
      DO.
        d = d + 1.
        IF d > todate.
          EXIT.
          endif.
          CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
            EXPORTING
              date                       = d
              factory_calendar_id        = '01'
              message_type               = 'I'
            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 = 0.
          numofdays = numofdays + 1.
          write :/ d.
        ENDIF.
        ENDDO.
      ENDFORM.                    "getinfo
    regards,
    amit m.

  • Get Nexr working day for the given calendar id

    Hello,
    My requirenment is I have a  date.If that date falls on friday then I have to get the next working day date i.e.Monday for the given Calender iD

    DATA:wk_dat TYPE scal-indicator.
    PARAMETERS:pa_dat TYPE sy-datum.
    CALL FUNCTION 'DATE_COMPUTE_DAY'
      EXPORTING
        date = pa_dat
      IMPORTING
        day  = wk_dat.
    CHECK wk_dat = 5.
    pa_dat = pa_dat + 3.
    WRITE pa_dat.
    here if u want to get the next working day
    Use FM DATE_CHECK_WORKINGDAY after the check statement.
    add the date until u find a working day.

  • My battery wasn't holding a charge so I backed up to mac and restored.  it worked but how do i get my calendar dates back?

    my battery wasn't holding a charge so i backed it up on my mac and restored.  How do i get my calendar entries, etc back?

    Which Creative suite version you want to install and do you have the Serial Number for that and what is the Operating System ?

  • How to deduct working days according to factory calender

    Hi All,
          I have one date and and I want to calculate the exact date before 'N' working days according to the factory calender.
    e.g. Suppose the date is 13.07.2010 and N = 10 then generally we would get date as 03.07.2010.
            But my requirement is that, it should give me the exact date 10 working days back according to the   
            factory calender. i.e. 28.06.2010 .
            Could anybody suggest me a FM or an alternate soln for the same.
    Thanks in anticipation.
    Ubhaka

    Hi Ubhaka,
    have a look at FM
    BUSINESS_DATE_CREATE
    you enter the following:
    - a date (DATUM_EIN), from which you start
    - the number of business days (GESCHAEFTSTAGE)
    - the calendar ID (KALENDER)
    - the direction (RICHTUNG): "-" for subtracting ode "+" for adding the business day based on the calendar
    I suggest you make a copy of the FM and adapt it for your needs.
    Regards,
    Peter

  • Getting Factory calendar id

    Hi all,
    How to get a factory calendar id for a particular system.
    for ex: 
    calendar id for france is 'F1'
    calendar id for UK is 'S1'
    so my requirement is like based on the country i need to determine the calendar id.
    is there any function module for this?

    TFACT                          Factory calendar texts
    has it .....
    These tables can also help
    TFACD                          Factory calendar definition
    TFACS                          Factory calendar (display)

  • Factory Calendar to prevent delivery on a non-working day

    Hi Guys,
    You may have already come across this problem and hence requesting your inputs on the same.
    I'm able to create a delivery for a sales order on a week-end even though they happen to be 'non-working days' in my Factory Calendar. I have gone through the search forum and the 2 things that most of them said was to attach the Factory Calendar (having Sat and Sun as non-working days) to the Plant and Shipping Point, which I have already done, inspite of which I'm able to create a delivery for a schedule line date which falls on a non-working day.
    My business scenario requires that even though a Sales Order may be created on a non-working day, the delivery should only be possible on the next working day, even if stock is available on those non-working days.
    Your thoughts/suggestions/ideas would be useful.
    Regards,
    Shripad

    Hi Shripad,
    In Customer Master, General Data , We have  Unloading Points  Option. There we can opt for the delivery to the cutomer.
    Then we can stop delivery for that day.
    Award points if it adds information.
    Thanks
    Mohan

  • Get Previous Working Day

    Do you know any function module which will give me the previous working day only by ignoring saturdays and sundays and it should NOT consider holidays.
    Example:
    Monday's Date should give me previous friday's date.
    Friday's Date should give me previous thrusday's date

    Hello Ramesh,
    I assume you have your factory calendar ID with you:
    DATA:
        L_V_PREDT        TYPE DATUM, "Next Day.
      L_V_PREDT = SY-DATUM - 1.
    * Get the next Working Day as per Factory Calendar
      CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
        EXPORTING
          CORRECT_OPTION               = '-' " -VE  to get the previous date
          DATE                         = L_V_PREDT
          FACTORY_CALENDAR_ID          = 'HY' "--> Give your factory cal. ID here
        IMPORTING
          DATE                         = V_PREWD
        EXCEPTIONS
          CALENDAR_BUFFER_NOT_LOADABLE = 1
          CORRECT_OPTION_INVALID       = 2
          DATE_AFTER_RANGE             = 3
          DATE_BEFORE_RANGE            = 4
          DATE_INVALID                 = 5
          FACTORY_CALENDAR_NOT_FOUND   = 6
          OTHERS                       = 7.
      IF SY-SUBRC <> 0.
    *  Do Nothing
      ENDIF.
    If you want to use the FM: BKK_GET_PRIOR_WORKDAY, still then you have to use the operation:
    L_V_PREDT = SY-DATUM - 1.
    And pass L_V_PREDT to the FM. You can test with 23.03.2009 date & check )
    Hope this helps.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 19, 2009 4:56 PM

  • Work day of a calendar

    Hi all,
    I am searching for a FM which will say 3rd work day of a factory calendar or 4th work day of a factory calendar etc. I could see there are few FMs to say first work day - last work day but not the Nth work day. If we input some date and factory calendar, we should get which work day it is. For example if we give 09/02/2010 and factory calendar name it should return as 2nd workday etc. Any help will be appreciated..
    Thanks in advance.
    Moderator message: date calculation questions = FAQ, please search before posting.
    locked by: Thomas Zloch on Sep 15, 2010 4:39 PM

    hi,
    Please check with this fm DATE_CONVERT_TO_FACTORYDATE.
    Keerthi

  • Function Module to Calculate Factory Calendar

    Hi,
        We are Working generating a report for discrete Manufacturing. We need a actual days worked from the factory calendar for our MIS Reports based tat.
        Help us in find a Function Module for it.
    Regards
    Naga

    *&      Form  BILLING_DAY_IS_WORKING_DAY
          Using the date passed in next_date, verify that the date is
    a working day in the factory calendar the user specifies.  This form
    calls the standard ABAP function for determining if a date is a
    "working day".  The function first determines if the day of the week
    corresponding to the calendar date entered is a billing day.  Then
    it checks to see if the calendar date is a holiday.  If either are
    true the date_no_workingday flag is passed back as "X" and this
    routine passes back "X" to the calling routine in the parameter
    p_billing_flag.
    FORM CURRENT_DAY_IS_WORKING_DAY USING    P_NEXT_DATE TYPE D
                                    CHANGING P_NOT_BILLING_DAY TYPE C.
      CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
           EXPORTING
                DATE                       = P_NEXT_DATE
                FACTORY_CALENDAR_ID        = FACTCALD
                MESSAGE_TYPE               = 'I'
           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.
      CASE SY-SUBRC.
        WHEN '0'.
          CLEAR P_NOT_BILLING_DAY.
        WHEN '4'.
          IF SY-DATUM > CURRENT_BDATE.
            P_NOT_BILLING_DAY = SPACE.
          ELSE.
            P_NOT_BILLING_DAY = 'X'.
          ENDIF.
        WHEN OTHERS.
          CONCATENATE: 'Error Accessing Calendar with ID: ' FACTCALD
          INTO ZZMSG_TAB2.
          APPEND ZZMSG_TAB2.
          CLEAR  ZZMSG_TAB2.
          V_LEVEL = 'E'.
          PERFORM F_ERROR_MESSAGE.
          MESSAGE E305 WITH FACTCALD.
      ENDCASE.
    ENDFORM.                               " BILLING_DAY_IS_WORKING_DAY
    *&      Form  BILLING_DAY_IS_WORKING_DAY
          Using the date passed in next_date, verify that the date is
    a working day in the factory calendar the user specifies.  This form
    calls the standard ABAP function for determining if a date is a
    "working day".  The function first determines if the day of the week
    corresponding to the calendar date entered is a billing day.  Then
    it checks to see if the calendar date is a holiday.  If either are
    true the date_no_workingday flag is passed back as "X" and this
    routine passes back "X" to the calling routine in the parameter
    p_billing_flag.
    FORM BILLING_DAY_IS_WORKING_DAY USING    P_NEXT_DATE TYPE D
                                    CHANGING P_NOT_BILLING_DAY TYPE C.
      CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
           EXPORTING
                DATE                       = P_NEXT_DATE
                FACTORY_CALENDAR_ID        = FACTCALD
                MESSAGE_TYPE               = 'I'
           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.
      CASE SY-SUBRC.
        WHEN '0'.
          CLEAR P_NOT_BILLING_DAY.
        WHEN '4'.
          P_NOT_BILLING_DAY = 'X'.
        WHEN OTHERS.
          CONCATENATE: 'Error Accessing Calendar with ID: ' FACTCALD
          INTO ZZMSG_TAB2.
          APPEND ZZMSG_TAB2.
          CLEAR  ZZMSG_TAB2.
          V_LEVEL = 'E'.
          PERFORM F_ERROR_MESSAGE.
          MESSAGE E305 WITH FACTCALD.
      ENDCASE.
    ENDFORM.                               " BILLING_DAY_IS_WORKING_DAY
    Reward if useful

  • Factory Calendar vs. Intervals and Shifts

    Experts,
    I have a question in regard to Factory Calendars & Intervals,
    Factory Calender W7 determine seven work days per week from Mo.-So.,
    Factory Calender W5 determine five work days per week from Mo.-Fr.
    1) Setting in CR12, Factory Calendar W7, Interval incl. shifts from Mo.-Fr.
    With this setting the system counts five days for the In-Houese Production Time via scheduling if Queue Time are scheduled over Sa.,So.
    2) Setting in CR12,Factory Calendar W5, Inerval incl. shifts from Mo.-Fr.
    With this settings the system counts two days for the In-Houese Production Time via scheduling if Queue Time are scheduled over Sa.,So.
    my assumbtion is that the calculation of work days for In-House Production time foots on the amount of work days in the Factory Calendar and the Factory Calendar must be alligned to the days determind in the Interval to get a correct result.
    In our system we run Intervals on a weekly base and we change shift incl. or excl. Sa. and So. on a weekly base too. Unfortunatly I can set only one Factory Calendar per Work Center in CR12, that effects the amount of work days per week.
    So is there a way to determine the amount of work days based on the days determinede in the Interval, or align the Factory Calender to a Interval ?
    What are the comon setting for such cases?
    Thanks in advance
    Jörg

    Dear,
    Please refer my reply from this link which has adress the same issue.
    [Factory Calendar and working days|Re: Capacity schedulling using calendar with man-hours per day/per work center]
    Hope it will help you.
    Regards,
    R.Brahmankar

  • Adding working day as a holiday in calendar without affecting stock orders

    It was very recently decided by the SA government that this coming Wednesday, 18th May, will be a Public Holiday (PH) due to national elections.
    Itu2019s just been highlighted by the business now that this day is currently still set as a Production day in the calendar.
    As such, could you please advise what needs to be done to urgently set this day to be a non-working day?
    Also, whatu2019s of greater concern is that there are already Stock Orders sitting in system timed for picking & delivery on the 18th, and the Service Levels will be calculated on a working day for the 18th.
    How can these orders be u201Crecalculatedu201D for the 19th so as not to impact negatively on the warehouseu2019s Service Levels, given that the warehouse will not actually be working on the 18th?

    Use this function module & make sure you pass the plant details, as factory calendar mostly depeneds on the Plant.
    Below is just an example to get the plant depending on Requisition & pass it to the function module.
    Createdate --> will be the current date.
    SELECT SINGLE t~fabkl
           INTO lv_fabkl
           FROM ( t001w AS t
             INNER JOIN eban AS e ON ewerks = twerks )
           WHERE banfn = reqnumber.
    CALL FUNCTION 'FKK_ADD_WORKINGDAY'
      EXPORTING
        i_date            = createdate
        i_days            = days
        I_CALENDAR1       = lv_fabkl
      I_CALENDAR2       =
    IMPORTING
       E_DATE            = workingday.
      E_RETURN          =

Maybe you are looking for