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: 

To determine shift timing based on a time stamp field

Former Member
0 Kudos
253

Hi all,

I have an issue with a determing shift timings.

I have a time stamp field QALS-ENTSTEZEIT which has a value like 17:22:29.

Now based on this I have to determine the shifts.

There will be 3 shifts.

shift 1 between 08:00:00 to 16:00:00

shift 2 between 16:00:00 to 00:00:00

shift 3 between 00:00:00 to 08:00:00.

Now the issue is :this statement,

QALS-ENTSTEZEIT BETWEEN '00:00:01' AND '08:00:00'.

do not triggered.

Please suggest some solution.

Thanks and Regards

Nazmul

1 ACCEPTED SOLUTION

Former Member
0 Kudos
123

Hi Nazmul,

You told that you have time stamp field QALS-ENTSTEZEIT which has a value like 17:22:29.

Is this field on the Selection screen and that value is Default value.

If the above scenario is correct then you have the concept of ranges for a selection field.

Revert for any clarification.

Thanks and Regards

Srikanth.P

9 REPLIES 9

Former Member
0 Kudos
123

Hi,

Try using Ranges and populate as '00:00:01' BT '08:00:00' . Now use this in condition as;

IN ranges_time

Regards

Karthik D

Former Member
0 Kudos
124

Hi Nazmul,

You told that you have time stamp field QALS-ENTSTEZEIT which has a value like 17:22:29.

Is this field on the Selection screen and that value is Default value.

If the above scenario is correct then you have the concept of ranges for a selection field.

Revert for any clarification.

Thanks and Regards

Srikanth.P

0 Kudos
123

Hi Srikant,

The QALS-ENTSTEZEIT is not a selection screen fields.Its a field in one of the defined internal table of mine.

Regards

Nazmul

0 Kudos
123

Have you tried my suggestion? I hope it will solve your problem...

Regards

Karthik D

0 Kudos
123

Hi Karthik,

I have tried your suggestion.Its working to some extent.

I have defined 3 ranges

1. R_T1 populated with '08:00:00' BT '16:00:00'.

2. R_T2 populated with '16:00:00' BT '00:00:01'.

3. R_T3 populated with '00:00:01' BT '08:00:00'.

Now for the value '17:22:59' its going to the R_T1 case while it should go to R_T2 case.

Regards

Nazmul

0 Kudos
123

Can you post the part of code which checks the timings?

Regards

Karthik D

0 Kudos
123

Hi Karthik,

Here it is...

V_TIME = FS_QALS-ENTSTEZEIT.

CONCATENATE V_TIME0(2) ':' V_TIME2(2) ':' V_TIME+4(2) INTO V_TIME.

IF V_TIME IN R_T1.

SHIFT = '1'.

ELSEIF V_TIME IN R_T2 .

SHIFT = '2'.

ELSEIF V_TIME IN R_T3.

SHIFT = '3'.

ENDIF.

Regards

Nazmul

0 Kudos
123

Hi,

Try the below code, it may solve your problem.

Data : V_TIME type QALS-ENTSTEZEIT, shift.
Ranges : R_T1 for QALS-ENTSTEZEIT , R_T2 for QALS-ENTSTEZEIT, R_T3 for QALS-ENTSTEZEIT.
R_T1-SIGN = 'I'.
R_T1-option = 'BT'.
R_T1-LOW = '080000'.
R_T1-HIGH = '160000'.
APPEND R_T1.

R_T2-SIGN = 'I'.
R_T2-option = 'BT'.
R_T2-LOW = '160000'.
R_T2-HIGH = '235959'. " Change like this, its not much difference from 000001 but seems to be working
APPEND R_T2.

R_T3-SIGN = 'I'.
R_T3-option = 'BT'.
R_T3-LOW = '000001'.
R_T3-HIGH = '080000'.
APPEND R_T3.


V_TIME = '172259'. " u can assign QALS-ENTSTEZEIT directly to v_time

*CONCATENATE V_TIME+0(2) ':' V_TIME+2(2) ':' V_TIME+4(2) INTO V_TIME. "no need for this

IF V_TIME IN R_T1.
SHIFT = '1'.
ELSEIF V_TIME IN R_T2 .
SHIFT = '2'.
ELSEIF V_TIME IN R_T3.
SHIFT = '3'.
ENDIF.

Check and revert back.

Regards

Karthik D

0 Kudos
123

Thanks a lot Karthik....Its working...