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

Similar Messages

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

  • 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

  • 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

  • How to get ATINN value based on material number and Class Type ?

    I have below SELECT stmt code which gives the correct value of atwrt based on materil no and ATINN.
    However in quality system, it is failing because in quality system "atinn" value is not 0000000381. It is different.
    So how can I get ATINN(Internal characteristic) value based on material number and Class Type?
    -Obtain the batch characterstic value for the Material******************
      SELECT atwrt
        UP TO 1 ROWS
        INTO v_charvalue
        FROM ausp
       WHERE objek = mcha-matnr
         AND atinn = '0000000381'   " 'US80_FRENCH_ON_LABEL'
         AND klart = '001'.
    THANKS N ADVANCE.

    Hi SAm,
    use the Below function module to get the Atinn for Atwrt for thr Class and MAterial combination..
    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
          EXPORTING
            classtype          = '023'       "Class type
            object             = w_object  "Material number with Leading zeros
            no_value_descript  = 'X'      "Default X
            objecttable        = 'MCH1'    "Table name Mara or MCH1 or MARC
          TABLES
            t_class            = t_class   "It return the Batch class available for the above combination
            t_objectdata       = t_char  "Return Batch characteristics(ATWRT) and their value ATINN in this table
          EXCEPTIONS
            no_classification  = 1
            no_classtypes      = 2
            invalid_class_type = 3
            OTHERS             = 4.
    Regards,
    Prabhudas

  • 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

  • How to get fiscal period based on date and Fiscal year?

    Hi Guys,
               Can anybody tell me how to get Fiscal period based on date and Fiscal Year or fiscal year variant?
    Thanks,
    Gopi.

    Hi,
    Please refer the code below:
    *: Report:  ZFISCALYR                                                  :
    *: Date  :  2004                                                       :
    *: Description: Demonstrates how to return the corresponding fiscal    :
    *:              year and posting period for a company code and posting :
    *:              date or posting date and fiscal year variant.          :
    REPORT  zfiscalyr NO STANDARD PAGE HEADING.
    TABLES: ekko.
    PARAMETERS:     p_bukrs TYPE ekko-bukrs,
                    p_bedat TYPE ekko-bedat.
    DATA: gd_fiscalyr  TYPE bapi0002_4-fiscal_year,
          gd_fiscalp   TYPE bapi0002_4-fiscal_period.
    DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
          gd_fiscalp2  TYPE bapi0002_4-fiscal_period.
    DATA: gd_periv     TYPE t009-periv.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    * get fiscal year and period - (requires date and company code)
      CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
        EXPORTING
          companycodeid = p_bukrs
          posting_date  = p_bedat
        IMPORTING
          fiscal_year   = gd_fiscalyr
          fiscal_period = gd_fiscalp.
    * Alternative fiscal year function module
    * - (requires date and fiscal year variant code from T009 table)
    * gets first entry in fiscal year variant table (will need to choose
    * correct one from table rather than just using first entry)
      SELECT SINGLE periv
        FROM t009
        INTO gd_periv.
    * get fiscal year and period
      CALL FUNCTION 'DETERMINE_PERIOD'
        EXPORTING
          date                      = p_bedat
    *    PERIOD_IN                 = '000'
          version                   = gd_periv
       IMPORTING
          period                    = gd_fiscalp2
          year                      = gd_fiscalyr2
       EXCEPTIONS
          period_in_not_valid       = 1
          period_not_assigned       = 2
          version_undefined         = 3
          OTHERS                    = 4.
    *END-OF-SELECTION.
    END-OF-SELECTION.
      WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
            / 'Fiscal year is:', gd_fiscalyr,
            / 'Fiscal period is:', gd_fiscalp.
      SKIP.
      WRITE:/ 'From function module: DETERMINE_PERIOD',
            / 'Fiscal year is:', gd_fiscalyr2,
            / 'Fiscal period is:', gd_fiscalp2.
    Thanks,
    Sriram Ponna.
    Edited by: Sriram Ponna on Apr 17, 2008 8:59 PM

  • How to get work center

    Hi All,
    I am creating r actual and planned renue report for service orders ( CS ) .
    Problem :
    I have a service order number , But i am  unable get the workcenter of the order.
    Please guide me how to get the workcenter based on service order.
    Thanks in advance
    Regards
    Sudhakar

    Dear Sudhakar,
    Try using this FM: CR_WORKSTATION_READ
    Field: GEWRK (Object ID of the Work Center)
    View: VIAUFKST
    Regards
    s@k
    Edited by: siemens.a.k on Feb 11, 2010 10:18 AM

  • How to get Work schedule repor of employees

    Hi all
    Can any one help me out in
    how to get work schedule report of employees who are works in different shifts in an organization.
    Thnks in Advance
    Anusha

    Hi Anush,
    Find the SAP Standard reports for Work schedules:
    - PT03 - Display Work Schedule
    - PT63 - Personal Work Schedule (even PT61 also helpful as biswajit said)
    - PT_DSH20 - Daily Work Schedule
    Otherwise you have Time Manager’s Workplace/ Ad Hoc Query reports to view detail reports, which are user friendly for maintain time data.
    TC for Time manager’s workplace is PTMW
    TC for Ad-hoc query is S_PH0_48000513
    I suggest you to go with Ad-hoc and select all fields that what ever output you want and view the results (even you can upload also)
    Cheers,
    TG
    Message was edited by: TG

  • How do I get my calendar and contacts data to sync to computer?

    After instal of Maverick, iPhone data syncs to iCloud, but not to computer.  How do I get my calendar and contacts data to sync to computer?

    Sounds like your Mac is not logged into the same iCloud account that your phone is.  When Mavericks is installed it prompts you for an AppleID during setup. 
    Unfortunately and confusingly it then uses that AppleID to help you set up the Apple Store, iCloud, and Messages even though many users do not use the same AppleID for all of those services.  This is particularly true of familys that share one AppleID for the "Store" but use separate AppleID's for each users iCloud data.
    Therefore, put your iPhone next to your Mac and go to "Settings" > "iCloud".  Make sure that the iCloud account listed on your iPhone is the same as the one listed when you go to "System Preferences" > "iCloud" on your Mac.  If they match (or not) then click "sign out" on your Mac to disconnect the account.  Then, on the Mac (still in the iCloud preference pane), log (back) into the same iCloud account being used on your iPhone and enable the same set of services that are enabled on your iPhone (particularly calendar and contacts).
    Then, open the Contacts application on the mac and iCal on the Mac and walk away for a few minutes to allow the data to sync.  You may then want to create a test calendar event and change a contact to see if they sync up.
    One additional thought is to make sure that your iPhone is set to "Push" for iCloud. That will assure that it's syncing immediately while you are testing this.
    Hope this helps.

  • The user acct my apple was connected to no longer works (corrupt).  My Apple TV is still synced to that account and all of my recent purchases are going to that username.  Does anyone know how to get all of the purchased items back and to the new user?

    The user profile my appleTV was synced on my computer to no longer works (corrupt).  My Apple TV is still synced to that profile and all of my recent purchases are going to that username.  Does anyone know how to get all of the purchased items back and to the new user (same computer)?  I created a new user on my computer and moved the itunes folder to the desktop but never changed the path to which the apple synced to.  Now I can only see old items I purchased before the user profile went bad.  PLease help!

    Welcome to the Apple Community.
    Changing the library the Apple TV is synced with will delete all synced content from the Apple TV, but it won't delete purchased content.
    You should be able to change the library, resync any content you want and transfer your purchases back to the new library.

  • Bridge CC keeps crashing on start up but was working last week - Any Ideas how to get it back. Have tried uninstalling and re installing software. All other CC software working fine (Mac)

    Bridge CC keeps crashing on start up but was working last week - Any Ideas how to get it back. Have tried uninstalling and re installing software. All other CC software working fine (Mac)

    Also some problems since the CC2014... For me i can launch bridge but the crash occurs when i try to change access to any bridge preference... i open a discussion about it

  • How to get work JavaFX WebViewBrowser sample in debian linux wheezy?

    How to get work JavaFX WebViewBrowser sample in debian linux wheezy
    You may also check latest version of this problem here... 
    The Starting point I have
    Debian wheezy
    java version "1.7.0_40"
    Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
    Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)
    GTK version: 2.24
    NetBeans 7.3.1
    Certified configuration acording to JavaFX Supported Configurations
    is
    Ubuntu 10.4 +
      gtk2 2.18+
    GTK is OK. do I require ubuntu?
    first try: by  downloading Java SE Downloads - javafx sample
    Let's try it
    zolta@zolta:~/dolgaim/IT/NetBeansProjects/javafx/javafx-samples-2.2.40$ java -jar SwingInterop.jar
    # A fatal error has been detected by the Java Runtime Environment:
    #  SIGILL (0x4) at pc=0x9b6b4c22, pid=21172, tid=2658700144
    # JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43)
    # Java VM: Java HotSpot(TM) Client VM (24.0-b56 mixed mode linux-x86 )
    # Problematic frame:
    # C  0x9b6b4c22
    # Core dump written. Default location: /home/zolta/dolgaim/IT/NetBeansProjects/javafx/javafx-samples-2.2.40/core or core.21172
    # An error report file with more information is saved as:
    # /tmp/hs_err_pid21172.log
    # If you would like to submit a bug report, please visit:
    #   http://bugreport.sun.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    Terminated
    Let's see what core dump says
    to be continued...

    Gusar wrote:
    We need *a lot* more info than that. Could be something very simple, like the interface being up before starting wifi-menu (netctl doesn't like the interface being up, it'll only start correctly if the interface is down).
    Or it could be something more. In which case, you'll need to start wpa_supplicant manually with debugging enabled:
    wpa_supplicant -i wlp18s0b1 -c <(wpa_passphrase MYSSID passphrase) -d
    Once this says you're connected, open another terminal and start dhcpcd. Or, if wpa_supplicant doesn't manage to connect, post the *entire* output.
    Edit: Ok, you posted more info as I was writing my post. Will look through that, maybe it contains something useful. If not, follow the instructions above.
    Edit2: Nope, nothing about wireless in there, except that the driver loaded.
    It worked!!
    I was looking into the logs and found an authentication failure...my password is very long so I made some mistakes while typing it.
    So this is the solution all the way:
    SOLUTION:
    - No need to install or load any external drivers (all I used was already in the base installation)
    - DISABLE THE HIDDEN NETWORK OPTION IN THE ROUTER (thanks for the heads-up @Gusar)
    - run "# wifi-menu"
         or
           "# wpa_supplicant -i [interface] -c <(wpa_passphrase MYSSID passphrase) -d"
    - run "# dhcpcd [interface]"
    - Good to go!!
    I'm sorry for the trouble guys, and like I imagined, it was really easy and now I see my newbiness hahaha ;D
    Thanks.

  • How to get BP kind based on user name?

    Hi,
    How to get BP kind based on user name?
    Is there any table other than BUT000 which gives the Business partner no. and BP KIND?
    What is BLUEPRINT table?

    Hi John,
    do you mean Type:
    1     Person
    2     Organisation
    3     Group
    or Role like
    000000     Business Partner (General)
    BBP000     Vendor
    BBP001     Bidder
    BBP002     Portal Provider
    BBP003     Plant
    BBP004     Purchasing Company
    BEA001     Billing Unit
    BUP001     Contact Person
    BUP002     Prospect
    BUP003     Employee
    BUP004     Organizational Unit
    BUP005     Internet User
    The Role can be found in BUT100.
    Regards
    Gregor

  • Billing plan date should be same as invoice date as per factory calendar

    Hi,
    We have two contracts, one is having billing plan material and another is having no billing plan material of same customer.When we go for the billing, as because these having all the header fields same it should give one single invoice of those two contracts,but its giving two invoices means the invoice splits.I check it and found, due to different billing date the invoice splits.If we go for VF04 we can force the billing date as same,but they are is a one batch running for this invoice.My invoice date of two contracts is 22.06.2014 which is factory calendar date and billing plan date is 26.06.2014 which is contract start date.My client is asking that can we get billing plan date same as invoice date as per factory calendar in standard to get single invoice? Kindly suggest me where is the settings.
    Thanks in Advance
    Regards,
    Braja

    Braja,
    Check this
    Goto  the billing plan tab in the corresponding line item and check the rule that is determined. Now go to the configuration of this rule table by using the path
    SPRO>SD> Billing> Billing Plan> Define rules for determining dates and choose your Applicable rule and click on the details.
    There you will see the Calendar ID field where you will have to maintain the applicable factory calendar. I think this should work and your billing date on the item relevant for billing plan should be the same as the other item.
    Hope this helps,
    Ravin

