Application Development and Automation 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: 
Read only

passing time to a variable

Former Member
0 Likes
1,637

dear experts,

My requirement is to not execute one step in the program when the day is Thursday and time is before 1pm. so after 1pm it should execute as usual.

The program runs every 2 hours and on all days.


The problem I am facing is the value I am passing to a time variable is not working.Because with this value I need to compare the system time.

Data : tv_day like scal-indicator,
           tv_time type syst-uzeit.

  CALL FUNCTION 'DATE_COMPUTE_DAY'
    EXPORTING
      date = sy-datum
    IMPORTING
      day  = tv_day. " Here I am getting the value 4 for Thursday

*Now I am passing the time to a variable.
tv_time = 130000.  " Here is the problem , the value actually coming to tv_time is 120640.Which is wrong.

*But when I pass tv_time = sy-uzeit , it is taking the correct value.

*Even I tried with keeping the value in single quotes '130000' but not working.

If tv_date eq 4 and sy-uzeit lt tv_time.

Dont execute.

Else.
Execute.
Endif.

Please also tell me is there a better way of writing this code

1 ACCEPTED SOLUTION
Read only

former_member184158
Active Contributor
0 Likes
1,297

Hi,.

it works, when you do like this,

        tv_time = '130000'

2 REPLIES 2
Read only

roberto_vacca2
Active Contributor
0 Likes
1,297

Hi.

You should use this and edit positions of TSTMP (last 6 chars). You convert SY-UZEIT in an editable data and after you can compare with 130000... Timestamp is a standard function


DATA: tstmp  LIKE  TZONREF-TSTAMPS

.

CALL FUNCTION 'CONVERT_INTO_TIMESTAMP'

   EXPORTING

     I_DATLO           = sy-datum

     I_TIMLO           = sy-uzeit

*   I_TZONE           = SY-ZONLO

  IMPORTING

    E_TIMESTAMP       = tstmp

Hope to help

Bye

Read only

former_member184158
Active Contributor
0 Likes
1,298

Hi,.

it works, when you do like this,

        tv_time = '130000'