<?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: Get Previous Working Day in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326465#M1227458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume you have your factory calendar ID with you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;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' "--&amp;gt; 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 &amp;lt;&amp;gt; 0.
*  Do Nothing
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use the FM: BKK_GET_PRIOR_WORKDAY, still then you have to use the operation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;L_V_PREDT = SY-DATUM - 1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And pass L_V_PREDT to the FM. You can test with 23.03.2009 date &amp;amp; check &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suhas Saha on Mar 19, 2009 4:56 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Mar 2009 15:54:12 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2009-03-19T15:54:12Z</dc:date>
    <item>
      <title>Get Previous Working Day</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326460#M1227453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Monday's Date should give me previous friday's date.&lt;/P&gt;&lt;P&gt;Friday's Date should give me previous thrusday's date&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 15:24:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326460#M1227453</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T15:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Get Previous Working Day</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326461#M1227454</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;To get the last day use FM 'RP_CALC_DATE_IN_INTERVAL' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and to check whether it was a working day you can use FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;           date                       = v_date&lt;/P&gt;&lt;P&gt;           factory_calendar_id        = 'FR'&lt;/P&gt;&lt;P&gt;           message_type               = 'I'&lt;/P&gt;&lt;P&gt;      exceptions&lt;/P&gt;&lt;P&gt;           date_after_range           = 1&lt;/P&gt;&lt;P&gt;           date_before_range          = 2&lt;/P&gt;&lt;P&gt;           date_invalid               = 3&lt;/P&gt;&lt;P&gt;           date_no_workingday         = 4&lt;/P&gt;&lt;P&gt;           factory_calendar_not_found = 5&lt;/P&gt;&lt;P&gt;           message_type_invalid       = 6&lt;/P&gt;&lt;P&gt;           others                     = 7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you need to pass the factory calendar accordingly, here the calendar if 'FR' for france working days, if sy-subrc is 4 then its not a working day. &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;Syed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 15:37:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326461#M1227454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T15:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Get Previous Working Day</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326462#M1227455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check the table:  TFACS which is the factory calendar display&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 15:40:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326462#M1227455</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2009-03-19T15:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get Previous Working Day</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326463#M1227456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: date TYPE d,
      i TYPE i.

date = '20090316'.
DO.
  SUBTRACT 1 FROM date.
  i = date MOD 7.
  IF i &amp;gt; 1.
    EXIT.
  ENDIF.
ENDDO.
WRITE date.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 15:43:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326463#M1227456</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-03-19T15:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get Previous Working Day</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326464#M1227457</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;Check this FM BKK_GET_PRIOR_WORKDAY&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 15:47:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326464#M1227457</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-19T15:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get Previous Working Day</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326465#M1227458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume you have your factory calendar ID with you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;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' "--&amp;gt; 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 &amp;lt;&amp;gt; 0.
*  Do Nothing
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to use the FM: BKK_GET_PRIOR_WORKDAY, still then you have to use the operation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;L_V_PREDT = SY-DATUM - 1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And pass L_V_PREDT to the FM. You can test with 23.03.2009 date &amp;amp; check &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suhas Saha on Mar 19, 2009 4:56 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2009 15:54:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326465#M1227458</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-03-19T15:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get Previous Working Day</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326466#M1227459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for everyone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2009 19:13:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-previous-working-day/m-p/5326466#M1227459</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-25T19:13:23Z</dc:date>
    </item>
  </channel>
</rss>

