<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Factory calendar function in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002600#M76846</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Check also the function module:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WDKAL_DATE_ADD_FKDAYS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Aug 2005 18:51:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-08-26T18:51:41Z</dc:date>
    <item>
      <title>Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002596#M76842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me to figure this out.  I deducted 4 days from the requested date and went to factory calendar.  Factory calendar gives next business day (8/1/05) which is not what we want.  Need 4 days before del. date.  Saturday and Sunday in between is throwing the date off. Is there another function to accomplish this.  Thanks in advance for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example this is what I need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Requested Del Date = 8/01/05 (monday)&lt;/P&gt;&lt;P&gt;Planned Del Time = 4 days&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do not count saturday and sunday - then go back four days 8/01, 7/29, 7/28, 7/27 - planned GI should be 7/26.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 18:40:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002596#M76842</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T18:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002597#M76843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Based on your previous post, I am assuming you are using 'DATE_CONVERT_TO_FACTORYDATE'. In the solution that Rich proposed, use '-' instead of '+'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 18:46:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002597#M76843</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T18:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002598#M76844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of adjusting forward,  adjust backward.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


* Use "-" instead of "+"
  call function 'DATE_CONVERT_TO_FACTORYDATE'
       exporting
            correct_option      = '-'  " Adjustment
            date                = d1   " Date In
            factory_calendar_id = 'P6' " Calendar Id
       importing
            date                = xdate.  " Date out


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 18:47:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002598#M76844</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-08-26T18:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002599#M76845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kanya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the following link:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="521315"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can subtract the number you get from the current date&lt;/P&gt;&lt;P&gt;Hope it may server your purpose&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 18:50:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002599#M76845</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T18:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002600#M76846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Check also the function module:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WDKAL_DATE_ADD_FKDAYS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 18:51:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002600#M76846</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T18:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002601#M76847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm think that I have have misunderstood the first time around.  You need to go back 4 days not including the non-working days, right?  Try this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter 08/01/2005 in the parameters field,  the output will be 07/26/2005.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report  zrich_0002.



parameters: p_datum type sy-datum.


do 4 times.

  p_datum = p_datum - 1.

  call function 'DATE_CONVERT_TO_FACTORYDATE'
       exporting
            correct_option      = '-'
            date                = p_datum
            factory_calendar_id = 'P6'
       importing
            date                = p_datum.


enddo.

write:/ p_datum.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you are subtracting one day at a time, and check to see if there is a calendar adjustment which can be applied.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 18:53:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002601#M76847</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-08-26T18:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002602#M76848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich solution is OK for your problem, only you have to change the calendar ID. You get out this information from T001W&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 19:01:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002602#M76848</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T19:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002603#M76849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks guys.  It gives me 7/28/05 but I am looking for 7/26 which gives me 4 days excluding Sat. and Sunday.  Is there a way we could exclude weekends going back for calendar function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 19:07:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002603#M76849</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T19:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002604#M76850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, please try the code in my last answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please don't forget to award points for helpful answers.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 19:16:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002604#M76850</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-08-26T19:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002605#M76851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I runned Rick solution and the result is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can't obtain a right result, probably you use a wrong calendar id, or in your calendar is wrong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 19:18:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002605#M76851</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T19:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002606#M76852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a working example using the FM I gave you last time. I used a date of November 28th 2005 as input date and asked the system to back-calculate by 4 days using our custom calendar. Now while 26 and 27 are saturday and sunday, in our custom calendar, 24 and 25 are marked as holidays. So my first previous working day is 23rd November, 2nd is 22nd, and 3rd is 21st, but again I hit Saturday and Sunday on 20th and 19th. So my 4th working day backwards is 18th November. I hope this is what you are looking for and it worked for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest1 .

PARAMETERS: p_date LIKE sy-datum.

DATA: v_input_date   LIKE sy-datum,
      v_output_date  LIKE sy-datum.

START-OF-SELECTION.

  CALL FUNCTION 'BUSINESS_DATE_CREATE'
    EXPORTING
*     BLEIB_IM_MONAT           = ''
      datum_ein                = p_date
      geschaeftstage           = 4
      kalender                 = 'Z6'
      richtung                 = '-'
   IMPORTING
      datum_aus                = v_output_date
   EXCEPTIONS
      calendar_not_found       = 1
      date_out_of_range        = 2
      OTHERS                   = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 19:34:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002606#M76852</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T19:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Factory calendar function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002607#M76853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to all of you.  Rich, thanks for all your help.  Finally it worked after I followed your last suggestion.  Gave all of you ponts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2005 19:39:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/factory-calendar-function/m-p/1002607#M76853</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-08-26T19:39:44Z</dc:date>
    </item>
  </channel>
</rss>

