SAP CATS_GET_LEVELING_DATA Function Module for Time Sheets Time Leveling
CATS_GET_LEVELING_DATA is a standard cats get leveling data SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Time Sheets Time Leveling 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 cats get leveling data FM, simply by entering the name CATS_GET_LEVELING_DATA into the relevant SAP transaction such as SE37 or SE38.
Function Group: CATS_LEVELING
Program Name: SAPLCATS_LEVELING
Main Program: SAPLCATS_LEVELING
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CATS_GET_LEVELING_DATA 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 'CATS_GET_LEVELING_DATA'"Time Sheets Time Leveling.
EXPORTING
* BEGDA = '18000101' "Valid-From Date
* PERTYP = '2' "Type of Data Entry Period
* PERIOD = 1 "Number of Days/Weeks on Screen
* FIRSTD = 0 "First Day of Week
* RD_TARGET = "Calculate Non-Working Days by Target Hours
* TTYPE = "Time Type for Target Hours (Default: Day's Planned Hours)
* CH_SUBHR = "Subtract HR Attendance or Absence Hours from Target Hours
* CH_OVER = "Add Overtime from HR to Target Hours
* UNDERTAR = "Max. Percentage by Which Value May Fall Below Target Hours
* OVERTAR = "Max. percentage by which value may exceed target hours
* CH_ALL = "Display All Records
* ENDDA = '99991231' "End of Validity Period
* CH_ACCNT = "Required Time Recording in Time Sheet
* RD_SEL = '1' "Time Sheet Selection
* DOLIM = "Lower Limit for Recorded Hours
* UPLIM = "Upper Limit for Recorded Hours
* CH_FEW = "Select Time Sheets with Too Few Recorded Hours
* CH_MANY = "Select Time Sheets with Too Many Recorded Hours
* RD_DAY = 'X' "Apply Selection Criteria to Each Day
TABLES
SEL_PERNR_TAB = "Selection option for pernr
CATS_DATA_TAB = "Incentive Wages: Individual Time Tickets
* MESSAGE_TAB = "Return Parameter(s)
EXCEPTIONS
ERROR_SELECTION = 1 NO_ABS_HOUR_LIMIT = 2 NO_FEW_MANY = 3 ERROR_DATES = 4 SYSTEM_ERROR = 5
IMPORTING Parameters details for CATS_GET_LEVELING_DATA
BEGDA - Valid-From Date
Data type: PRELP-BEGDADefault: '18000101'
Optional: Yes
Call by Reference: No ( called with pass by value option)
PERTYP - Type of Data Entry Period
Data type: TCATS-PERTYPEDefault: '2'
Optional: Yes
Call by Reference: No ( called with pass by value option)
PERIOD - Number of Days/Weeks on Screen
Data type: TCATS-CATSPERIODDefault: 1
Optional: Yes
Call by Reference: No ( called with pass by value option)
FIRSTD - First Day of Week
Data type: TCATS-FIRSTDAYOFOptional: Yes
Call by Reference: No ( called with pass by value option)
RD_TARGET - Calculate Non-Working Days by Target Hours
Data type: CATS_DAYTARGETOptional: Yes
Call by Reference: No ( called with pass by value option)
TTYPE - Time Type for Target Hours (Default: Day's Planned Hours)
Data type: TCATS-TIMETYPEOptional: Yes
Call by Reference: No ( called with pass by value option)
CH_SUBHR - Subtract HR Attendance or Absence Hours from Target Hours
Data type: TCATS-SUBHRTIMESOptional: Yes
Call by Reference: No ( called with pass by value option)
CH_OVER - Add Overtime from HR to Target Hours
Data type: TCATS-ADDOVERTIMEOptional: Yes
Call by Reference: No ( called with pass by value option)
UNDERTAR - Max. Percentage by Which Value May Fall Below Target Hours
Data type: TCATS-UNDERTARGEOptional: Yes
Call by Reference: No ( called with pass by value option)
OVERTAR - Max. percentage by which value may exceed target hours
Data type: TCATS-OVERTARGETOptional: Yes
Call by Reference: No ( called with pass by value option)
CH_ALL - Display All Records
Data type: RCATSTXX-DISPALLOptional: Yes
Call by Reference: No ( called with pass by value option)
ENDDA - End of Validity Period
Data type: PRELP-ENDDADefault: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)
CH_ACCNT - Required Time Recording in Time Sheet
Data type: PS0315-ACCNTOptional: Yes
Call by Reference: No ( called with pass by value option)
RD_SEL - Time Sheet Selection
Data type: CATS_TSSELDefault: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)
DOLIM - Lower Limit for Recorded Hours
Data type: RCATSTXX-DOLIMOptional: Yes
Call by Reference: No ( called with pass by value option)
UPLIM - Upper Limit for Recorded Hours
Data type: RCATSTXX-UPLIMOptional: Yes
Call by Reference: No ( called with pass by value option)
CH_FEW - Select Time Sheets with Too Few Recorded Hours
Data type: RCATSTXX-TOOFEWOptional: Yes
Call by Reference: No ( called with pass by value option)
CH_MANY - Select Time Sheets with Too Many Recorded Hours
Data type: RCATSTXX-TOOMANYOptional: Yes
Call by Reference: No ( called with pass by value option)
RD_DAY - Apply Selection Criteria to Each Day
Data type: CATS_SELDAYDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for CATS_GET_LEVELING_DATA
SEL_PERNR_TAB - Selection option for pernr
Data type: SEL_PERNROptional: No
Call by Reference: Yes
CATS_DATA_TAB - Incentive Wages: Individual Time Tickets
Data type: CATS_TIMELEVELINGOptional: No
Call by Reference: Yes
MESSAGE_TAB - Return Parameter(s)
Data type: BAPIRET2Optional: Yes
Call by Reference: Yes
EXCEPTIONS details
ERROR_SELECTION -
Data type:Optional: No
Call by Reference: Yes
NO_ABS_HOUR_LIMIT -
Data type:Optional: No
Call by Reference: Yes
NO_FEW_MANY -
Data type:Optional: No
Call by Reference: Yes
ERROR_DATES -
Data type:Optional: No
Call by Reference: Yes
SYSTEM_ERROR - System Error
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for CATS_GET_LEVELING_DATA 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_begda | TYPE PRELP-BEGDA, " '18000101' | |||
| lt_sel_pernr_tab | TYPE STANDARD TABLE OF SEL_PERNR, " | |||
| lv_error_selection | TYPE SEL_PERNR, " | |||
| lv_pertyp | TYPE TCATS-PERTYPE, " '2' | |||
| lv_period | TYPE TCATS-CATSPERIOD, " 1 | |||
| lv_firstd | TYPE TCATS-FIRSTDAYOF, " 0 | |||
| lv_rd_target | TYPE CATS_DAYTARGET, " | |||
| lv_ttype | TYPE TCATS-TIMETYPE, " | |||
| lv_ch_subhr | TYPE TCATS-SUBHRTIMES, " | |||
| lv_ch_over | TYPE TCATS-ADDOVERTIME, " | |||
| lv_undertar | TYPE TCATS-UNDERTARGE, " | |||
| lv_overtar | TYPE TCATS-OVERTARGET, " | |||
| lv_ch_all | TYPE RCATSTXX-DISPALL, " | |||
| lv_endda | TYPE PRELP-ENDDA, " '99991231' | |||
| lt_cats_data_tab | TYPE STANDARD TABLE OF CATS_TIMELEVELING, " | |||
| lv_no_abs_hour_limit | TYPE CATS_TIMELEVELING, " | |||
| lv_ch_accnt | TYPE PS0315-ACCNT, " | |||
| lt_message_tab | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_no_few_many | TYPE BAPIRET2, " | |||
| lv_rd_sel | TYPE CATS_TSSEL, " '1' | |||
| lv_error_dates | TYPE CATS_TSSEL, " | |||
| lv_dolim | TYPE RCATSTXX-DOLIM, " | |||
| lv_system_error | TYPE RCATSTXX, " | |||
| lv_uplim | TYPE RCATSTXX-UPLIM, " | |||
| lv_ch_few | TYPE RCATSTXX-TOOFEW, " | |||
| lv_ch_many | TYPE RCATSTXX-TOOMANY, " | |||
| lv_rd_day | TYPE CATS_SELDAY. " 'X' |
|   CALL FUNCTION 'CATS_GET_LEVELING_DATA' "Time Sheets Time Leveling |
| EXPORTING | ||
| BEGDA | = lv_begda | |
| PERTYP | = lv_pertyp | |
| PERIOD | = lv_period | |
| FIRSTD | = lv_firstd | |
| RD_TARGET | = lv_rd_target | |
| TTYPE | = lv_ttype | |
| CH_SUBHR | = lv_ch_subhr | |
| CH_OVER | = lv_ch_over | |
| UNDERTAR | = lv_undertar | |
| OVERTAR | = lv_overtar | |
| CH_ALL | = lv_ch_all | |
| ENDDA | = lv_endda | |
| CH_ACCNT | = lv_ch_accnt | |
| RD_SEL | = lv_rd_sel | |
| DOLIM | = lv_dolim | |
| UPLIM | = lv_uplim | |
| CH_FEW | = lv_ch_few | |
| CH_MANY | = lv_ch_many | |
| RD_DAY | = lv_rd_day | |
| TABLES | ||
| SEL_PERNR_TAB | = lt_sel_pernr_tab | |
| CATS_DATA_TAB | = lt_cats_data_tab | |
| MESSAGE_TAB | = lt_message_tab | |
| EXCEPTIONS | ||
| ERROR_SELECTION = 1 | ||
| NO_ABS_HOUR_LIMIT = 2 | ||
| NO_FEW_MANY = 3 | ||
| ERROR_DATES = 4 | ||
| SYSTEM_ERROR = 5 | ||
| . " CATS_GET_LEVELING_DATA | ||
ABAP code using 7.40 inline data declarations to call FM CATS_GET_LEVELING_DATA
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 BEGDA FROM PRELP INTO @DATA(ld_begda). | ||||
| DATA(ld_begda) | = '18000101'. | |||
| "SELECT single PERTYPE FROM TCATS INTO @DATA(ld_pertyp). | ||||
| DATA(ld_pertyp) | = '2'. | |||
| "SELECT single CATSPERIOD FROM TCATS INTO @DATA(ld_period). | ||||
| DATA(ld_period) | = 1. | |||
| "SELECT single FIRSTDAYOF FROM TCATS INTO @DATA(ld_firstd). | ||||
| "SELECT single TIMETYPE FROM TCATS INTO @DATA(ld_ttype). | ||||
| "SELECT single SUBHRTIMES FROM TCATS INTO @DATA(ld_ch_subhr). | ||||
| "SELECT single ADDOVERTIME FROM TCATS INTO @DATA(ld_ch_over). | ||||
| "SELECT single UNDERTARGE FROM TCATS INTO @DATA(ld_undertar). | ||||
| "SELECT single OVERTARGET FROM TCATS INTO @DATA(ld_overtar). | ||||
| "SELECT single DISPALL FROM RCATSTXX INTO @DATA(ld_ch_all). | ||||
| "SELECT single ENDDA FROM PRELP INTO @DATA(ld_endda). | ||||
| DATA(ld_endda) | = '99991231'. | |||
| "SELECT single ACCNT FROM PS0315 INTO @DATA(ld_ch_accnt). | ||||
| DATA(ld_rd_sel) | = '1'. | |||
| "SELECT single DOLIM FROM RCATSTXX INTO @DATA(ld_dolim). | ||||
| "SELECT single UPLIM FROM RCATSTXX INTO @DATA(ld_uplim). | ||||
| "SELECT single TOOFEW FROM RCATSTXX INTO @DATA(ld_ch_few). | ||||
| "SELECT single TOOMANY FROM RCATSTXX INTO @DATA(ld_ch_many). | ||||
| DATA(ld_rd_day) | = 'X'. | |||
Search for further information about these or an SAP related objects