<?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 function module for finding the days excluding sunday in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743461#M322793</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Al,&lt;/P&gt;&lt;P&gt;can any one help me how to find the number of working days from starting date and to date excluding sundays,is there any function module &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;P&gt;lokesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Dec 2006 07:08:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-21T07:08:55Z</dc:date>
    <item>
      <title>function module for finding the days excluding sunday</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743461#M322793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Al,&lt;/P&gt;&lt;P&gt;can any one help me how to find the number of working days from starting date and to date excluding sundays,is there any function module &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;P&gt;lokesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2006 07:08:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743461#M322793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-21T07:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: function module for finding the days excluding sunday</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743462#M322794</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;U can find a Function module to add no of days to given date by skiping weekends and holidays in this thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="158679"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Prakash&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2006 07:11:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743462#M322794</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-21T07:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: function module for finding the days excluding sunday</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743463#M322795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are u referring to a indian calender id..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can u confirm whether the plant is maintained for this by checking in table T001W-FABKL FIELD .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and teh calender id in TFACD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then check this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZEX8 .

tables : VBAK.

PARAMETERS : P_WERKS LIKE T001W-WERKS OBLIGATORY.

select-options : s_date for vbak-erdat OBLIGATORY.

DATA : WRK_DYS TYPE I ,
       TOT_DYS TYPE I ,
       HOL_DYS TYPE I.
DATA: calid LIKE tfacd-ident.
DATA : BEGIN OF ITAB OCCURS 0,
       DATE   LIKE SY-DATUM,
       END OF ITAB.

DATA : BEGIN OF IWRK OCCURS 0,
       WRDATE   LIKE SY-DATUM,
       END OF IWRK.

DATA : BEGIN OF IHOL OCCURS 0,
       HOLDAY   LIKE SY-DATUM,
       END OF IHOL.


DATA : V_DATE LIKE SY-DATUM.

      IF S_DATE-LOW ne '00000000'.
      PERFORM FILLTAB.
      ENDIF.

*     LOOP AT ITAB.
*     WRITE:/ ITAB-DATE.
*     ENDLOOP.

DESCRIBE TABLE ITAB LINES TOT_DYS.
WRITE:/ 'TOTAL NUMBER OF DAYS ARE', TOT_DYS.


     PERFORM FCT_CALID.

     PERFORM WRK_DAYS.

     PERFORM DISP_WRKDYS.

     PERFORM DISP_HOLDAYS.

form FILLTAB.
 ITAB-DATE = S_DATE-LOW.
 APPEND ITAB.
  IF S_DATE-HIGH ne '00000000'.

  IF S_DATE-LOW = S_DATE-HIGH.
  EXIT.
  ENDIF.

  ADD 1 To S_DATE-LOW.
  PERFORM FILLTAB.

  ENDIF.

endform.                    " FILLTAB
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  WRK_DAYS
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form WRK_DAYS.
LOOP AT ITAB.
         V_DATE = ITAB-DATE.


 CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
             EXPORTING
               date                             = V_DATE
               factory_calendar_id              = CALID
               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 EQ 0.
            IWRK-WRDATE = V_DATE.
            APPEND IWRK.
            CLEAR  IWRK.

            ELSE.
            IHOL-HOLDAY = V_DATE.
            APPEND IHOL.
            CLEAR  IHOL.

           ENDIF.

    ENDLOOP.

endform.                    " WRK_DAYS
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  DISP_WRKDYS
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form DISP_WRKDYS.

DESCRIBE TABLE IWRK LINES WRK_DYS.
LOOP AT IWRK.
AT FIRST.
skip.
WRITE:/5 'WORKING DAYS'.
SKIP.
ENDAT.
WRITE:/5 IWRK-WRDATE.
ENDLOOP.

WRITE:/ 'Total number of working days are', wrk_Dys.
skip.
endform.                    " DISP_WRKDYS
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  DISP_HOLDAYS
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form DISP_HOLDAYS.
DESCRIBE TABLE IHOL LINES HOL_DYS.

LOOP AT IHOL.
AT FIRST.
skip.
WRITE:/5 'NON WORKING DAYS ARE '.
SKIP.
ENDAT.
WRITE:/5 IHOL-HOLDAY.
ENDLOOP.
WRITE:/ 'Total number of NON working days are', HOL_Dys.
skip.

endform.                    " DISP_HOLDAYS
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  FCT_CALID
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form FCT_CALID.

    SELECT SINGLE fabkl INTO calid FROM t001w
           WHERE werks = P_werks.

endform.                    " FCT_CALID&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;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2006 07:13:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743463#M322795</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-21T07:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: function module for finding the days excluding sunday</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743464#M322796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;call function 'RKE_SELECT_FACTDAYS_FOR_PERIOD' 
exporting 
i_datab = start_date
i_datbi = end_date
i_factid = 'US' 
tables 
eth_dats = days.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2006 07:13:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743464#M322796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-21T07:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: function module for finding the days excluding sunday</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743465#M322797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. DATE_CHECK_WORKINGDAY&lt;/P&gt;&lt;P&gt;This is one useful FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Try this code (just copy paste)&lt;/P&gt;&lt;P&gt;IT DOES EXACTLY WHAT U REQUIRE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : num type i.&lt;/P&gt;&lt;P&gt;parameters : frdate type sy-datum default '20051216'.&lt;/P&gt;&lt;P&gt;parameters : todate type sy-datum default '20051221'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform getinfo using frdate todate changing num.&lt;/P&gt;&lt;P&gt;break-point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form getinfo&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM getinfo USING fromdate todate CHANGING numofdays type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : d TYPE sy-datum.&lt;/P&gt;&lt;P&gt;d = fromdate - 1.&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d = d + 1.&lt;/P&gt;&lt;P&gt;IF d &amp;gt; todate.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;endif.&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 = d&lt;/P&gt;&lt;P&gt;factory_calendar_id = '01'&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;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;numofdays = numofdays + 1.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; d.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. "getinfo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Dec 2006 07:14:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-finding-the-days-excluding-sunday/m-p/1743465#M322797</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-21T07:14:00Z</dc:date>
    </item>
  </channel>
</rss>

