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: 

sy-datum why it is using y=4(2)

Former Member
0 Kudos

hi all ,

In sy-datum why it is using the year 6(4) like that  actually what it mean i know sy-datum is the actual system date  to extract the year month date  seperately dey r using and the same in gjahr is dey are using 4(2) what it means

With Thanks,

Mahalakshmi.

9 REPLIES 9

FredericGirod
Active Contributor
0 Kudos

Hi,

what is exactly your question ?

You speak about offset ?  +6(4) will not work with SY-DATUM, SY-DATUM have a length of 8.  YYYYMMDD 

regards

Fred

0 Kudos

Hi

yes fred i am asking about the offset only is that is standard or what

regards,

Maha

0 Kudos

Hi Mahalakshmi,

The Off-set is used to capture a part of existing string. Actually SY-DATUM hold the system date and its data type is of Char and length 8 with format YYYYMMDD.

So, now if we want Year from System date, we need to capture first four characters, so counting from 0 we need frist four. So, YEAR = SY-DATUM+0(4).

Same, for Month we need to capture 2 character from 4 (as count starts from 0).

MONTH = SY-DATUM+4(2).

Same for date, DATE = SY-DATUM+6(2).

Hope you got my explanation.

Regards,

Vijay

former_member183607
Contributor

HI,

     It is an Offset that means Extract Character starting from position <number outside paranthesis> till <number of charcters > inside paranthesis.

sydatum stores : date in format yyyymmdd

     so

     dt + 4(2) will give your mm value

     dt + 6(2) will give your dd value

     dt+0(4) will give your yyyy value

Regards

0 Kudos

hi shukla

     Thanks

Former Member
0 Kudos

Hi,

Thanks .Yep i got it now

Former Member
0 Kudos

I am locking this thread because the question is too basic and it has been answered several times before.

markus_winni
Discoverer
0 Kudos

Sorry for asking to such an old topic.

If I wanted to specify the next month, can I do it this way?

SY-DATUM+4(2) + 1

matt
Active Contributor

If you try it, you'll find you can't. Especially in december.

You should start a new question, rather than using "Your answer" to an old question.