<?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: system date calculation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209105#M133030</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello manish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the function module BKK_ADD_MONTH_TO_DATE to add certain number of months to a date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subtracting 180 days would be a crude way as 6 months is not equal 180 days in most of cases. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modifying the month's digits directly would lead to numerous errors like having 31 in months that actually have 30 days or less,... etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best bet would be use sap provide FM, which would take care of all exceptions..&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;Regards,&lt;/P&gt;&lt;P&gt;Nagaraju Chidurupalli&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Apr 2006 12:51:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-04-16T12:51:24Z</dc:date>
    <item>
      <title>system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209103#M133028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i want to manipulate the system date..&lt;/P&gt;&lt;P&gt;fetch the data the date which is enter on selection screen - previous 6 month data.&lt;/P&gt;&lt;P&gt;how i will manipulate the month of system date.&lt;/P&gt;&lt;P&gt;is there any function module for that??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;P&gt;Manish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 11:38:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209103#M133028</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-16T11:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209104#M133029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; You can directly seperate the date to go back to 6 month date. No need of a Function module. You can directly subtract the system date by the 180 days which will give you a 6 month back date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Incase you want to modify the 2 character month value then you may use the string modifiers like sy-datum+4(2) to get the month as the date is stored in YYYYMMDD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Hope this helps. If you need anyspecific logic feel free to let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Cheers&lt;/P&gt;&lt;P&gt; VJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 12:00:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209104#M133029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-16T12:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209105#M133030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello manish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the function module BKK_ADD_MONTH_TO_DATE to add certain number of months to a date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subtracting 180 days would be a crude way as 6 months is not equal 180 days in most of cases. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modifying the month's digits directly would lead to numerous errors like having 31 in months that actually have 30 days or less,... etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best bet would be use sap provide FM, which would take care of all exceptions..&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;Regards,&lt;/P&gt;&lt;P&gt;Nagaraju Chidurupalli&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 12:51:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209105#M133030</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-16T12:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209106#M133031</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; Yes i agree with Nagraju. FM is a better ways at times but not all the time. If the date calculation is carried out in a loop then it doesnt make sense to use a FM and slow down the performance of the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Again it all depends on whats the actual requirment. If its a general report where you need to give a window period of 6 months to restrict huge data selection then going 180 days back would makes sense. If the requirement is to find the exact 6 month period for financial calculations then a FM is a better bet. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; So i leave it you to descide the best approach. Cheers&lt;/P&gt;&lt;P&gt; VJ&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Vijayendra  Rao&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 13:29:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209106#M133031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-16T13:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209107#M133032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Welcome to SDN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use this FM &amp;lt;b&amp;gt;RP_CALC_DATE_IN_INTERVAL&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: wa_date like sy-datum.
 
call function 'RP_CALC_DATE_IN_INTERVAL'
         exporting
              date      = sy-datum
              days      = 0
              months    = 6
              signum    = '-'
              years     = 0
         importing
              calc_date = wa_date.

*This will give you the month 
write: / wa_date+4(2). 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 13:35:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209107#M133032</guid>
      <dc:creator>ferry_lianto</dc:creator>
      <dc:date>2006-04-16T13:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209108#M133033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Manish,&lt;/P&gt;&lt;P&gt;       Make use of the FM CCM_GO_BACK_MONTHS.You can obtain the exact date as of 6 months back or any number of months for that matter from the date that is entered on the selection-screen.Use the date returned from the FM to obtain the date range.Then use these dates to extract the data that you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Nishanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 14:49:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209108#M133033</guid>
      <dc:creator>nishanthbhandar</dc:creator>
      <dc:date>2006-04-16T14:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209109#M133034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ferry Lianto ,&lt;/P&gt;&lt;P&gt;Thanks for your immediate reply,&lt;/P&gt;&lt;P&gt;this F.M. might help for me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Manish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 15:30:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209109#M133034</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-16T15:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209110#M133035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nishanth &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your  reply,&lt;/P&gt;&lt;P&gt;now i can use both as you and ferry suggested both looks okay for my requirement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Manish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 15:38:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209110#M133035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-16T15:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: system date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209111#M133036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;VJ - you have to be careful when working with dates. Six months back isn't necessarily 180 days. If you subtract 180 days from 2006/04/16, you end up with 2005/10/18. If you subtract 6 months using the function module you get 2005/10/16.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the users would expect the latter in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having said that, I agree that there is overhead when calling a function module and here, it would be simple enough to do in the same program code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: year(4)  TYPE n,
      month(2) TYPE n,
      day(2)   TYPE n,
      then     LIKE sy-datum.

IF sy-datum+4(2) &amp;gt; 6.
  year  = sy-datum(4).
  month = sy-datum+4(2) - 6.
ELSE.
  year  = sy-datum(4) - 1.
  month = sy-datum+4(2) + 6.
ENDIF.
day = sy-datum+6(2).
CONCATENATE year month day INTO then.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Apr 2006 18:57:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/system-date-calculation/m-p/1209111#M133036</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-16T18:57:57Z</dc:date>
    </item>
  </channel>
</rss>

