09-19-2006 5:08 PM
Hi Friends,
I am printing the system time in one of the forms. Now I have to reduce the time by two hours. Is it possible for me to change the time by doing 'SY-UZEIT - 2'. If not please suggest me as to how to achieve this.
Thanks,
Raj
09-19-2006 5:35 PM
Hi Raj!
How about using
write sy-uzeit TIME ZONE tz.
For tz, a data object of type TIMEZONE from the ABAP Dictionary must be specified. It must contain a time zone from the column TZONE of the database table TTZZ in uppercase letters. If tz is initial, the UTC reference time is output.
Have a look into the statement documentation for more details.
Regards,
Christian
09-19-2006 5:11 PM
Hi
SY-UZEIT is system time, so you can change it, I don't understand why you want to update it, but you can use a variable:
DATA: NEW_TIME TYPE SY-UZEIT.
A) Minus 2 second: NEW_TIME = SY-UZEIT - 2.
B) Minus 2 minute: NEW_TIME = SY-UZEIT - 120.
C) Minus 2 hours : NEW_TIME = SY-UZEIT - 7200.
Max
09-19-2006 5:11 PM
Hi,
data: v_time type syuzeit.
v_time = sy-uzeit - 7200.
write: / sy-uzeit.
write: /'Minus 2 hours - ', v_time.
Thanks,
Naren
09-19-2006 5:17 PM
I need to do this in the text editor. Can I use the same in the text editor?
Raj
09-19-2006 5:14 PM
data: time type sy-uzeit.
<b>Time = sy-uzeit - 7200.</b>
Regards,
Prakash.
09-19-2006 5:35 PM
Hi Raj!
How about using
write sy-uzeit TIME ZONE tz.
For tz, a data object of type TIMEZONE from the ABAP Dictionary must be specified. It must contain a time zone from the column TZONE of the database table TTZZ in uppercase letters. If tz is initial, the UTC reference time is output.
Have a look into the statement documentation for more details.
Regards,
Christian
09-19-2006 5:47 PM
Hi,
I believe you cannot declare time specific data type in the Sap script editor..
And it has to be done in the print program..
If you are having smartforms..you can do it initialization event..
THanks,
Naren
09-19-2006 5:54 PM
Hi
You can try to create a form and call it in the sapscript.
/: DEFINE &MY_TIME& = ' '
/: PERFORM CHANGE_TIME IN PROGRAM <Z....>
/: CHANGING &MY_TIME&
/: ENDPERFORM
In program Z.... you have to define the routine
FORM CHANGE_TIME TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
DATA: NEW_TIME TYPE SY-UZEIT.
READ TABLE OUT_TAB INDEX 1.
IF SY-SUBRC = 0.
NEW_TIME = SY-UZEIT - ......
WRITE NEW_TIME TO OUT_TAB-VALUE.
MODIFY OUT_TAB INDEX 1.
ENDIF.
ENDFORM.
Max
09-19-2006 7:19 PM
Just one more question. I am printing this time in text editor next to one more field. Do I use continuation or just define it from the next line.
Thanks,
Raj
09-19-2006 8:47 PM
Thanks Max. That solved my problem. I've awarded points to you.
Raj
09-21-2006 11:00 PM
Max,
I have a problem again. My company is located in US and in London. This form is being used even in London. Th server is taking London time and so for US orders I subtracted two hours from the system time. Now I need to add a condition in the program that the system takes the system time at London and subtract the two hours in USA. Can you give me the code for this.
Thanks,
Raj
09-22-2006 10:33 AM
Hi
I believe you should check the user data there you can find the Time zone of the user.
In the system variable SY-TZONE you have the time zone of the server and in SY-ZONLO user one.
Max
09-22-2006 5:23 PM
Max,
since I am trying to print the time, I have used SYST-TIMLO which is the local time of the user, but did not work. Would you suggest if that can be made to work?
Thanks,
Raj
09-22-2006 5:29 PM
Hi,
For sy-timlo see the documentation..
In the following cases, the local time cannot be calculated:
- The time zone has not been entered in the user master record
or
- The time zone in the user master record is invalid
or
- The time zones are inactive (table TTZCU).
If this happens, the system time (SYST-UZEIT) is returned.
Thanks,
Naren
09-22-2006 7:32 PM
Narendran,
My system is returning Sy-UZEIT same as you mentioned. What would be my other option? Please advice.
Thanks,
Raj