To get time differnce based on factory calendar

Dear All,
We have Creation date, time, End date and time. We need to find out the time difference  based on factory calendar ..ie need to exculde weekends, holidays.
Is there any FM to get this? Please adivse procedure how to get.
Thanks
Konda Reddy

Try Something like following
PARAMETERS : P_BEGDA TYPE BEGDA,
             P_BTIME TYPE SYUZEIT,
             P_ENDDA TYPE BEGDA,
             P_ETIME TYPE SYUZEIT.
DATA LV_DURATION TYPE F.
CALL FUNCTION 'DURATION_DETERMINE'
  EXPORTING
    UNIT                       = 'H' "Hours
    FACTORY_CALENDAR           = 'GR'
  IMPORTING
    DURATION                   = LV_DURATION
  CHANGING
    START_DATE                 = P_BEGDA
    START_TIME                 = P_BTIME
    END_DATE                   = P_ENDDA
    END_TIME                   = P_ETIME
  EXCEPTIONS
    FACTORY_CALENDAR_NOT_FOUND = 1
    DATE_OUT_OF_CALENDAR_RANGE = 2
    DATE_NOT_VALID             = 3
    UNIT_CONVERSION_ERROR      = 4
    SI_UNIT_MISSING            = 5
    PARAMETERS_NOT_VALID       = 6
    OTHERS                     = 7.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE LV_DURATION.

