‎2007 Jun 11 8:55 AM
hi experts,
i need system year. can we take year alone from sy-datum or is there some other field like sy-year?????
‎2007 Jun 11 8:57 AM
HI,
try
write: sy-datum+0(4).
reward points if helpful
regards,
venkatesh
‎2007 Jun 11 8:56 AM
Hi,
SY_DATUM is the only field in SYST table to get the date. You can extract the year from sy-datum.
write: sy-datum+0(4).
Regards,
Richa
‎2007 Jun 11 8:57 AM
HI,
try
write: sy-datum+0(4).
reward points if helpful
regards,
venkatesh
‎2007 Jun 11 8:57 AM
hi,
I think we need to take the year from Sy-DATUM only.There is no seperate system field for current year.
‎2007 Jun 11 9:00 AM
Hi,
We can take the system year only from the System Date.For that try the following report program.
REPORT demo_field_symbols_casting.
TYPES: BEGIN OF t_date,
year(4) TYPE n,
month(2) TYPE n,
day(2) TYPE n,
END OF t_date.
FIELD-SYMBOLS <fs> TYPE t_date.
ASSIGN sy-datum TO <fs> CASTING.
WRITE / sy-datum.
SKIP.
WRITE: / <fs>-year
Regards,
Padmam.
‎2007 Jun 11 9:00 AM
‎2007 Jun 11 9:13 AM
Hi Muruga,
The date in ABAP is internally stored as YYYYMMDD.
use date+0(2).
this will surely solve your problem.
‎2007 Jun 11 9:59 AM
System date is stored as YYYYMMDD.
So to extract the year from the System date, you can write:
sy-datum+0(4)
This will extract the system date's year.
You can write the following short code to check also:-
data: v_date type date.
write:/ sy-datum.
v_date = sy-datum+0(4).
write:/ v_date.
v_date will fetch the year.
Regards,
Sangeeta.