Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How i can get current year

Former Member

Hi,

How i can get current year only , is any variable is there to get only curren year only

1 ACCEPTED SOLUTION

Former Member

Hi,

sy-datum contains 20071031 (current data).

sy-datum(4) contains 2007 (current year).

sy-datum+4(2) contains 10 (current month).

sy-datum+6(2) contains 31 (current day).

rgs

5 REPLIES 5

Former Member
0 Kudos

Hi,

Use sy-datum+0(4).

Regards,

Atish

kesavadas_thekkillath
Active Contributor
0 Kudos

current date holds your current year.

so get year from date.

data:year(4)

year = sy-datum+0(4).

reward if usefull.

Former Member
0 Kudos

Hi Udhay,

use this.

data : ws_year(4) type c.

ws_year = sy-datum+0(4).

Reward If Useful.

Regards,

Chitra

Former Member

Hi,

sy-datum contains 20071031 (current data).

sy-datum(4) contains 2007 (current year).

sy-datum+4(2) contains 10 (current month).

sy-datum+6(2) contains 31 (current day).

rgs

Former Member
0 Kudos

hi,

either use :

sy-datum+0(4)

use this function:

PERIOD_AND_DATE_CONVERT_OUTPUT Conversion of a date with period specification with output. Import : YYYYMMDD (Internal Date), Language, Country, Internal Period;

1 MM/DD/YYYY

2 WW/YYYY Week

3 MM/YYYY Month

for various formats.

from these u can retrieve the year.

regards,

sohi