Similar Messages

  • How to get working Date based on factory Calendar and current date

    Hi All,
    I want to deletermine a date which is Invoice date + 3 working days excluding SAT, SUN and holidays. For e.g, if Invoice date is 18th Sept, 2009, then my desired date should 23rd Sept, 2009.
    I do have factory calendar ID but i dont know the proper function module.
    Can some one please help me...

    Hi,
    check this code,
    DATA:
    w_date   TYPE dats,
    w_date1  LIKE scal-date,               " dats
    w_date2  LIKE scal-date,
    i_factid LIKE tkevs-fcalid VALUE 'IN', " IN for India
    it_dats  TYPE TABLE OF rke_dat,
    wa_dats  LIKE LINE OF it_dats,
    w_lines  TYPE i.
    CALL FUNCTION 'CALCULATE_DATE'
      EXPORTING
        days        = '0'
        months      = '1'
        start_date  = sy-datum             " for example '20090918'
      IMPORTING
        result_date = w_date.              " 1 month added '20091018'
    w_date1 = sy-datum.
    w_date2 = w_date.
    CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
      EXPORTING
        i_datab  = w_date1
        i_datbi  = w_date2
        i_factid = i_factid
      TABLES
        eth_dats = it_dats.                " number of working days between two dates
    READ TABLE it_dats INDEX 4 INTO wa_dats.
    WRITE :
      / wa_dats-periodat.                  " new date '20090923'
    Hope this will be helpfull...
    Regards
    Adil

  • Schedule process chain based on factory calendar

    Hi Experts,   I'd like to schedule my process chain to run only on 3rd and 4th working day every month.  I tried to schedule it based on factory calendar. It does not seem to be working.  Any ideas why it is not working? or any suggestions on the best way to schedule it?
    Thanks!

    After scheduling, Did you check "Right click on start variant" to see scheduled jobs,
    You should see a released job, double click to check "Schedule Run".
    Whats the setting you maintained for "Do not execute before" ?
    Also Did you check any holiday in the Z1 calendar prior this day.
    VJ

  • System does not propose the delivery date based on factory calendar

    Hi,
    I am creating a sales order for a delivery date for this sat which is (2/22/09)
    I have maintained 2 separate calendars for
    1) shipping point
    2) for the route
    The route has a transit time of 1 day and the calendar has sat and sunday as non working.
    the Shipping point has a pick/pack time of 1 day and the calendar has sat and sunday as non working
    The material is available in the warehouse
    Now when i create this sales order i enter the delivery date as 2/22/09, the system does not propose me the delivery date of monday (i.e 2/23/09) It accepts the 2/22/09 delivery date.
    In the schedule line i do see the date as 2/22/09 only.
    The delivery was created with the following dates
    Picking = 2/17/09
    Transportation Planning = 02/18/2009
    Loading =02/18/2009 
    Planned GI= 02/18/2009
    Delivery Date = 02/22/2009
    How can the system give me the delivery date of a sunday when the calendar doesnt allow sunday as working day.
    Also the route time is 1 day in transit so i am not sure why the system is proposing a 3 day transit time?
    Can any one explain the behaviour of SAP for the delivery date logic

    Dspsac,
    Delivery date can be any date.  For instance, if your customer insisted on a Sunday delivery, you would accommodate him, regardless of any calendar.
    From the delivery date, the system counts backwards USING THE FACTORY CALENDAR ASSIGNED TO THE ROUTE by the number of days in the route.  You have to consult the FC assigned to your Route to determine if the GI date has been properly calculated.
    From the GI date, the system counts backward Pick/pack time, using the shipping point calendar, to arrive at Material availability date.
    Calculations are explained in SAP online help
    [Transportation and Delivery Scheduling|http://help.sap.com/erp2005_ehp_04/helpdata/EN/dd/5607e7545a11d1a7020000e829fd11/frameset.htm]
    Regards,
    DB49

  • Difference between dates based on factory calendar.

    Hello
    Is there a standard function module which can calculate the number of days.(difference between creation date of the document and system date) but in accordance with the factory calendar.
    and also os there a way we can find out these function modules names by ourself

    Hi,
    please don't do a cross posting of the same question in different forums. It is against the rules --> see rules of engagement. But anyway, check out your other thread, i gave you the answer.
    kind regards
    Siggi

  • Get time Zone based on Country code

    Hi All,
    I am looking for getting the time and date of a particular country based on country code in XI. For ex. if IN comes in payload then get IST (Date and time). Can we do that in UDF?
    Thanks & Regards,
    Venu V

    > I am looking for getting the time and date of a particular country based on country code in XI.
    How should that work? Have you thought about Russia? USA?
    Check java class Calendar and TimeZone:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimeZone.html

  • Get time difference Within 2 gregorian Calendars, 1 obtained via SimpleDate

    Hi guys
    I'm having a problem with an application, i've posted something before about it and with two GregorianCalendars.
    This one is receiving a GregorianCalendar value from the default constructor, and the second gregorian calendar from a String, using SimpleDateFormat class
    The problem is that whenever i start the application it get stucked at: "Deze datum ligt: 56 in het verleden" meaning from dutch "this datum is 56 days in the past"
    the issue is thus at the method "getVerschil()" which means "get difference" in Dutch.
    Even if you try to modify the date fields from the class with the main method, inserting new dates it keeps on telling me 56.
    I was wondering if you see anything strange in the code and then a little question.
    Does the JDK sees a GregorianCalendar made with the default constructor, and a GregorianCalendar made with a SimpleDateFormat string patter "dd-mm-yyyy", in the same way?
    I mean, can java make a comparison within the 2 Calendars recognising which are days and which are the months?
    Thank you guys:
    Below the codes, the first one is the interface and below you'll see the main method class which inserts the date with SimpleDateFormat
    public class Kalender {
          * attributes
         private final String patroon;
         private String datum= null;
         private String userDagText= null;
         private int userDag;
         private int userMaand;
         private int userJaar;
         long DAGMILLIS=  24*60*60*1000;
         //deze kalender wordt gemaakt op het moment dat de toepassingen aangezet wordt
         GregorianCalendar nu= new GregorianCalendar();
         //deze kalender word gemaakt door de user-ingevoerde datum
         GregorianCalendar userCalendar= new GregorianCalendar(userDag, userMaand, userJaar);
         //datum formatter
         SimpleDateFormat sdf;
          * Constructor
         public Kalender(String datum, String patroon){
              this.patroon= patroon;
              this.datum=datum;
              sdf= new SimpleDateFormat(patroon);
         }//EOF
         public void setUserDate(){
              Date userDatum= sdf.parse(datum, new ParsePosition(0));
              userCalendar.setTime(userDatum);
              userDag= userCalendar.get(Calendar.DAY_OF_WEEK);
              userMaand= userCalendar.get(Calendar.MONTH);
              userJaar= userCalendar.get(Calendar.YEAR);
         }//EOF
          * deze methode returns de hele date
         public String geefDatum(){
              return sdf.format(userCalendar.getTime());
         }//EOF
          * deze methode bepaald of de ingevoerde datum een schrikkeljaar is
          * deze methode vindt het tijdverschil tussen twee datums
         public String getVerschil(){
              long userMillis= userCalendar.getTimeInMillis();
              long nuMillis= nu.getTimeInMillis();
              if(nuMillis==userMillis){
                   return "deze datum zijn gelijk";
              } else if(nuMillis>userMillis){//userdatum in het verleden
                   long millisVerschil= nuMillis-userMillis;
                   long dagenVerschil= millisVerschil / (DAGMILLIS);
                   return "Deze datum ligt: "+dagenVerschil+" in het verleden";
              } else  if(nuMillis<userMillis){//userdatum in het toekomst
                   long millisVerschil= userMillis- nuMillis;
                   long dagenVerschil= millisVerschil / (DAGMILLIS);
                   return "Deze datum ligt: "+dagenVerschil+" in het toekomst";
              return " ";
    }The tester (main) class which creates the second GregorianCalendar is the following
    public class KalenderTest {
         public static void main(String[] args){
              //constructor werkt
              Kalender kal= new Kalender("01-28-2010", "dd-mm-yyyy");
              //setUserDate werkt
              kal.setUserDate();
              //testen van getVerschil
              System.out.println(""+kal.getVerschil());
         }Edited by: classboy on Apr 26, 2010 9:22 PM
    Edited by: classboy on Apr 26, 2010 9:23 PM

    classboy wrote:
    Does the JDK sees a GregorianCalendar made with the default constructor, and a GregorianCalendar made with a SimpleDateFormat string patter "dd-mm-yyyy", in the same way?Of course not.
    And is there anything wrong with your code? Plenty. You passed the fields to the GregorianCalendar constructor in the wrong order. You got the day of the week and then used it as if it were the day of the month. That's just from a quick look, there's probably more.

  • Maintenance Order & Factory calendar

    Hi,
       How to Link Maintenance Order & Factory calendar so that when i execute the 'Cost Evaluation' table
    S115, i will get cost for the maintenance order Activities for specified month based on factory calendar.
    Pleaes Let me know.

    PeteA,
         When i execute the maintenance Order in table S115 with input data fiscal year variant (Calendar Year 4/4/5) , Order type & Month (say 02.2009) system throws message "No table entries found for specified Key" .....
    But when i execute the same table with all input data except fiscal year variant (Calendar year 4/4/5), system gives the output of my order type.
      So i think Fiscal year variant should be maintained in Order. That procedure i want to know
    (Note: In Work center "Capacity' Tab, we can only assign the factory calendar; Not fiscal year variant(4/4/5 year)
      Pls let me know

  • Which Factory Calendar is used to determine the Sales Order delivery date

    Hi ,
    There is Factory calendar assigned to sales Org and shipping point as well.
    I want to know which Factory calendar is used to determine the promise date on sales order acknowledgement and which one is used to determine the delivery date?
    Appreciate your help/inputs.
    Regards,
    Ram

    Ramy,
    I am not sure what you mean by 'promise date'.  For a given sales order item confirmation schedule, the system calculates the following dates:
    Delivery Date
    Goods Issue date
    Loading Date
    Material Availability date
    Transportation planning date.
    These dates are dependent upon what you have configured, and what your master data is.  If you have transportation scheduling turned on (IMG>SD>Basic Functions>Delivery scheduling and transportation scheduling), then the durations are:
    Route duration (transit), - affected by factory calendar assigned to the route (0VTC, that's a zero)
    Picking time, packing time, Transportation planning time, and Loading time- affected by the factory calendar assigned to the shipping point (OVLZ, not a zero)
    In addition, the Material availability date will be affected by the calendar assigned to the plant (WB03).  The calculated dates may also differ on a given order schedule line, based on whether the sales order is backward scheduled or forward scheduled.  This is particularly important when the calendars all have different holiday schedules.
    Standard SAP help on the matter, with a couple of nice pictures.
    http://help.sap.com/saphelp_erp60/helpdata/en/dd/5607e7545a11d1a7020000e829fd11/frameset.htm
    Rgds,
    DB49
    Edited by: Dogboy49 on Feb 16, 2010 5:08 AM

  • Factory calendar attached to reference objects

    Hi,
    While creating date types and date duration we can attach reference objects to them. But where do we see the time zones and the factory calendar settings maintained against a reference object?
    Regards,
    -Sweta

    Hi Sweta
    If you want to add company holiday to take in account while calculating End date then config for Factory calendar / Holiday
    SAP Implementation Guide> SAP Web Application Server>General Settings-->Maintain calendar
    Once u done with config, use FM BUSINESS_DATE_CREATE for End date creation.
    I am still finding how to attach the FC to Reference object. If i get will post u again.
    hope you able to get your result.
    Thanks,
    Deven
    Do not forget to allocate points.............

  • Factory calendar in project differs from plant factory calendar

    Hi Experts,
    When i enter the plant name in project definition and save it at once, am getting the following error message,
    "Factory calendar in project differs from plant factory calendar
    Message no. CJ707"
    Its not allowing me to save the project at all. I am able to only cancel and come out of the project.
    Please advise.
    Thanks & Regards,
    Kabir

    Hi Nitin,
    Thanks for your reply.
    The Issue is solved. The PP guy had defined a customised calendar for the plant. Then i had matched it with the same in Project Profile.
    Regards,
    Kabir

  • How to extend factory calendar

    Hi,
    We need to do extend our factory calendar before we
    update the time stream. Our factory calendar
    only up to year 2010.
    Kindly please advise how to extend the factory calendar?
    Thank you.

    Hi Harish,
    I try to change the "To Year" from 2010 to 2020, but there is an error message coming out and does not allowed me to change: "Please enter validity area between years 1998 - 2010".
    Kindly please advise. Thank you.

  • Invalid factory calendar or error in the factory calendar

    When I am trying to post " Goods issue for consumption:" in T.code MB1A getting below error error
    Invalid factory calendar or error in the factory calendar
    I am made chages in OY05 still facing same issue. Please help me out.

    Hi
    The factory calender is not a mandatory field during configuration, but is required for IM postings to occure.
    Check and maintain factory calender:  SPRO\SAP ref IMG\Enterprise structure\Definition\Logistics general\Define, copy, check, delete plant.
    Regards

  • 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)

  • 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

Maybe you are looking for

  • Safari for win 8.1 pro

    where can i download to safari for win 8.1 pro (64bit) I am already safari at home on my macbook but i wanto use safari on my pc at work. many thank for your help

  • Error Message when running HelloWorldPG.xml

    Hi, I am getting this error. can you shade some light on this... Please Exception Details. oracle.apps.fnd.framework.OAException: Application: FND, Message Name: SECURITY_APPL_SERVER_ID. at oracle.apps.fnd.framework.server.OAExceptionUtils.processAOL

  • HELP Adobe Pro 9 can't be installed by Adobe Techs?

    Back at the beginning of April I got the error message that the licensing was not working.  My Adobe 9 PRO became unusable.  I went to the website and spent 3 hours following the instructions.  The next day, I called Adobe support.  Spent 2 1/2 hours

  • Sluggish MBP - wifi probs

    Hi there. I recently upgraded from a MB to a MBP - brought a refurbished one from the Apple store. Anyway, since i've had it (and compared to my older MB) its performance is not up to par. I used migration assistant to transfer everything over from t

  • I just upgraded my mac desk top as i was asked i have just a blank  screen now

    i upgraded my desktop Mac and it just stopped working now it has a blank screen with a file flashing