<?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: looking for date function in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150225#M117328</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so are you confirming that you want to find the last year's last date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if yes , the solution given by suresh and max is dynamic. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your requirement is something else, explain it bit clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 01 Jan 2006 11:54:59 GMT</pubDate>
    <dc:creator>athavanraja</dc:creator>
    <dc:date>2006-01-01T11:54:59Z</dc:date>
    <item>
      <title>looking for date function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150221#M117324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i'm lokking for a function that give me the date year before' example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;01-05-2005&lt;/P&gt;&lt;P&gt;i want to get 01-01-2005------01-05-2005&lt;/P&gt;&lt;P&gt;          and 01-05-2005------31-12-2004&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Jan 2006 10:36:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150221#M117324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-01T10:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: looking for date function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150222#M117325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Liat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from what I could understand you are trying to get the last date of the previous year. try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: w_date type sydatum value '20050501',&lt;/P&gt;&lt;P&gt;      w_year(4).&lt;/P&gt;&lt;P&gt;w_year = w_date+0(4).&lt;/P&gt;&lt;P&gt;w_year = w_year - 1.&lt;/P&gt;&lt;P&gt;concatenate w_year '12' '31' into w_date.&lt;/P&gt;&lt;P&gt;write:/ w_date DD/MM/YYYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Jan 2006 11:21:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150222#M117325</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2006-01-01T11:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: looking for date function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150223#M117326</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 can't understand what you want to get. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want the last day of year before:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: YEAR TYPE GJAHR,&lt;/P&gt;&lt;P&gt;      DATE TYPE SY-DATUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: P_DATE LIKE SY-DATUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YEAR = P_DATE(4) - 1.&lt;/P&gt;&lt;P&gt;CONCATENATE GJAHR '1231'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm not sure you want this.&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: max bianchi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Jan 2006 11:22:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150223#M117326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-01T11:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: looking for date function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150224#M117327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the date 01052005&lt;/P&gt;&lt;P&gt; it's example it can be change all the time&lt;/P&gt;&lt;P&gt;becuase of that i need function to be more dinamic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Jan 2006 11:28:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150224#M117327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-01T11:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: looking for date function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150225#M117328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so are you confirming that you want to find the last year's last date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if yes , the solution given by suresh and max is dynamic. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your requirement is something else, explain it bit clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Jan 2006 11:54:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150225#M117328</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-01-01T11:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: looking for date function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150226#M117329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your example date is 01-05-2005. Can you tell us if it MM-DD-YYYY or DD-MM-YYYY?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From this input you want two ranges&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
First Range
  From Date of the range = 01-01-2005 (Begining date of the year of the input)
  To Date of the range = 01-05-005 (Input Date)
Second Range
  From Date of the range = 01-05-2005 (Input Date)
  To Date of the range = 31-12-2004 (Last Date of the previous year of the input year)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is where I am confused. Is it &amp;lt;b&amp;gt;2004&amp;lt;/b&amp;gt; or &amp;lt;u&amp;gt;2005&amp;lt;/u&amp;gt;? If it is 2004, then your To date is in the past than your From date which is not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming your input date is in the format of DD-MM-YYYY and internally it is type date field stored as YYYMMDD and the year of the To-Date for the second range is 2005, here is a solution. There is no function module that can do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS: P_INPUT LIKE SY-DATUM DEFAULT '20050501'.
DATA: V_BEGIN_OF_YEAR LIKE SY-DATUM,
      V_END_OF_YEAR LIKE SY-DATUM.

RANGES: R_RANGE1 FOR SY-DATUM,
        R_RANGE2 FOR SY-DATUM.

*-- Prepare the begin of the year of the input
CONCATENATE P_INPUT+0(4)
            '01'
            '01'
       INTO V_BEGIN_OF_YEAR.
*-- Prepare the end of the year of the input
CONCATENATE P_INPUT+0(4)
            '12'
            '31'
       INTO V_END_OF_YEAR.
*-- Prepare the range 1
R_RANGE1-LOW    = V_BEGIN_OF_YEAR.
R_RANGE1-HIGH   = P_INPUT.
R_RANGE1-OPTION = 'BT'.
R_RANGE1-SIGN   = 'I'.
APPEND R_RANGE1.

*-- Prepare the range 2
R_RANGE2-LOW    = P_INPUT.
R_RANGE2-HIGH   = V_END_OF_YEAR.
R_RANGE2-OPTION = 'BT'.
R_RANGE2-SIGN   = 'I'.
APPEND R_RANGE2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Srinivas Adavi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please close the thread if answered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Jan 2006 18:35:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150226#M117329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-01T18:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: looking for date function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150227#M117330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi liat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 what i undertand is that&lt;/P&gt;&lt;P&gt;  u want to SPLIT &lt;/P&gt;&lt;P&gt;  and GET ONE WHOLE YEAR&lt;/P&gt;&lt;P&gt;  with boundary of 31st December.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Try this code (just copy paste)&lt;/P&gt;&lt;P&gt;   it will give what u require.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; REPORT abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; PARAMETERS : dt TYPE sy-datum DEFAULT '20050501'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DATA : d1 TYPE sy-datum.&lt;/P&gt;&lt;P&gt; DATA : d2 TYPE sy-datum.&lt;/P&gt;&lt;P&gt; DATA : d3 TYPE sy-datum.&lt;/P&gt;&lt;P&gt; DATA : yyyy(4) TYPE n.&lt;/P&gt;&lt;P&gt; DATA : y1(4) TYPE n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt; yyyy = dt(4).&lt;/P&gt;&lt;P&gt; y1 = yyyy - 1.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------" /&gt;&lt;P&gt; CONCATENATE yyyy '0101' INTO d1.&lt;/P&gt;&lt;P&gt; CONCATENATE y1  dt+4(4) INTO d2.&lt;/P&gt;&lt;P&gt; CONCATENATE y1 '1231' INTO d3.&lt;/P&gt;&lt;P&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt; WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; d1 , ' -&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt; '  , dt.&lt;/P&gt;&lt;P&gt; WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; d2 , ' -&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt; '  , d3.&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jan 2006 04:47:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-date-function/m-p/1150227#M117330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-02T04:47:08Z</dc:date>
    </item>
  </channel>
</rss>

