Calculating Factory Date.

Hi All,
I need to calculate 5th factory date from today i.e  excluding weekends and factory holidays based on factory ID
Ex: Today date is 01.04.2005, I need to get the 5th work day from today i.e 8.04.2005. And if suppose there is an holiday on 8.04.2005 based on facotry calendar id then it should return 11.04.2005.
Is this possible with any FM? Your feedback/help would be reawarded,
Cheers,
Nameeth

THe code for you.
data: lv_date type sy-datum value '20050401'.
do 5 times.
lv_date = lv_date + 1.
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
  EXPORTING
*   CORRECT_OPTION                     = '+'
    date                               = lv_date
    factory_calendar_id                = 'GB'
IMPORTING
   DATE                               = lv_date
*   FACTORYDATE                        =
*   WORKINGDAY_INDICATOR               =
* 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.
ENDIF.
enddo.
write: lv_date.
Regards,
Subramanian V.

Similar Messages

  • Function module SD_SCHEDULING: delivery date calculation factory calendar

    Hi,
    When I create or change a sales order, system calculates the delivery time and date (ETDAT) using transit duration and factory calendar. Currently factory calendar says that transportation leaves every Monday, Wednesday and Friday. Unfortunately, function module SD_SCHEDULING calculates the delivery date using factory calendar dates, i.e. <b>NOT</b> using working dates.
    Function module reads the factory calendar from table TVRO (Routes) and field SPFBK (Factory calendar key) in subroutine GET_CUSTOMIZING, and saves factory calendar id in CS_SCHEDDU-TRANSIT_FC. The calculation itself is done later in function module DATE_CONVERT_TO_FACTORYDATE.
    For example, if transit duration is 3 working days, function module calculates the delivery date using Monday (first day), Wednesday (second day) and Friday (third day). Thus, the result is Friday, which is wrong. Result should be of course Wednesday (Monday first day, Tuesday second day and Wednesday third day).
    I'd like to use working days instead of calendar days. I am planning to recalculate the delivery date in some user exit, but before I start coding, I'd like to hear your opinion: <i>Is it possible to use working days instead of calendar days when calculating delivery date?</i> (I believe it must be, since my case is very normal). If it is, I assume that this can be achieved with IMG, but how and where?
    I am using SAP R/3 Enterprise.
    Regards,
    Jarmo Tuominen

    Hi jarmo,
    1. DATE_CHECK_WORKINGDAY
       Probably this FM may be useful to u.
    2.
    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.
    regards,
    amit m.

  • Factory date calculations

    Hi,
    I want to do some caculations based on the factory calander. Its like :
    date = 04/27/2005.
    I want to substract 4 days from this. But in case the new date is a leave day (Saturday/ sunday) then it should return the last working day along with the weekday like monday.
    So here its saurday, so it should return 04/22/2005 friday, instead of 04/23/2005 saturday.
    Is there a way to do this calculation. Please advise.
    Thanks,

    Hi,
    Try this out
    *&      Form  ADD_WORKING_DAYS
          Add n number of factory days(working days) to date
         <-- P_DAYS     Number of days to add
         <-- P_PAYDATE  Starting date
    FORM add_working_days USING p_days
                          CHANGING p_paydate TYPE sy-datum.
      DATA: gd_factorydat LIKE scal-facdate,
            gd_resdate    LIKE sy-datum.
    Convert date to factory date
      CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
           EXPORTING
                date                = p_paydate  "Starting date
                factory_calendar_id = 'GB'
           IMPORTING
                factorydate         = gd_factorydat. "Factory calender date
    Add n number of days to factory date, ignors non working days
      gd_factorydat =  gd_factorydat + p_days.
    Convert factory date back to actual date
      CALL FUNCTION 'FACTORYDATE_CONVERT_TO_DATE'
           EXPORTING
                factorydate         = gd_factorydat
                factory_calendar_id = 'GB'
           IMPORTING
                date                = gd_resdate. "Actual date
      p_paydate = gd_resdate.
    ENDFORM.                    " ADD_WORKING_DAYS
    <b>OR</b>
    *&      Form  ADD_WORKING_DAYS_RESNONWORK
          Add n number of factory days(working days) to date, but allow
          resultant date to be a non working day
         <-- P_DAYS     Number of days to add
         <-- P_PAYDATE  Starting date
    FORM add_working_days_resnonwork USING p_days
                           CHANGING p_paydate TYPE sy-datum.
      DATA: ld_count  TYPE i.
      ld_count = p_days.
      WHILE ld_count GT 0.
        CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
          EXPORTING
            date                       = p_paydate
            factory_calendar_id        = 'GB'
            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 NE  4.
          p_paydate = p_paydate + 1.
          ld_count = ld_count - 1.
        ELSE.
          p_paydate = p_paydate + 1.
        ENDIF.
      ENDWHILE.
    ENDFORM.                    " ADD_WORKING_DAYS_RESNONWORK
    Thanks & Regards,
    Judith.

  • I have a replacement Note 3.  My Vodafone SIM, which worked fine in the original, fails in the replacement.  When I try to access Settings, the menu briefly flashes, then the phone reverts to the home page.  Will a Factory Data Reset fix this?

    Hi,
    I have a Note 3 and a Vodafone SIM that are not playing well together. 
    The history is:
    I got my Note 3 over 2 years ago.  We visited Italy 2 years ago and I bought a Vodafone sim at a Vodafone outlet.  Everything worked perfectly during that trip and a subsequent trip to France.
    Last October, I had to replace the Note 3 because the camera was failing.  I had insurance, so the insurance company sent me a refurbished Note 3. When I tried to use the SIM last December, the Note 3 had problems. When I put the SIM in and started the Note 3, the phone recognized the sim (but gave me an error that, according to Verizon, is spurious).  I could make phone calls but I could not access the data network.  In order to access the data network, you have to go into Settings. More Settings, Mobile Networks and set the Access Point Name.
    With the replacement Note 3, I cannot access Settings.  As soon as I try to access Settings (with the Vodafone SIM installed), the Settings menu appears and then immediately the home screen comes up.  After working with Verizon for over an hour, I was able to get into Settings and set the access point name by booting into Safe mode.  But as soon as I rebooted into 'normal' mode, Settings failed and I could not access its menu (to turn on wifi, for example).  There are a couple of other apps that did the same thing - but I cannot remember which ones.
    I have talked to Vodafone - they have no clue.  I talked to a Samsung rep I ran into at Best Buy, he thought the Vodafone SIM might be corrupted.  And now a Verizon tech I talked to last week thinks it is a firmware problem on the phone and I should do a Factory Data Reset.
    Have you ever heard of this problem?  What do you think might be causing it?
    Thanks for your help.

    On2CO,  I'm glad you have reached out to us today. Thank you so much for the very detail description on what is going on with the device. Sounds like there might be an issue with an application that might be causing these issues. The reason I say that is, when the phone is in Safe Mode you are able to access the Settings screens with no issues. While in Safe Mode that does block all 3rd party applications from running on the phone. I would suggest on trying to back up the device and perform a factory reset: http://spr.ly/6-182Vuo (you would want to make sure to uncheck Automatic Restore in step 3). Once the reset is complete try to see if you can get into Settings. Then, I would recommend on adding 3rd party applications back on to the device one by one to see if we can find what app might be causing this issue. Please keep us posted if you have any further questions or concerns.   KevinR_VZW Follow us on Twitter @VZWSupport If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • Plannned Delivery time not considered while calculating delivery date

    Hi PP Gurus,
    We have a situation is that after MRP run system is not taking into account planned delivery time while calculating delivery dates in schedule lines
    It is taking into account GR processing time.We have GR processing time of 3 days.requirment date is 13.10.2011 & delivery date created by the system is 10.10.2011.
    We have maintained correct master data i.e.Materail Master , Info record & Scheduling agreement.
    Please advice why it is happening & what is the significance of planned delivery time in externaly procured materail with scheduling agrement schedule lines?
    Thanks & Regards,
    Sandesh

    Hi Sandesh,
    Is this happening for particular materials or for all materials
    Couple of checks -
    1) Check with material master changes, might be after MRP run PDT is updated in material master etc ..
    2) Check in OPPQ, for option external procurement , whether scheduling info records/agree is marked or not
    Best Regards
    K.Madhu Kumar

  • Ex Factory Date

    Dear All,
    We want to maintain a date when the material is lifted at Vendor's place against each schedule in the PO.
    There is one field by name "EX-FACTORY DATE" but if I enter the same it is disappearing from the PO. Basically it's not getting saved.
    Is there anything missing here. Also I'm not able to find what is the table field for the same.
    Regards
    Manish

    Hi
    There is no field to maintain the pickup date in purchase order. you should go for enhancement.
    another way to maintain the same by using long text.
    Just go with the following links
    http://scn.sap.com/thread/3291830
    Monitor EXW ex works date of vendor
    Hope it will help you.
    Abhishek

  • Send Ex factory date from R3 to APO and populate in PO in APO as start date

    Hi ,
    Need your expertise in one scenario. SAP IS retail is combined with SAP APO.
    1) Purchase Order is ciffed to APO.
    2) Based on delivery date in PO in R3....APO calcualated date for distribution demand at source location by taking lead time from tlanes
    2) Requirement is to extract  'Ex factory date' from table EXPD in R3 and then send this date to APO.
    3) This new date should replace the starting date of PO in APO...in keyfigure Distribution demand at source location.
    Could you please suggest the way to do it? Will appreciate your response.
    Thank you in advance.

    Hi Aparna,
    Thanks.
    I have also started with purchase order user exit (CIFPUR01  Exit Function Module- Exit_SAPLMEAP_001)  at CIF outbound in R3 which will capture the date from table in R3..WIll be sent to APO...APO inbound user exit( APOCF006 ( Functional Module EXIT_/SAPAPO?SAPLCIF_PU_001) will overwrite the date at soucre location in key figure Dist Demadn TLB Confirmed or by chaing date at order level.
    Hi Experts,
    I think there are two more points....
    1) If dates are changed in table ( EXPD) then change pointer will not trigger CIFFIng thsoe changes to APO as the field is not CIF relevant. So it wont be real time integration. Work around can be to set up CIF batch job for PO at regular interval. But I am wondering if we can get some way to make it real time integrationj through CIF. Will appreciate reply on this.
    2) Have one more concern and I think its bit crucial to know the answer at this stage ....if date change in key figure Distribution Demand TLB Confirmed figure  happens in such a way that lead time between date at soucre and at target doesnot match with available Means of Tranport(MOT) lead times in TLanes then what will happen? WIll it rescheudle the dates as per date at target loctaion to match with lead time in Tlanes or will it not touch it? WIll appreciate reply of experts on this and also on how to achieve this in APO
    Thank you.
    Best Regards
    Nils

  • Example: Calculating Operation Dates

    Hi Gurus,
    http://help.sap.com/saphelp_46c/helpdata/en/7e/d4191b455911d189400000e8323c4f/frameset.htm
    Menu path: Routings > Scheduling Routings > Example: Calculating Operation Dates
    We have an example in SAP library in the above link.
    As per that queue time, setup time and processing time it is taking 10min extra.
    I mean the setup time is 0.5hrs, but as mentioned in the example,the setup start at 09.20 and setup end at 10.00. My doubt is setup end time should be 09.50. Why it is taking 10min extra.
    Please refer to this example in Library and explain why this difference.
    Regards,
    Jejesh

    Dear,
    please refere the example as the Working Time for work Center is 8 hours Which is then reduced to 6 hours after subtracting breaks & Utilization factor it comes as 6 hrs.
    So the Total reduction is 25% this means that all timings will be set by adding 25 % so that they can be set in 8 Hr scale. the 10 min that u are refering is result of that.
    Think & Try to set the Time considering Breaks & Utilization factor for a Problem ur self u will then able to appriciate that example.
    Regards
    samunder singh

  • After factory data reset, Google calender won't sync

    Have completed TWO factory data resets on HTC Thunderbolt.  Once w/deleting SD Card and once without.  Still cannot get the calendar to sync past 30 days!  I asked Big Red about it and they told me an "in house" HTC programmer would call me.  That never happened and this was two weeks ago.  .  Can anyone suggest how to get my calendar back?

        Hi, Tweebolt!
    I'm sorry you did not receive that call back! I want to see your calendar working properly for you! When you go into Settings>Accounts & Sync>Gmail/Google> are you seeing Calendar sync greyed out or checked? If greyed out I've got some tricks I want you to give a try. What I suggest is going into Settings>Account, then creating a new Gmail account (this is nothing you have to keep, we're only going to use it for five minutes). Once created, go into the Accounts & Sync, select the new account and ensure Calendar is set to sync. Then go into your Calendar application, tap Menu>Settings>ensure your real Gmail account exists and add a new event. Next, you'll go back to Account & Sync, and you should have the option to check Calendar sync under the real Gmail account. Check it to initiate the sync. After all is said and done and the sync is complete, go under Accounts & Sync and remove that fake account you set up. I've been this jump start a Gmail account countless times, and its a lot of steps but takes 5-10 minutes to complete. Keep me posted!
    Thanks,
    AdamE_VZW
    Follow us on Twitter @VZWSupport

  • Bapi_acc_document post is not calculating baseline date based pymnt terms

    Hello friends,
    Im using bapi_acc_document_post to post db and cr note and i m passing payment terms in the input file but the bapi is not calculating baseline date .
    pleasee let me knw the solution.
    Regards,
    Sunny

    that's the disadvantage of bapis and direct input in opposite to BDC. So use "old" rfbibl00 with batch input!
    A.

  • Re-installing Adobe PS Touch after a factory data reset

    I previously purchase PS Touch for my Acer A500 Iconia tablet.  After doing a factory data reset I went to the Play Store to download it again and they want to charge me another $9.99. I shouldn't have to pay for it twice.   What do I need to do?

    Hi,
    If you are sure that you are using the same Google account you should contact Google.
    You can always log in at Google Play with that account to see if it's still there and if it's still compatible with your device (minimum requirements is Android 3.1).
    Check the purchase mail receipt if you are unsure about which account was used.
    Thanks,
    Ignacio

  • What exactly happens when I do a Factory data reset?

    I want to revert my Xperia Active to the state where in it was how I bought it. All my added apps removed, all the default apps are reinstalled, the SD clear from any extra settings that other apps may have left behind while uninstalling. All in all I want to "reformat" it. Will Factory data reset do this?

    Question 1:
    Will the default apps on the Active (aka the SportyPalPro and friends) be reinstalled? I know that I can always redownload them from the market, but as i said, just like how it was bought. The Factory data reset displays a checkbox that says it would wipe out even the SD card. So what about that?
    Question 2:
    I followed this tutorial (http://androidforums.com/3529664-post5.html) to free up some load off my internal space. Does this have any gravity on the Factory resetting? In essence, I remapped Android to make it install the apps to SD by default.

  • How to reset phone to its original settings (not the Factory data reset) without erasing user data??

    I DONT want to go for the Factory Data Reset option, because it deletes all the installed apps which i managed with great difficulty. Instead I tried for Settings reset, but could not find the PIN for it. I tried 0000 also 1111 but doesnt work at all. Please someone help. !!!!!!!!!!!!!!!

    Update Service (SUS)http://www.sonymobile.com/gb/tools/update-service/http://www-support-downloads.sonymobile.com/Software%20Downloads/Update_Service_Setup-2.11.12.5.exePC Companion (PCC)Bridge (for Mac)Alternatives on How to backup Xperiashttp://talk.sonymobile.com/thread/36355Don't forget to mark the Correct Answers & Helpful Answers

  • Droid SD & Phone Storage - Factory Data Reset?

    Will doing a "Factory data reset" erase my contacts and/or photos from my phone?

    None of us know. It has been going on for weeks. People are waking up to no contacts at all on their phone. But if I make changes and sync, I get a notice the sync was successful and nothing has changed.
    I have contacts where no matter what I do to get their BD correct, it is always changed back to another date. Tried on the phone and sync. Tried online and save, it immediately reverts to another date. I have even attempted to delete the contact and re-add her and her daughter, birthday still changes. Frustrating the heck out of me.
    So just be aware you may not get the contacts back automatically or correctly.

  • Calculation of dates in Sales order in gATP

    Hi
    Can anybody please tell me how scheduling works for the following dates in sales orders for materials planned in gATP.
    1) Unloading date 2) Delivery date 3) Goods issue date 4) Loading date 5) Material availability date 6) Transportation planning
    My understanding is that gATP gives the MAD date and other remaining dates like transportation planning date, unload date etc are calculated using master data in the calling system eg ECC.
    We are facing an issue in our system where if a material is planned in ECC, it has all dates in the sales order calculated as expected based on ECC master data.
    If the same material is planned in gATP, it simply copies the MAD date to all other dates. So it is not considering the pick/pack , transportationplanning times from the ECC master data.
    Is this standard system behaviour and to avoid this  Do we need to activate Scheduling in gATP along with master data maintenence in APO ?or any user exit plus execution steps is avaialble to by pass APO master data mentaince.
    Appreciate your responses...Regards - Amit

    Amit,
    We are facing an issue in our system where if a material is planned in ECC, it has all dates in the sales order calculated as expected based on ECC master data.
    If the same material is planned in gATP, it simply copies the MAD date to all other dates.
    The system where the parts are planned is irrelevant.  The important issue is the system where the ATP is conducted.
    My understanding is that gATP gives the MAD date and other remaining dates like transportation planning date, unload date etc are calculated using master data in the calling system e.g. ECC.
    I have never seen that statement validated in any SAP documentation.
    From online help:
    SAP R/3 uses the order type to determine whether shipment scheduling or transportation scheduling should be executed.
    If scheduling is activated, SAP R/3 determines a plant for the material for each item. If it is specified in the integration model that the availability check should take place in SAP APO for a material in this plant, transportation and shipment scheduling also takes place in SAP APO.
    Standard SAP APO GATP supplies three different methods for shipment scheduling.  If you are conducting ATP in APO, and you have not configured one of the three scheduling methods, then shipment scheduling does not take place, and the system will react as you have described.  
    Read up on it here
    http://help.sap.com/saphelp_scm70/helpdata/EN/05/f8923945b12c4de10000000a114084/frameset.htm
    Best Regards,
    DB49

