<?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: ABAP REGEX to validate date format in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468385#M2000726</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;CONSTANTS c_regex_ymd_slash  TYPE string VALUE '(([12]\d{3})\/(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01]))'.
...
    FIND REGEX c_regex_ymd_slash IN iv_date_analysed.
    IF sy-subrc EQ space.
      "blabla
      RETURN.
    ENDIF.
....&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 27 Sep 2021 08:00:33 GMT</pubDate>
    <dc:creator>FredericGirod</dc:creator>
    <dc:date>2021-09-27T08:00:33Z</dc:date>
    <item>
      <title>ABAP REGEX to validate date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468384#M2000725</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I have a requirement to validate date format of BSEG-ZUONR.&lt;/P&gt;
  &lt;P&gt;If the date format is not equal to YYYY/MM/DD, we need to print error message saying 'date format is incorrect'.&lt;/P&gt;
  &lt;P&gt;Can anyone let me know how this can be achieved? can we write a regex?&lt;/P&gt;
  &lt;P&gt;Thanks in advance.&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;Tejas.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 07:53:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468384#M2000725</guid>
      <dc:creator>former_member677973</dc:creator>
      <dc:date>2021-09-27T07:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP REGEX to validate date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468385#M2000726</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;CONSTANTS c_regex_ymd_slash  TYPE string VALUE '(([12]\d{3})\/(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01]))'.
...
    FIND REGEX c_regex_ymd_slash IN iv_date_analysed.
    IF sy-subrc EQ space.
      "blabla
      RETURN.
    ENDIF.
....&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Sep 2021 08:00:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468385#M2000726</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-09-27T08:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP REGEX to validate date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468386#M2000727</link>
      <description>&lt;P&gt;Antoher idea would be to try casting it to a date a deal with exceptions but I have a soft spot for regex &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 08:12:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468386#M2000727</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-09-27T08:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP REGEX to validate date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468387#M2000728</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;c5e08e0478aa4727abc4482f5be390b2&lt;/SPAN&gt; how can you be sure the date format is YYYY/MM/DD ?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 08:26:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468387#M2000728</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2021-09-27T08:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP REGEX to validate date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468388#M2000729</link>
      <description>&lt;P&gt;Assign it to a date, write it back using formatting, compare with 
source. Hmm, come to think of it, the efficiency of this approach is 
highly questionable &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 08:30:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468388#M2000729</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-09-27T08:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP REGEX to validate date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468389#M2000730</link>
      <description>&lt;P&gt;If you are not in the mood to use regex anymore, because you have realized that to insure actual dates, a regex is not the way to do it, you can try something like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  TRY.
      cl_abap_datfm=&amp;gt;conv_date_ext_to_int(
        EXPORTING
          im_datext    = bseg-zuonr
          im_datfmdes  = '5'
  IMPORTING
    ex_datint    = DATA(date)
             ).
      num8 = date.
      WRITE num8 TO bseg-zuonr USING EDIT MASK '____/__/__'.
    CATCH cx_abap_datfm_no_date cx_abap_datfm_invalid_date cx_abap_datfm_format_unknown cx_abap_datfm_ambiguous INTO DATA(oref).
      MESSAGE oref-&amp;gt;if_message~get_text( ) TYPE 'E'.
  ENDTRY.  
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Put the code in some FI validation rule exit for example.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 10:45:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-regex-to-validate-date-format/m-p/12468389#M2000730</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2021-09-27T10:45:12Z</dc:date>
    </item>
  </channel>
</rss>