Maybe you are looking for

  • How to get new controller instance instead of a cached one?

    Hi, I have the following problem. I am working on a stateful mvc application. You can search for items and then click on a button which allows you to see the details of an item in a new window and it is possible to modify it. I use standard javascrip

  • My devices no longer show up in iTunes on my new computer.

    Neither one of my devices (iPhone 5 and iPad 3) will show up in my iTunes on my new Asus Windows 8.1 computer. They show up as devices on This PC in Windows, but not on iTunes. I've uninstalled and reinstalled everything. I've stopped and started the

  • Linking two jtrees together

    Hello all, i want to link two elements in two JTrees so when i add a child to one of them at run time it will appear in the other too??? thanks in advance.

  • Outlook 2007 Rules and Alerts won't open

    User complained of receiving duplicate emails after adjusting rules.  I chose to open "Rules and Alerts" from Tools on the tool bar.  When opening  "Rules and Alerts" a box flashes on the screen and I am unable to view any of the Rules.  I am able to

  • SCCM 2012 R2 PXE Boot to Lenovo T540p 20BE

    Can someone help me PXE Boot a Lenovo T540/T440 laptop? Is there some type of settings that need to be changed in the BIOS or something? It keeps failing and Lenovo Phone Support could not tell me how to do it. I performed the following per Lenovo Te