<?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: calculation on year in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394346#M1044774</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS : p_date TYPE sy-datum.
DATA:


date TYPE sy-datum,
wa_year TYPE i,
wa_month TYPE i,
wa_ext(4) TYPE c VALUE '.txt',
v_result(18) TYPE c.

date = p_date.

wa_year = date+0(4).
wa_month = date+4(2).

IF wa_month &amp;lt; 12 AND wa_month &amp;gt; 4.
  wa_month = '2008'.
  date+0(4) = wa_month.
ELSE.
  wa_month = '2007'.
  date+0(4) = wa_month.
ENDIF.

WRITE date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Aug 2008 11:13:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-27T11:13:37Z</dc:date>
    <item>
      <title>calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394339#M1044767</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;if  the current date falls between april and december,the year should be same year and if the current date falls between january to march,year should be previous year.For example&lt;/P&gt;&lt;P&gt;if the date is 23.5.2008, year  = 2008 and if the date is 23.3.2008,year = 2007&lt;/P&gt;&lt;P&gt;23.3.2009,year = 2008. how can i program this.Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:04:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394339#M1044767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394340#M1044768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; if  the current date falls between april and december,the year should be same year and if the current date falls between january to march,year should be previous year.For example&lt;/P&gt;&lt;P&gt;&amp;gt; if the date is 23.5.2008, year  = 2008 and if the date is 23.3.2008,year = 2007&lt;/P&gt;&lt;P&gt;&amp;gt; 23.3.2009,year = 2008. how can i program this.Please help.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Thanks,&lt;/P&gt;&lt;P&gt;&amp;gt; K Srinivas&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : l_date type d,
         l_month(2) type n.
         l_year(4) type n.

l_date = sy-datum.
l_month = sy-datum+4(2).
l_year = sy-datum(4).

if l_month &amp;lt;= 3.
l_year = l_year - 1.
endif.


write l_year.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:07:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394340#M1044768</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394341#M1044769</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;if date+4(2) le '03'.&lt;/P&gt;&lt;P&gt; date&lt;EM&gt;0(4) =  date&lt;/EM&gt;0(4) - 1.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ananth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:07:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394341#M1044769</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394342#M1044770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data : l_date type d,&lt;/P&gt;&lt;P&gt;         l_month(2) type n.&lt;/P&gt;&lt;P&gt;         l_year(4) type n.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;l_date = sy-datum.&lt;/P&gt;&lt;P&gt;l_month = sy-datum+4(2).&lt;/P&gt;&lt;P&gt;l_year = sy-datum(4).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;if l_month LE 3.&lt;/P&gt;&lt;P&gt;l_year = l_year - 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;write l_year.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:10:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394342#M1044770</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394343#M1044771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the fm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : year(4).

CALL FUNCTION 'GM_GET_FISCAL_YEAR'
  EXPORTING
   I_DATE                           = SY-DATUM
    I_FYV                            = 'V3'
 IMPORTING
   E_FY                             = year
 EXCEPTIONS
   FISCAL_YEAR_DOES_NOT_EXIST       = 1
   NOT_DEFINED_FOR_DATE             = 2
   OTHERS                           = 3
          .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

write : / year.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394343#M1044771</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394344#M1044772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dude,&lt;/P&gt;&lt;P&gt;Here is the Solution for this.&lt;/P&gt;&lt;P&gt;U use the FM RKE_CONVERT_DATE_TO_PERIOD.&lt;/P&gt;&lt;P&gt;pass the parameters as follows,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Import parameters           Value&lt;/P&gt;&lt;P&gt; DATE                            22.02.2008&lt;/P&gt;&lt;P&gt; PERFLAG                         1&lt;/P&gt;&lt;P&gt; PERIV                           V3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U will get the output as,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Export parameters           Value&lt;/P&gt;&lt;P&gt; PERIO                           011.2007&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U take the PERIO+4(4) so 2007 will come because DATE is in &lt;/P&gt;&lt;P&gt;2nd month.&lt;/P&gt;&lt;P&gt;if Date is say 4th month we will get 2008.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves UR problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:12:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394344#M1044772</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394345#M1044773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Srini,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data:
w_date type sy-datum,
w_year(4) type n,
w_year1(4) type n,
w_month(2) type n.

w_date = sy-datum.

w_month = w_date+4(2).
w_year = w_date(4).

if w_month ge 03.
 w_year1 = w_year.
else.
 w_year1 = w_year + 1.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandra Sekhar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chandrasekhar Gandla on Aug 27, 2008 4:49 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:13:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394345#M1044773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394346#M1044774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS : p_date TYPE sy-datum.
DATA:


date TYPE sy-datum,
wa_year TYPE i,
wa_month TYPE i,
wa_ext(4) TYPE c VALUE '.txt',
v_result(18) TYPE c.

date = p_date.

wa_year = date+0(4).
wa_month = date+4(2).

IF wa_month &amp;lt; 12 AND wa_month &amp;gt; 4.
  wa_month = '2008'.
  date+0(4) = wa_month.
ELSE.
  wa_month = '2007'.
  date+0(4) = wa_month.
ENDIF.

WRITE date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:13:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394346#M1044774</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394347#M1044775</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;Pls try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: wa_date like sy-datum.
data: month(2),      
      year(4),
      int_mnth type int2,
      int_yr type int4,
      int_yr_temp type int4.
     
move sy-datum to wa_date.

month = wa_date+4(2).
year = wa_date+0(4).

move month to int_mnth.
move year to int_yr_temp.

if ( int_mnth GE 4 and int_mnth LE 12).
move year to iny_yr.
else.
int_yr_temp = int_yr_temp - 1.
move int_yr_temp  to iny_yr.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anversha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:16:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394347#M1044775</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2008-08-27T11:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394348#M1044776</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;PRE&gt;&lt;CODE&gt;SELECT-OPTIONS:
    s_dat FOR sy-datum.

DATA :
  w_p1 TYPE i,
  w_p2 TYPE i.



w_p1 = s_dat-low+4(2).
w_p2 = s_dat-high+4(2).

IF w_p1 GT 5 AND w_p2 LT 12.
  WRITE : /'YEar 2008'.
ELSEIF w_p1 GT 1 AND w_p2 LT 5.
  WRITE :
   / '2007'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:16:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394348#M1044776</guid>
      <dc:creator>bpawanchand</dc:creator>
      <dc:date>2008-08-27T11:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: calculation on year</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394349#M1044777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the current date falls between april and december,the year should be same year and if the current date falls between january to march,year should be previous year.For example&lt;/P&gt;&lt;P&gt;if the date is 23.5.2008, year = 2008 and if the date is 23.3.2008,year = 2007&lt;/P&gt;&lt;P&gt;23.3.2009,year = 2008. how can i program this.Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K Srinivas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hey Srinivas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe this should help...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: lv_var type i,
        lv_date type sy-datum.

   lv_date = sy-datum.



      lv_var = lv_date+4(2).

      if lv_var &amp;gt; 3 and lv_date &amp;lt; 12.
       
      else.

              lv_date+0(4) = lv_date+0(4) - 1.

      endif.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Vishnu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 11:25:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculation-on-year/m-p/4394349#M1044777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T11:25:03Z</dc:date>
    </item>
  </channel>
</rss>

