<?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: Calculate a specific date in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558517#M2007472</link>
    <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;ozgur_korkmaz&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/2774603/finding-number-of-days-between-two-dates.html"&gt;here?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/2774603/finding-number-of-days-between-two-dates.html"&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 00:57:36 GMT</pubDate>
    <dc:creator>amontella96</dc:creator>
    <dc:date>2021-11-12T00:57:36Z</dc:date>
    <item>
      <title>Calculate a specific date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558516#M2007471</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I have a request to calculate certain days of the month. For example, I need to reach dates such as the 2nd Tuesday of the month or the 4th Friday of the month. Is there a program or FM where I can calculate this?&lt;/P&gt;
  &lt;P&gt;If I need to explain in more detail, when I say the 2nd Tuesday of the month, the date I want to reach is 09.11.2021 according to the calendar below. When I say Friday the 4th it's 26.11.2021&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1990613-ekran-goruntusu-2021-11-11-231940.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 20:22:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558516#M2007471</guid>
      <dc:creator>OzgurKorkmaz</dc:creator>
      <dc:date>2021-11-11T20:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a specific date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558517#M2007472</link>
      <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;ozgur_korkmaz&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/2774603/finding-number-of-days-between-two-dates.html"&gt;here?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/2774603/finding-number-of-days-between-two-dates.html"&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 00:57:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558517#M2007472</guid>
      <dc:creator>amontella96</dc:creator>
      <dc:date>2021-11-12T00:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a specific date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558518#M2007473</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;Here is a snippet I built, that I had pasted earlier, but the formatting got muddled up when I edited it...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS:&lt;BR /&gt;  get_nth  TYPE numc2,  "01st/02nd/03rd/04th/05th&lt;BR /&gt;  this_day TYPE numc2,  "01 M/02 T/../07 Su&lt;BR /&gt;  of_month TYPE numc2,  "01/02/../12&lt;BR /&gt;  in_year  TYPE gjahr.&lt;BR /&gt;&lt;BR /&gt;START-OF-SELECTION.&lt;BR /&gt;&lt;BR /&gt;  DATA:&lt;BR /&gt;    yearweek_of_month             TYPE kweek,&lt;BR /&gt;    monday_of_nth_week            TYPE scdatum,&lt;BR /&gt;    date_on_nth_this_day_of_month TYPE scdatum.&lt;BR /&gt;&lt;BR /&gt;  "CL_SCAL_UTILS=&amp;gt;DATE_GET_WEEK&lt;BR /&gt;  CALL FUNCTION 'DATE_GET_WEEK'&lt;BR /&gt;    EXPORTING&lt;BR /&gt;      date         = CONV scdatum( |{ in_year }{ of_month }01| )&lt;BR /&gt;    IMPORTING&lt;BR /&gt;      week         = yearweek_of_month&lt;BR /&gt;    EXCEPTIONS&lt;BR /&gt;      date_invalid = 1&lt;BR /&gt;      OTHERS       = 2.&lt;BR /&gt;* Jump to week&lt;BR /&gt;  yearweek_of_month = yearweek_of_month + get_nth - '01'.&lt;BR /&gt;&lt;BR /&gt;* Monday of this week&lt;BR /&gt;  "CL_SCAL_UTILS=&amp;gt;WEEK_GET_FIRST_DAY&lt;BR /&gt;  CALL FUNCTION 'WEEK_GET_FIRST_DAY'&lt;BR /&gt;    EXPORTING&lt;BR /&gt;      week         = yearweek_of_month&lt;BR /&gt;    IMPORTING&lt;BR /&gt;      date         = monday_of_nth_week&lt;BR /&gt;    EXCEPTIONS&lt;BR /&gt;      week_invalid = 1&lt;BR /&gt;      OTHERS       = 2.&lt;BR /&gt;  date_on_nth_this_day_of_month = monday_of_nth_week + this_day - '01'.&lt;BR /&gt;&lt;BR /&gt;  WRITE: date_on_nth_this_day_of_month.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Nov 2021 00:52:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558518#M2007473</guid>
      <dc:creator>Nikhil_Rao_ABAP</dc:creator>
      <dc:date>2021-11-15T00:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate a specific date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558519#M2007474</link>
      <description>&lt;P&gt;Hello Ozgur,&lt;/P&gt;&lt;P&gt; Thanks for the appreciation, just realised that the snippet above may not necessarily yield the exact results, because it depends on the semantics of our question. ( e.g. I tried the 01(st), 02(Tuesday) of 10(Oct) of 2021... and this logic actually returned the 28.09.2021 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; ... the expected answer is 05.10.2021(although we notice that it is in the second week of Oct)..... but I hope the methods/functions mentioned above can assist you to build a more robust logic. One painful but bulletproof way is reconstruct the month in the internal table( dates &amp;amp; days) and then run your logic on that table..... or tweak around with the math in the logic by finding which day is the 1st of the month and working forwards from it...&lt;/P&gt;&lt;P&gt;Hope this helps more than the snippet did!!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 11:27:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculate-a-specific-date/m-p/12558519#M2007474</guid>
      <dc:creator>Nikhil_Rao_ABAP</dc:creator>
      <dc:date>2021-11-15T11:27:29Z</dc:date>
    </item>
  </channel>
</rss>

