07-15-2014 8:23 AM
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.
07-15-2014 8:26 AM
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
07-15-2014 8:34 AM
Hi
yes fred i am asking about the offset only is that is standard or what
regards,
Maha
07-15-2014 8:42 AM
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
07-15-2014 8:37 AM
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
07-15-2014 8:42 AM
07-15-2014 8:45 AM
07-15-2014 5:33 PM
I am locking this thread because the question is too basic and it has been answered several times before.
06-14-2023 12:51 PM
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
06-14-2023 1:21 PM
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.