<?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: Dates with month calculation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208371#M1005691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi purna &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do coding like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : v_date type datum,
l_date type datum,
v_durmm type PSEN_DURATION.
v_durmm-durmm = 6.
move sy-datum to v_date.


CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'
EXPORTING
IM_DATE = v_date
IM_OPERATOR = '-'
IM_DURATION = v_durmm
IMPORTING
EX_DATE = l_date.

write l_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOPE THIS HELPS U&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;P&gt;Tamilselvan.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jul 2008 07:05:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-23T07:05:16Z</dc:date>
    <item>
      <title>Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208367#M1005687</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;&lt;/P&gt;&lt;P&gt;Here is my query, i need to get the date for past 6 months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex : suppose if i have date 23.07.2008 i need to get the date 23.01.2008 as output can u suggest me where i comitted a mistake for below code as it is throughing short dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : v_date type datum,&lt;/P&gt;&lt;P&gt;       l_date type datum,&lt;/P&gt;&lt;P&gt;       v_durmm type PSEN_DURATION-durmm value 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move sy-datum to v_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    IM_DATE           = v_date&lt;/P&gt;&lt;P&gt;    IM_OPERATOR       = '-'&lt;/P&gt;&lt;P&gt;    IM_DURATION       = v_durmm&lt;/P&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   EX_DATE            = l_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write  l_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;poorna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 06:45:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208367#M1005687</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T06:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208368#M1005688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; can you mention the error what it is throwing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 06:50:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208368#M1005688</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T06:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208369#M1005689</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;Step 1: take the date like Sy-datum  in declaration.&lt;/P&gt;&lt;P&gt;Step 2: tkae the month by setting the offset 4(2) to the date.&lt;/P&gt;&lt;P&gt;Step 3: subtruct 6 from it.&lt;/P&gt;&lt;P&gt;You will get the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters:
p_date type sy-datum.

data:
temp_month type i.

temp_month = p_date+4(2) - 6.

p_date+4(2) = temp_month.

write:p_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change accordingly in your FM code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;anirban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 06:51:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208369#M1005689</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T06:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208370#M1005690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chandrika,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error analysis&lt;/P&gt;&lt;P&gt;    An exception occurred that is explained in detail below.&lt;/P&gt;&lt;P&gt;    The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was&lt;/P&gt;&lt;P&gt;     not caught and&lt;/P&gt;&lt;P&gt;    therefore caused a runtime error.&lt;/P&gt;&lt;P&gt;    The reason for the exception is:&lt;/P&gt;&lt;P&gt;    The call to the function module "HR_99S_DATE_ADD_SUB_DURATION" is incorrect:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    The function module interface allows you to specify only&lt;/P&gt;&lt;P&gt;    fields of a particular type under "IM_DURATION".&lt;/P&gt;&lt;P&gt;    The field "V_DURMM" specified here is a different&lt;/P&gt;&lt;P&gt;    field type&lt;/P&gt;&lt;P&gt;    .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 06:53:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208370#M1005690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T06:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208371#M1005691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi purna &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do coding like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : v_date type datum,
l_date type datum,
v_durmm type PSEN_DURATION.
v_durmm-durmm = 6.
move sy-datum to v_date.


CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'
EXPORTING
IM_DATE = v_date
IM_OPERATOR = '-'
IM_DURATION = v_durmm
IMPORTING
EX_DATE = l_date.

write l_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOPE THIS HELPS U&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;P&gt;Tamilselvan.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 07:05:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208371#M1005691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T07:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208372#M1005692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friend,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if i have month FEB then this logic will not be applicable, i am right?  date calcuation should be done dynamically as per the current date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex. if i run the report for every week and fetching the records for the past 6 months as of run date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;poorna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 07:09:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208372#M1005692</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T07:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208373#M1005693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friend,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done the same thing thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dont boughter you will get the points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;poorna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 07:10:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208373#M1005693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T07:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208374#M1005694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZSCD_TEST10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : v_date type datum,&lt;/P&gt;&lt;P&gt;l_date type datum,&lt;/P&gt;&lt;P&gt;v_durmm type PSEN_DURATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_durmm-DURMM = '6'.&lt;/P&gt;&lt;P&gt;v_date = sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;IM_DATE = v_date&lt;/P&gt;&lt;P&gt;IM_OPERATOR = '-'&lt;/P&gt;&lt;P&gt;IM_DURATION = v_durmm&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;EX_DATE = l_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write l_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pranu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 07:14:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208374#M1005694</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T07:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dates with month calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208375#M1005695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Purna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : v_date type datum,&lt;/P&gt;&lt;P&gt;l_date type datum,&lt;/P&gt;&lt;P&gt;v_durmm type PSEN_DURATION-durmm value 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move sy-datum to v_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'HR_99S_DATE_ADD_SUB_DURATION'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;IM_DATE = v_date&lt;/P&gt;&lt;P&gt;IM_OPERATOR = '-'&lt;/P&gt;&lt;P&gt;IM_DURATION = v_durmm&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;EX_DATE = l_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write l_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u double click on function 'HR_99S_DATE_ADD_SUB_DURATION' and then click the tab exporting &amp;amp; importing   to see what is the type of IM_DATE and EX_DATE  and then u declare  v_date and I_date of the same type ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope this will help u..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Ashu Singh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 07:40:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dates-with-month-calculation/m-p/4208375#M1005695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T07:40:37Z</dc:date>
    </item>
  </channel>
</rss>

