<?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 calculation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544220#M852598</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; I am not clear with your question. But as far i have inderstood that you want to get an output as a date that is the last working day of the previous month. Let me to explain a logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : date1 like sy-datum,&lt;/P&gt;&lt;P&gt;         date2 like sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date1 = sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;say for example as per your question the date is in between 1 and 7. So say date1 as 05.3.2008.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date2 = date1 -date1+6(2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you the date which is one month before for the date1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then use a function module as RTP_US_API_MAX_DAYS_IN_MONTH. This will give you the maximum days of the month. So you will get the maximum days for the given month. Then use the table as TFACS. It is the table which is for factory calendar. In the record sets of the table '1' stands for working day and '0' stands for holiday. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence you  can derive the date as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sanki.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Mar 2008 08:47:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-28T08:47:03Z</dc:date>
    <item>
      <title>Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544217#M852595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please anyone tell is there any FM available for this date calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The requirement is:&lt;/P&gt;&lt;P&gt;If the SY-DATUM is between 1st and 7th of current month, E1EDK03 / DATUM should be the last business day of previous month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Sankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:03:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544217#M852595</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544218#M852596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shankar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to put a condition for checking if the sy-datum is between the first date and seveth date of the month. Which you can easily do using IF statement with GT and LT operators.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your condition is true then do the below mentioned activities.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For getting the last date of the previous month subtract month from the date.Use the below mentioned FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BKK_ADD_MONTH_TO_DATE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass current date and use -1 for getting the similar date on last month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the function module which you can use to assign it to the field you mentioned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATE_GET_MONTH_LASTDAY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass the date you got from previous FM to this FM and you will get the last day of previous month.&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;Mayank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:16:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544218#M852596</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544219#M852597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Get the last day of the month by using the following FMs.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BKK_GET_MONTH_LAS&lt;/STRONG&gt;TDAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use the FM &lt;STRONG&gt;RKE_SELECT_FACTDAYS_FOR_PERIOD&lt;/STRONG&gt; to get the list of all work days available in that month. Pass the 1st day of the month, last day of the month and the factory calender that will indicate the work days and holiday days also suiting your rqmt. From that get the last working day.&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;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:41:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544219#M852597</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544220#M852598</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; I am not clear with your question. But as far i have inderstood that you want to get an output as a date that is the last working day of the previous month. Let me to explain a logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : date1 like sy-datum,&lt;/P&gt;&lt;P&gt;         date2 like sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date1 = sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;say for example as per your question the date is in between 1 and 7. So say date1 as 05.3.2008.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date2 = date1 -date1+6(2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you the date which is one month before for the date1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then use a function module as RTP_US_API_MAX_DAYS_IN_MONTH. This will give you the maximum days of the month. So you will get the maximum days for the given month. Then use the table as TFACS. It is the table which is for factory calendar. In the record sets of the table '1' stands for working day and '0' stands for holiday. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence you  can derive the date as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sanki.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:47:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/3544220#M852598</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:47:03Z</dc:date>
    </item>
  </channel>
</rss>

