SAP CX_SCHED_VIA_OPERATING_TIME Function Module for Scheduling using operating time
CX_SCHED_VIA_OPERATING_TIME is a standard cx sched via operating time SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Scheduling using operating time processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for cx sched via operating time FM, simply by entering the name CX_SCHED_VIA_OPERATING_TIME into the relevant SAP transaction such as SE37 or SE38.
Function Group: CXOT
Program Name: SAPLCXOT
Main Program: SAPLCXOT
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CX_SCHED_VIA_OPERATING_TIME pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'CX_SCHED_VIA_OPERATING_TIME'"Scheduling using operating time.
EXPORTING
* I_DATE_START = '00000000' "Start date (for forward scheduling)
* I_UNIT_EXP = ' ' "Unit of duration to be calculated (E_DURATION)
* I_ARBID = "Work center where operating time is defined
* I_FCALID = ' ' "Factory calendar (if no work center)
* I_PERNR = "Personnel no. for capacity calculation of person
* I_KAPID = "Capacity key for scheduling basis
* I_VERSA = "Version number of capacity (otherwise from KAKO)
* I_FLG_EXACT_BREAKS = ' ' "Control ind.: take breaks into account individually or in total
* I_FLG_NO_CALENDAR = ' ' "
* I_FLG_CAP_SCHEDULING = ' ' "Check capacity load (finite loading)
* I_FLG_EFZ = ' ' "
* I_TIME_START = '000000' "Start time (for forward scheduling)
* I_DATE_END = '00000000' "Finish date (for backward scheduling)
* I_TIME_END = '240000' "Finish time (for backward scheduling)
* I_POINT_IN_TIME_START = 0 "Start time (for forward scheduling)
* I_POINT_IN_TIME_END = 0 "Finish time (for backward scheduling)
* I_DURATION = 0 "Duration in unit I_UNIT
* I_DURATION_SEC = 0 "Duration in seconds
* I_UNIT = ' ' "Unit of duration (I_DURATION)
IMPORTING
E_DATE_START = "Calculated start date
E_MIN_NUM_CAPACITIES = "Number of available capacities (for splitting)
E_MESSAGE_CODE = "Code for message to be displayed (CX_F_MESSAGE)
E_TIME_START = "Calculated start time
E_DATE_END = "Calculated finish date
E_TIME_END = "Calculated finish time
E_POINT_IN_TIME_START = "Calculated start time
E_POINT_IN_TIME_END = "Calculated finish time
E_DURATION = "Calculated duration in unit I_UNIT_EXP
E_DURATION_SEC = "Calculated duration in seconds
E_UNIT = "Unit of calculated duration (E_DURATION)
EXCEPTIONS
PARAMETERS_NOT_VALID = 1
IMPORTING Parameters details for CX_SCHED_VIA_OPERATING_TIME
I_DATE_START - Start date (for forward scheduling)
Data type: AFVGD-FSAVDDefault: '00000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_UNIT_EXP - Unit of duration to be calculated (E_DURATION)
Data type: T006-MSEHIDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ARBID - Work center where operating time is defined
Data type: CRHD-OBJIDOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FCALID - Factory calendar (if no work center)
Data type: SCAL-FCALIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_PERNR - Personnel no. for capacity calculation of person
Data type: PCHDY-OBJIDOptional: Yes
Call by Reference: No ( called with pass by value option)
I_KAPID - Capacity key for scheduling basis
Data type: KBED-KAPIDOptional: Yes
Call by Reference: No ( called with pass by value option)
I_VERSA - Version number of capacity (otherwise from KAKO)
Data type: KAKO-VERSAOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FLG_EXACT_BREAKS - Control ind.: take breaks into account individually or in total
Data type: CX_BOOLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_FLG_NO_CALENDAR -
Data type: CX_BOOLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_FLG_CAP_SCHEDULING - Check capacity load (finite loading)
Data type: CX_BOOLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_FLG_EFZ -
Data type: CX_BOOLDefault: SPACE
Optional: Yes
Call by Reference: Yes
I_TIME_START - Start time (for forward scheduling)
Data type: AFVGD-FSAVZDefault: '000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_DATE_END - Finish date (for backward scheduling)
Data type: AFVGD-FSAVDDefault: '00000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TIME_END - Finish time (for backward scheduling)
Data type: AFVGD-FSAVZDefault: '240000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_POINT_IN_TIME_START - Start time (for forward scheduling)
Data type: CX_POINT_IN_TIMEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_POINT_IN_TIME_END - Finish time (for backward scheduling)
Data type: CX_POINT_IN_TIMEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_DURATION - Duration in unit I_UNIT
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
I_DURATION_SEC - Duration in seconds
Data type: CX_DURATION_SECOptional: Yes
Call by Reference: No ( called with pass by value option)
I_UNIT - Unit of duration (I_DURATION)
Data type: T006-MSEHIDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for CX_SCHED_VIA_OPERATING_TIME
E_DATE_START - Calculated start date
Data type: AFVGD-FSAVDOptional: No
Call by Reference: No ( called with pass by value option)
E_MIN_NUM_CAPACITIES - Number of available capacities (for splitting)
Data type: KAPA-ANZHLOptional: No
Call by Reference: No ( called with pass by value option)
E_MESSAGE_CODE - Code for message to be displayed (CX_F_MESSAGE)
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
E_TIME_START - Calculated start time
Data type: AFVGD-FSAVZOptional: No
Call by Reference: No ( called with pass by value option)
E_DATE_END - Calculated finish date
Data type: AFVGD-FSAVDOptional: No
Call by Reference: No ( called with pass by value option)
E_TIME_END - Calculated finish time
Data type: AFVGD-FSAVZOptional: No
Call by Reference: No ( called with pass by value option)
E_POINT_IN_TIME_START - Calculated start time
Data type: CX_POINT_IN_TIMEOptional: No
Call by Reference: No ( called with pass by value option)
E_POINT_IN_TIME_END - Calculated finish time
Data type: CX_POINT_IN_TIMEOptional: No
Call by Reference: No ( called with pass by value option)
E_DURATION - Calculated duration in unit I_UNIT_EXP
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
E_DURATION_SEC - Calculated duration in seconds
Data type: CX_DURATION_SECOptional: No
Call by Reference: No ( called with pass by value option)
E_UNIT - Unit of calculated duration (E_DURATION)
Data type: T006-MSEHIOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
PARAMETERS_NOT_VALID - Input parameter not valid
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for CX_SCHED_VIA_OPERATING_TIME Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_e_date_start | TYPE AFVGD-FSAVD, " | |||
| lv_i_date_start | TYPE AFVGD-FSAVD, " '00000000' | |||
| lv_parameters_not_valid | TYPE AFVGD, " | |||
| lv_i_unit_exp | TYPE T006-MSEHI, " SPACE | |||
| lv_e_min_num_capacities | TYPE KAPA-ANZHL, " | |||
| lv_i_arbid | TYPE CRHD-OBJID, " | |||
| lv_e_message_code | TYPE SY-SUBRC, " | |||
| lv_i_fcalid | TYPE SCAL-FCALID, " SPACE | |||
| lv_i_pernr | TYPE PCHDY-OBJID, " | |||
| lv_i_kapid | TYPE KBED-KAPID, " | |||
| lv_i_versa | TYPE KAKO-VERSA, " | |||
| lv_i_flg_exact_breaks | TYPE CX_BOOL, " SPACE | |||
| lv_i_flg_no_calendar | TYPE CX_BOOL, " SPACE | |||
| lv_i_flg_cap_scheduling | TYPE CX_BOOL, " SPACE | |||
| lv_i_flg_efz | TYPE CX_BOOL, " SPACE | |||
| lv_e_time_start | TYPE AFVGD-FSAVZ, " | |||
| lv_i_time_start | TYPE AFVGD-FSAVZ, " '000000' | |||
| lv_e_date_end | TYPE AFVGD-FSAVD, " | |||
| lv_i_date_end | TYPE AFVGD-FSAVD, " '00000000' | |||
| lv_e_time_end | TYPE AFVGD-FSAVZ, " | |||
| lv_i_time_end | TYPE AFVGD-FSAVZ, " '240000' | |||
| lv_e_point_in_time_start | TYPE CX_POINT_IN_TIME, " | |||
| lv_i_point_in_time_start | TYPE CX_POINT_IN_TIME, " 0 | |||
| lv_e_point_in_time_end | TYPE CX_POINT_IN_TIME, " | |||
| lv_i_point_in_time_end | TYPE CX_POINT_IN_TIME, " 0 | |||
| lv_e_duration | TYPE CX_POINT_IN_TIME, " | |||
| lv_i_duration | TYPE CX_POINT_IN_TIME, " 0 | |||
| lv_e_duration_sec | TYPE CX_DURATION_SEC, " | |||
| lv_i_duration_sec | TYPE CX_DURATION_SEC, " 0 | |||
| lv_e_unit | TYPE T006-MSEHI, " | |||
| lv_i_unit | TYPE T006-MSEHI. " SPACE |
|   CALL FUNCTION 'CX_SCHED_VIA_OPERATING_TIME' "Scheduling using operating time |
| EXPORTING | ||
| I_DATE_START | = lv_i_date_start | |
| I_UNIT_EXP | = lv_i_unit_exp | |
| I_ARBID | = lv_i_arbid | |
| I_FCALID | = lv_i_fcalid | |
| I_PERNR | = lv_i_pernr | |
| I_KAPID | = lv_i_kapid | |
| I_VERSA | = lv_i_versa | |
| I_FLG_EXACT_BREAKS | = lv_i_flg_exact_breaks | |
| I_FLG_NO_CALENDAR | = lv_i_flg_no_calendar | |
| I_FLG_CAP_SCHEDULING | = lv_i_flg_cap_scheduling | |
| I_FLG_EFZ | = lv_i_flg_efz | |
| I_TIME_START | = lv_i_time_start | |
| I_DATE_END | = lv_i_date_end | |
| I_TIME_END | = lv_i_time_end | |
| I_POINT_IN_TIME_START | = lv_i_point_in_time_start | |
| I_POINT_IN_TIME_END | = lv_i_point_in_time_end | |
| I_DURATION | = lv_i_duration | |
| I_DURATION_SEC | = lv_i_duration_sec | |
| I_UNIT | = lv_i_unit | |
| IMPORTING | ||
| E_DATE_START | = lv_e_date_start | |
| E_MIN_NUM_CAPACITIES | = lv_e_min_num_capacities | |
| E_MESSAGE_CODE | = lv_e_message_code | |
| E_TIME_START | = lv_e_time_start | |
| E_DATE_END | = lv_e_date_end | |
| E_TIME_END | = lv_e_time_end | |
| E_POINT_IN_TIME_START | = lv_e_point_in_time_start | |
| E_POINT_IN_TIME_END | = lv_e_point_in_time_end | |
| E_DURATION | = lv_e_duration | |
| E_DURATION_SEC | = lv_e_duration_sec | |
| E_UNIT | = lv_e_unit | |
| EXCEPTIONS | ||
| PARAMETERS_NOT_VALID = 1 | ||
| . " CX_SCHED_VIA_OPERATING_TIME | ||
ABAP code using 7.40 inline data declarations to call FM CX_SCHED_VIA_OPERATING_TIME
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single FSAVD FROM AFVGD INTO @DATA(ld_e_date_start). | ||||
| "SELECT single FSAVD FROM AFVGD INTO @DATA(ld_i_date_start). | ||||
| DATA(ld_i_date_start) | = '00000000'. | |||
| "SELECT single MSEHI FROM T006 INTO @DATA(ld_i_unit_exp). | ||||
| DATA(ld_i_unit_exp) | = ' '. | |||
| "SELECT single ANZHL FROM KAPA INTO @DATA(ld_e_min_num_capacities). | ||||
| "SELECT single OBJID FROM CRHD INTO @DATA(ld_i_arbid). | ||||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_e_message_code). | ||||
| "SELECT single FCALID FROM SCAL INTO @DATA(ld_i_fcalid). | ||||
| DATA(ld_i_fcalid) | = ' '. | |||
| "SELECT single OBJID FROM PCHDY INTO @DATA(ld_i_pernr). | ||||
| "SELECT single KAPID FROM KBED INTO @DATA(ld_i_kapid). | ||||
| "SELECT single VERSA FROM KAKO INTO @DATA(ld_i_versa). | ||||
| DATA(ld_i_flg_exact_breaks) | = ' '. | |||
| DATA(ld_i_flg_no_calendar) | = ' '. | |||
| DATA(ld_i_flg_cap_scheduling) | = ' '. | |||
| DATA(ld_i_flg_efz) | = ' '. | |||
| "SELECT single FSAVZ FROM AFVGD INTO @DATA(ld_e_time_start). | ||||
| "SELECT single FSAVZ FROM AFVGD INTO @DATA(ld_i_time_start). | ||||
| DATA(ld_i_time_start) | = '000000'. | |||
| "SELECT single FSAVD FROM AFVGD INTO @DATA(ld_e_date_end). | ||||
| "SELECT single FSAVD FROM AFVGD INTO @DATA(ld_i_date_end). | ||||
| DATA(ld_i_date_end) | = '00000000'. | |||
| "SELECT single FSAVZ FROM AFVGD INTO @DATA(ld_e_time_end). | ||||
| "SELECT single FSAVZ FROM AFVGD INTO @DATA(ld_i_time_end). | ||||
| DATA(ld_i_time_end) | = '240000'. | |||
| "SELECT single MSEHI FROM T006 INTO @DATA(ld_e_unit). | ||||
| "SELECT single MSEHI FROM T006 INTO @DATA(ld_i_unit). | ||||
| DATA(ld_i_unit) | = ' '. | |||
Search for further information about these or an SAP related objects