Maybe you are looking for

  • Cascading LOV in a Tabular form

    Hi Guys, I have read numerous articles on the generation of cascading LOV's in a tabular form but havent been able to get it working I have created an example in my apex workspace at: http://apex.oracle.com/pls/apex/f?p=4000:1500 workspace XXAPPS Use

  • Windows activation

    hello, i have had to recently re install windows a few times but this time the key does not want to work and tells me that my copy of windows is not genuine is there something i can do that does not require me to call Microsoft yet still allows me to

  • Using .as files in a Flash Game

    Hello, I am quite a beginner to Flash CS5 and ActionScript 3.0, I worked mostly with the good-old Macromedia Flash MX 2004. Recently, I had a school assignment to make a flash project, in which I created a basic game that sort-of worked, but it amaze

  • UIX server error 500-NoSuchMethod URLEncoder.encode

    Doing my first UIX project on 9052 build 1618. When I run the form, the browser receives the 500 error with trace. This project is very close to one of the OBE tutorials. Is there something else that needs to be done before running? 500 Internal Serv

  • Mac OS X 10.7.3 iTunes

    Fully updated, itunes window seems to default every now and then to larger than life size which I cannot change. Green, orange and red buttons hidden. can this be rectified and stopped...somehow I managed to get it back to usual state once but have n