<?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: Date Validation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133653#M1189909</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Another thing what you can do is that when the entered date is not saturday then throw a error message,&lt;/P&gt;&lt;P&gt;ex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: w_day TYPE scal-indicator.
SELECT-OPTIONS: so_date FOR sy-datum.

AT SELECTION-SCREEN.

  CALL FUNCTION 'DATE_COMPUTE_DAY' "To get the day of a date
    EXPORTING
      date = so_date-low
    IMPORTING
      day  = w_day.

  IF w_day NE '6'. "6 is for saturday
    MESSAGE e000 WITH 'Not saturday'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Feb 2009 14:47:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-05T14:47:10Z</dc:date>
    <item>
      <title>Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133646#M1189902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;        Is it possible to restrict some of the dates for the date field while selecting from calendar.  Is there any mechanism through which we can disable some of the days in calendar?&lt;/P&gt;&lt;P&gt;For eg. If I need just Saturdays to be populated, so calendar will disable all other days.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 11:06:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133646#M1189902</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T11:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133647#M1189903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use this function module to get your requirement.&lt;/P&gt;&lt;P&gt;It will tell u the day of a week as word like sunday,monday,tuesday........etc and whether the day is holiday or not....&lt;/P&gt;&lt;P&gt;Based on this u can perform logic ast selection-screen output or in a function module...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DAY_ATTRIBUTES_GET&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it will helpful to u.......&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;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 12:11:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133647#M1189903</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T12:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133648#M1189904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Or else u can try out this one also...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FM:&lt;/P&gt;&lt;P&gt; DATE_COMPUTE_DAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and u can write your own logic.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 12:23:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133648#M1189904</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T12:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133649#M1189905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply, But I was looking for something which can &lt;STRONG&gt;disable days in calendar&lt;/STRONG&gt; while selecting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 12:27:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133649#M1189905</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T12:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133650#M1189906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could create your own dropdown, not in calendar form, but populate the dropdown with only days&lt;/P&gt;&lt;P&gt;you want to allow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 12:31:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133650#M1189906</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T12:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133651#M1189907</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 out the below code.&lt;/P&gt;&lt;P&gt;Here you can view only Public Holidays , Saturdays and Sundays.&lt;/P&gt;&lt;P&gt;As said above i had used the FM 'DAY_ATTRIBUTES_GET'.&lt;/P&gt;&lt;P&gt;You just gothrough the FM import and export parameters and Tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : h_facid TYPE scal-fcalid,&lt;/P&gt;&lt;P&gt;       h_hocid TYPE scal-hcalid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : it_day_attr_tab TYPE STANDARD TABLE OF casdayattr INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;       wa_day_attr_tab TYPE casdayattr.&lt;/P&gt;&lt;P&gt;DATA : l_datum TYPE scdatum,&lt;/P&gt;&lt;P&gt;       l_datum1 TYPE scdatum,&lt;/P&gt;&lt;P&gt;       l_langu TYPE sylangu.&lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;P&gt; l_datum = sy-datum - 37.&lt;/P&gt;&lt;P&gt; l_datum1 = sy-datum.&lt;/P&gt;&lt;P&gt; h_facid = '01'.&lt;/P&gt;&lt;P&gt; h_hocid = '01'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'DAY_ATTRIBUTES_GET'&lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;P&gt;     factory_calendar                 = h_facid&lt;/P&gt;&lt;P&gt;     holiday_calendar                 = h_hocid&lt;/P&gt;&lt;P&gt;     date_from                        = l_datum&lt;/P&gt;&lt;P&gt;     date_to                          = l_datum1&lt;/P&gt;&lt;P&gt;     language                         = l_langu&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    YEAR_OF_VALID_FROM               =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    YEAR_OF_VALID_TO                 =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    RETURNCODE                       =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      day_attributes                   = it_day_attr_tab&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    FACTORY_CALENDAR_NOT_FOUND       = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    HOLIDAY_CALENDAR_NOT_FOUND       = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    DATE_HAS_INVALID_FORMAT          = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    DATE_INCONSISTENCY               = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    OTHERS                           = 5&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_day_attr_tab INTO wa_day_attr_tab.&lt;/P&gt;&lt;P&gt; IF wa_day_attr_tab-freeday = 'X' or wa_day_attr_tab-holiday = 'X'.&lt;/P&gt;&lt;P&gt;  WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; wa_day_attr_tab-date,&lt;/P&gt;&lt;P&gt;          wa_day_attr_tab-txt_short,&lt;/P&gt;&lt;P&gt;          wa_day_attr_tab-txt_long,&lt;/P&gt;&lt;P&gt;          wa_day_attr_tab-weekday_l,&lt;/P&gt;&lt;P&gt;          wa_day_attr_tab-day_string.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 13:25:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133651#M1189907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T13:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133652#M1189908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sumit,&lt;/P&gt;&lt;P&gt;Here are a bunch of calender related Function Modules,&lt;/P&gt;&lt;P&gt;make a bash at each to fix your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All function modules are contained in the function group SCAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATE_COMPUTE_DAY
This function module returns the day of the week for the date passed.
DATE_GET_WEEK
This function module returns the week for the date passed.
WEEK_GET_FIRST_DAY
This function module returns the first day of the week passed. (This is always a Monday, regardless of whether it is a working day or a holiday.)
EASTER_GET_DATE
This function module returns the date of Easter Sunday for the year passed.
FACTORYDATE_CONVERT_TO_DATE
This function module returns the calendar date for the factory date and the factory calendar passed.
DATE_CONVERT_TO_FACTORYDATE
This function module returns the factory date for the date and factory calendar passed. You can specify with a parameter whether the next or the previous working day is returned if the day is not a working day.
HOLIDAY_CHECK_AND_GET_INFO
With this function module, you test whether a particular date in the holiday calendar passed is a holiday. If so, the definition of the holiday is returned.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thankyou,&lt;/P&gt;&lt;P&gt;Zahack&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 14:31:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133652#M1189908</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T14:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date Validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133653#M1189909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Another thing what you can do is that when the entered date is not saturday then throw a error message,&lt;/P&gt;&lt;P&gt;ex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: w_day TYPE scal-indicator.
SELECT-OPTIONS: so_date FOR sy-datum.

AT SELECTION-SCREEN.

  CALL FUNCTION 'DATE_COMPUTE_DAY' "To get the day of a date
    EXPORTING
      date = so_date-low
    IMPORTING
      day  = w_day.

  IF w_day NE '6'. "6 is for saturday
    MESSAGE e000 WITH 'Not saturday'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2009 14:47:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-validation/m-p/5133653#M1189909</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-05T14:47:10Z</dc:date>
    </item>
  </channel>
</rss>

