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: 

Capturing the date/time value into variables

Former Member
0 Kudos

Hi,

I am trying to pick up the system time and date into a variable as follows.

DATA: v_uzeit type sy-uzeit.

v_uzeit = sy-uzeit.

I have written this code in a function module and in debug mode I am not able to get the system time in the variable.

Please provide pointers.

Thanks in advance,

Regards,

Amit Deshpande

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Amit

I have tried your code and it works fine for me in debug mode. Are you absoutley sure that it is not working i.e. you don't have similar named variables that are causing confusion? When you say you are not getting the system time are you geting any errors or is it just that the variable is blank? What is the sy-subrc value after the assignment?

Kind regards

Andy

Message was edited by: Andrew Wright

Actually, Anver raises a valid point, sy-uzeit is the current application server time while sy-timlo is your local time - make sure you are using the correct one!

7 REPLIES 7

anversha_s
Active Contributor
0 Kudos

hi,

use sy-TIMLO.

rgds

anver

0 Kudos

DATA: v_uzeit like sy-uzeit.
v_uzeit = sy-uzeit.
write: v_uzeit.

Former Member
0 Kudos

Hi Amit

I have tried your code and it works fine for me in debug mode. Are you absoutley sure that it is not working i.e. you don't have similar named variables that are causing confusion? When you say you are not getting the system time are you geting any errors or is it just that the variable is blank? What is the sy-subrc value after the assignment?

Kind regards

Andy

Message was edited by: Andrew Wright

Actually, Anver raises a valid point, sy-uzeit is the current application server time while sy-timlo is your local time - make sure you are using the correct one!

Former Member
0 Kudos

hi, is there any value in the system variable?

Regards

Nishant

Former Member
0 Kudos

Hi Andrew and Nishant,

Thank you for the reply.

The sy-subrc is returning zero as the v_uzeit and sy-uzeit are having blank values.

I am confused as to why sy-uzeit is taking blank values.

Also i tried to write a REPORT and it gives me right value of sy-uzeit. Its only in my FM that is it fails.

Regards,

Amit

0 Kudos

Hi Amit,

Just to confirm two things,

can you check if in debug the syst table fields are having values or not. basically for sy-timlo.

I am not very sure since uzeit is application server time so it should have been there.

Regards

Nishant

0 Kudos

Hi Amit

I have just created a FM that does nothing except assign sy-uzeit to v_uzeit and when called from another program it works fine. In Debug both the system field and the variable contain data. I can't understand why your system time would be blank in the FM and be OK in your program. How big is your FM, could you post it here for us to review?

Kind regards

Andy