Page 1 of 1

Calculate new date/time considering workday and shift

PostPosted: Thu Jul 16, 2015 4:06 am
by kim01
Hello,

how can I calulate from a given date/time and a duration (minutes), the next date/time, considering workdays and shift program.
I tried it with

CALL FUNCTION 'CR_CAPACITY_AVAILABLE'
EXPORTING
datuv = i_datum
kapid = lv_kapid
duration = lv_duration

but there is no input parameter for time and the duration knows only days.

Thanks in advance for any help.

Regards Wolfgang

Resolved: Calculate new date/time considering workday and sh

PostPosted: Thu Aug 13, 2015 1:43 am
by kim01
Hi,
I did it now with FM :

CALL FUNCTION 'CX_SCHED_VIA_OPERATING_TIME'
EXPORTING
i_date_start = i_datum
i_time_start = i_zeit
* I_DATE_END = '00000000'
* I_TIME_END = '240000'
* I_POINT_IN_TIME_START = 0
* I_POINT_IN_TIME_END = 0
* I_DURATION = 0
i_duration_sec = lv_duration "in seconds
i_unit = 'S'
i_unit_exp = ' '
i_arbid = <order>-arbid
* i_fcalid = i_fcalid
* I_PERNR =
i_kapid = lv_kapid
* i_versa = i_versa
i_flg_exact_breaks = 'X'
i_flg_no_calendar = ' '
i_flg_cap_scheduling = ' '
i_flg_efz = ' '
IMPORTING
e_date_start = e_date_start
e_time_start = e_time_start
e_date_end = e_date_end
e_time_end = e_time_end
e_point_in_time_start = e_point_in_time_start
e_point_in_time_end = e_point_in_time_end
e_duration = e_duration
e_duration_sec = e_duration_sec
e_unit = e_unit
e_min_num_capacities = e_min_num_capacities
e_message_code = e_message_code
EXCEPTIONS
parameters_not_valid = 1
OTHERS = 2.
IF sy-subrc <> 0.
RAISE error.
ENDIF.
*------------------------------------------------------------
o_datum = e_date_end.
o_zeit = e_time_end.
RETURN. "leave function with the result

Regards
Wolfgang