SAP HR_GENERATE_WORK_SCHEDULE Function Module for
HR_GENERATE_WORK_SCHEDULE is a standard hr generate work schedule SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 hr generate work schedule FM, simply by entering the name HR_GENERATE_WORK_SCHEDULE into the relevant SAP transaction such as SE37 or SE38.
Function Group: PTWS
Program Name: SAPLPTWS
Main Program: SAPLPTWS
Appliation area: P
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function HR_GENERATE_WORK_SCHEDULE 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 'HR_GENERATE_WORK_SCHEDULE'".
EXPORTING
ZEITY = "Employee subgroup grouping for work schedules
MOFID = "Public holiday calendar ID
MOSID = "Personnel subarea grouping for work schedules
SCHKZ = "Work schedule rule
BEGJAHR = "Start year for work schedule generation
BEGMONAT = "Start month for work schedule generation
* ENDJAHR = "End year for work schedule generation
* ENDMONAT = "End month for work schedule generation
TABLES
INT552A = "
EXCEPTIONS
ERROR_OCCURED = 1
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLPTWS_001 User Exit for Generating Monthly Work Schedule
IMPORTING Parameters details for HR_GENERATE_WORK_SCHEDULE
ZEITY - Employee subgroup grouping for work schedules
Data type: T552A-ZEITYOptional: No
Call by Reference: No ( called with pass by value option)
MOFID - Public holiday calendar ID
Data type: T552A-MOFIDOptional: No
Call by Reference: No ( called with pass by value option)
MOSID - Personnel subarea grouping for work schedules
Data type: T552A-MOSIDOptional: No
Call by Reference: No ( called with pass by value option)
SCHKZ - Work schedule rule
Data type: T552A-SCHKZOptional: No
Call by Reference: No ( called with pass by value option)
BEGJAHR - Start year for work schedule generation
Data type: T552A-KJAHROptional: No
Call by Reference: No ( called with pass by value option)
BEGMONAT - Start month for work schedule generation
Data type: T552A-MONATOptional: No
Call by Reference: No ( called with pass by value option)
ENDJAHR - End year for work schedule generation
Data type: T552A-KJAHROptional: Yes
Call by Reference: No ( called with pass by value option)
ENDMONAT - End month for work schedule generation
Data type: T552A-MONATOptional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for HR_GENERATE_WORK_SCHEDULE
INT552A -
Data type: T552AOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ERROR_OCCURED - An error has occurred, see long text
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for HR_GENERATE_WORK_SCHEDULE 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_zeity | TYPE T552A-ZEITY, " | |||
| lt_int552a | TYPE STANDARD TABLE OF T552A, " | |||
| lv_error_occured | TYPE T552A, " | |||
| lv_mofid | TYPE T552A-MOFID, " | |||
| lv_mosid | TYPE T552A-MOSID, " | |||
| lv_schkz | TYPE T552A-SCHKZ, " | |||
| lv_begjahr | TYPE T552A-KJAHR, " | |||
| lv_begmonat | TYPE T552A-MONAT, " | |||
| lv_endjahr | TYPE T552A-KJAHR, " | |||
| lv_endmonat | TYPE T552A-MONAT. " |
|   CALL FUNCTION 'HR_GENERATE_WORK_SCHEDULE' " |
| EXPORTING | ||
| ZEITY | = lv_zeity | |
| MOFID | = lv_mofid | |
| MOSID | = lv_mosid | |
| SCHKZ | = lv_schkz | |
| BEGJAHR | = lv_begjahr | |
| BEGMONAT | = lv_begmonat | |
| ENDJAHR | = lv_endjahr | |
| ENDMONAT | = lv_endmonat | |
| TABLES | ||
| INT552A | = lt_int552a | |
| EXCEPTIONS | ||
| ERROR_OCCURED = 1 | ||
| . " HR_GENERATE_WORK_SCHEDULE | ||
ABAP code using 7.40 inline data declarations to call FM HR_GENERATE_WORK_SCHEDULE
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 ZEITY FROM T552A INTO @DATA(ld_zeity). | ||||
| "SELECT single MOFID FROM T552A INTO @DATA(ld_mofid). | ||||
| "SELECT single MOSID FROM T552A INTO @DATA(ld_mosid). | ||||
| "SELECT single SCHKZ FROM T552A INTO @DATA(ld_schkz). | ||||
| "SELECT single KJAHR FROM T552A INTO @DATA(ld_begjahr). | ||||
| "SELECT single MONAT FROM T552A INTO @DATA(ld_begmonat). | ||||
| "SELECT single KJAHR FROM T552A INTO @DATA(ld_endjahr). | ||||
| "SELECT single MONAT FROM T552A INTO @DATA(ld_endmonat). | ||||
Search for further information about these or an SAP related objects