SAP CY_LOAD_DISTRIBUTION Function Module for Distribution of capacity loads
CY_LOAD_DISTRIBUTION is a standard cy load distribution SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Distribution of capacity loads 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 cy load distribution FM, simply by entering the name CY_LOAD_DISTRIBUTION into the relevant SAP transaction such as SE37 or SE38.
Function Group: CYCP
Program Name: SAPLCYCP
Main Program: SAPLCYCP
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CY_LOAD_DISTRIBUTION 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 'CY_LOAD_DISTRIBUTION'"Distribution of capacity loads.
EXPORTING
* ANVER = ' ' "
* FRUH_ZEITB = '000000' "
* FRUH_ZEITV = '000000' "
* HIEVER = ' ' "
* KAP_EINH = 01 "Unit of capacity requirements
* KZ_EZ = ' ' "
* KZ_FK = ' ' "
* KZ_GK = ' ' "
* LIEINH = ' ' "
* RUNDUNGSWERT = 0 "Dispatching with a multiple of rounding-off value
* SPAET_ENDE = SY-DATUM "Latest finish date
* BEDARF1 = 0 "
* SPAET_START = SY-DATUM "Latest start date
* SPAET_ZEITB = '000000' "
* SPAET_ZEITV = '000000' "
* VERTL = ' ' "
* VERTLB = ' ' "
* WERKS = ' ' "
* BEDPLAN_UHRZEIT = ' ' "
* AVAICAPVER = ' ' "
* ANGEB_VERD = ' ' "
* I_PERNR = 0 "
* BEDARF2 = 0 "
* I_PER_EX = "
* I_BEDID = "
* I_BEDZL = "
* I_CANUM = "
* EXACT_BREAKS = "
* HNAME = "
* I_KBED = "
* BEDARF3 = 0 "
* BEDARF4 = 0 "
* EINSATZ_KZ = ' ' "
* FERTIG_GRAD = 0 "Degree of completion (for KAPA, REST requirement)
* FRUH_ENDE = SY-DATUM "Earliest finish date
* FRUH_START = SY-DATUM "Earliest start date
IMPORTING
KZ_EZO = "
KZ_FKO = "
KZ_GKO = "
REST_RUNDUNGSWERT1 = "Remaining reqmts-1 after dispatching with rounding-off value
REST_RUNDUNGSWERT2 = "Remaining reqmts-2 after dispatching with rounding-off value
REST_RUNDUNGSWERT3 = "Remaining reqmts-3 after dispatching with rounding-off value
REST_RUNDUNGSWERT4 = "Remaining reqmts-4 after dispatching with rounding-off value
TABLES
INDTAB = "
PERTAB = "
EXCEPTIONS
DATE_INVALID = 1 GRAD_INVALID = 2 VERTL_NOT_FOUND = 3 VERTL_ONLY_ONE = 4
IMPORTING Parameters details for CY_LOAD_DISTRIBUTION
ANVER -
Data type: RC65A-ANVERDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
FRUH_ZEITB -
Data type: RC65K-ZEITBDefault: '000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
FRUH_ZEITV -
Data type: RC65K-ZEITVDefault: '000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
HIEVER -
Data type: RC65A-HIEVERDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
KAP_EINH - Unit of capacity requirements
Data type: RC65A-LIEINHDefault: 01
Optional: Yes
Call by Reference: No ( called with pass by value option)
KZ_EZ -
Data type: RC65A-PEINHEITDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
KZ_FK -
Data type: RC65A-PEINHEITDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
KZ_GK -
Data type: RC65A-PEINHEITDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
LIEINH -
Data type: RC65A-LIEINHDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
RUNDUNGSWERT - Dispatching with a multiple of rounding-off value
Data type: RC65K-BELASOptional: Yes
Call by Reference: No ( called with pass by value option)
SPAET_ENDE - Latest finish date
Data type: RC65K-DATUVDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
BEDARF1 -
Data type: RC65K-BELASOptional: Yes
Call by Reference: No ( called with pass by value option)
SPAET_START - Latest start date
Data type: RC65K-DATUVDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
SPAET_ZEITB -
Data type: RC65K-ZEITBDefault: '000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
SPAET_ZEITV -
Data type: RC65K-ZEITVDefault: '000000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
VERTL -
Data type: TC29-VERTLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
VERTLB -
Data type: T437V-VERTLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
WERKS -
Data type: T437V-WERKSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
BEDPLAN_UHRZEIT -
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
AVAICAPVER -
Data type: RC65A-AVAICAPVERDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
ANGEB_VERD -
Data type: RC65B-INDCUMCAPDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_PERNR -
Data type: KBED-PERNROptional: Yes
Call by Reference: No ( called with pass by value option)
BEDARF2 -
Data type: RC65K-BELASOptional: Yes
Call by Reference: No ( called with pass by value option)
I_PER_EX -
Data type: KBEDD-PER_EXOptional: Yes
Call by Reference: No ( called with pass by value option)
I_BEDID -
Data type: KBED-BEDIDOptional: Yes
Call by Reference: No ( called with pass by value option)
I_BEDZL -
Data type: KBED-BEDZLOptional: Yes
Call by Reference: No ( called with pass by value option)
I_CANUM -
Data type: KBED-CANUMOptional: Yes
Call by Reference: No ( called with pass by value option)
EXACT_BREAKS -
Data type: COptional: Yes
Call by Reference: No ( called with pass by value option)
HNAME -
Data type: RC65A-HNAMEOptional: Yes
Call by Reference: No ( called with pass by value option)
I_KBED -
Data type: KBEDOptional: Yes
Call by Reference: No ( called with pass by value option)
BEDARF3 -
Data type: RC65K-BELASOptional: Yes
Call by Reference: No ( called with pass by value option)
BEDARF4 -
Data type: RC65K-BELASOptional: Yes
Call by Reference: No ( called with pass by value option)
EINSATZ_KZ -
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
FERTIG_GRAD - Degree of completion (for KAPA, REST requirement)
Data type: V_TC29F-DAUEROptional: Yes
Call by Reference: No ( called with pass by value option)
FRUH_ENDE - Earliest finish date
Data type: RC65K-DATUVDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
FRUH_START - Earliest start date
Data type: RC65K-DATUVDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for CY_LOAD_DISTRIBUTION
KZ_EZO -
Data type: RC65A-PEINHEITOptional: No
Call by Reference: No ( called with pass by value option)
KZ_FKO -
Data type: RC65A-PEINHEITOptional: No
Call by Reference: No ( called with pass by value option)
KZ_GKO -
Data type: RC65A-PEINHEITOptional: No
Call by Reference: No ( called with pass by value option)
REST_RUNDUNGSWERT1 - Remaining reqmts-1 after dispatching with rounding-off value
Data type: RC65K-BELASOptional: No
Call by Reference: No ( called with pass by value option)
REST_RUNDUNGSWERT2 - Remaining reqmts-2 after dispatching with rounding-off value
Data type: RC65K-BELASOptional: No
Call by Reference: No ( called with pass by value option)
REST_RUNDUNGSWERT3 - Remaining reqmts-3 after dispatching with rounding-off value
Data type: RC65K-BELASOptional: No
Call by Reference: No ( called with pass by value option)
REST_RUNDUNGSWERT4 - Remaining reqmts-4 after dispatching with rounding-off value
Data type: RC65K-BELASOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for CY_LOAD_DISTRIBUTION
INDTAB -
Data type: CYVERPEROptional: No
Call by Reference: No ( called with pass by value option)
PERTAB -
Data type: RC65KOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
DATE_INVALID - If From-date is greater that To-date
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
GRAD_INVALID - if degree of completion is higher than 100 (in %)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VERTL_NOT_FOUND - Distribution key does not exist in TC29/T437V
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VERTL_ONLY_ONE - If both distribution keys are entered
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for CY_LOAD_DISTRIBUTION 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_anver | TYPE RC65A-ANVER, " ' ' | |||
| lt_indtab | TYPE STANDARD TABLE OF CYVERPER, " | |||
| lv_kz_ezo | TYPE RC65A-PEINHEIT, " | |||
| lv_date_invalid | TYPE RC65A, " | |||
| lv_fruh_zeitb | TYPE RC65K-ZEITB, " '000000' | |||
| lv_fruh_zeitv | TYPE RC65K-ZEITV, " '000000' | |||
| lv_hiever | TYPE RC65A-HIEVER, " ' ' | |||
| lv_kap_einh | TYPE RC65A-LIEINH, " 01 | |||
| lv_kz_ez | TYPE RC65A-PEINHEIT, " SPACE | |||
| lv_kz_fk | TYPE RC65A-PEINHEIT, " SPACE | |||
| lv_kz_gk | TYPE RC65A-PEINHEIT, " SPACE | |||
| lv_lieinh | TYPE RC65A-LIEINH, " ' ' | |||
| lv_rundungswert | TYPE RC65K-BELAS, " 0 | |||
| lv_spaet_ende | TYPE RC65K-DATUV, " SY-DATUM | |||
| lv_kz_fko | TYPE RC65A-PEINHEIT, " | |||
| lt_pertab | TYPE STANDARD TABLE OF RC65K, " | |||
| lv_bedarf1 | TYPE RC65K-BELAS, " 0 | |||
| lv_grad_invalid | TYPE RC65K, " | |||
| lv_spaet_start | TYPE RC65K-DATUV, " SY-DATUM | |||
| lv_spaet_zeitb | TYPE RC65K-ZEITB, " '000000' | |||
| lv_spaet_zeitv | TYPE RC65K-ZEITV, " '000000' | |||
| lv_vertl | TYPE TC29-VERTL, " SPACE | |||
| lv_vertlb | TYPE T437V-VERTL, " SPACE | |||
| lv_werks | TYPE T437V-WERKS, " SPACE | |||
| lv_bedplan_uhrzeit | TYPE T437V, " ' ' | |||
| lv_avaicapver | TYPE RC65A-AVAICAPVER, " SPACE | |||
| lv_angeb_verd | TYPE RC65B-INDCUMCAP, " SPACE | |||
| lv_i_pernr | TYPE KBED-PERNR, " 0 | |||
| lv_kz_gko | TYPE RC65A-PEINHEIT, " | |||
| lv_bedarf2 | TYPE RC65K-BELAS, " 0 | |||
| lv_vertl_not_found | TYPE RC65K, " | |||
| lv_i_per_ex | TYPE KBEDD-PER_EX, " | |||
| lv_i_bedid | TYPE KBED-BEDID, " | |||
| lv_i_bedzl | TYPE KBED-BEDZL, " | |||
| lv_i_canum | TYPE KBED-CANUM, " | |||
| lv_exact_breaks | TYPE C, " | |||
| lv_hname | TYPE RC65A-HNAME, " | |||
| lv_i_kbed | TYPE KBED, " | |||
| lv_bedarf3 | TYPE RC65K-BELAS, " 0 | |||
| lv_vertl_only_one | TYPE RC65K, " | |||
| lv_rest_rundungswert1 | TYPE RC65K-BELAS, " | |||
| lv_bedarf4 | TYPE RC65K-BELAS, " 0 | |||
| lv_rest_rundungswert2 | TYPE RC65K-BELAS, " | |||
| lv_einsatz_kz | TYPE RC65K, " ' ' | |||
| lv_rest_rundungswert3 | TYPE RC65K-BELAS, " | |||
| lv_fertig_grad | TYPE V_TC29F-DAUER, " 0 | |||
| lv_rest_rundungswert4 | TYPE RC65K-BELAS, " | |||
| lv_fruh_ende | TYPE RC65K-DATUV, " SY-DATUM | |||
| lv_fruh_start | TYPE RC65K-DATUV. " SY-DATUM |
|   CALL FUNCTION 'CY_LOAD_DISTRIBUTION' "Distribution of capacity loads |
| EXPORTING | ||
| ANVER | = lv_anver | |
| FRUH_ZEITB | = lv_fruh_zeitb | |
| FRUH_ZEITV | = lv_fruh_zeitv | |
| HIEVER | = lv_hiever | |
| KAP_EINH | = lv_kap_einh | |
| KZ_EZ | = lv_kz_ez | |
| KZ_FK | = lv_kz_fk | |
| KZ_GK | = lv_kz_gk | |
| LIEINH | = lv_lieinh | |
| RUNDUNGSWERT | = lv_rundungswert | |
| SPAET_ENDE | = lv_spaet_ende | |
| BEDARF1 | = lv_bedarf1 | |
| SPAET_START | = lv_spaet_start | |
| SPAET_ZEITB | = lv_spaet_zeitb | |
| SPAET_ZEITV | = lv_spaet_zeitv | |
| VERTL | = lv_vertl | |
| VERTLB | = lv_vertlb | |
| WERKS | = lv_werks | |
| BEDPLAN_UHRZEIT | = lv_bedplan_uhrzeit | |
| AVAICAPVER | = lv_avaicapver | |
| ANGEB_VERD | = lv_angeb_verd | |
| I_PERNR | = lv_i_pernr | |
| BEDARF2 | = lv_bedarf2 | |
| I_PER_EX | = lv_i_per_ex | |
| I_BEDID | = lv_i_bedid | |
| I_BEDZL | = lv_i_bedzl | |
| I_CANUM | = lv_i_canum | |
| EXACT_BREAKS | = lv_exact_breaks | |
| HNAME | = lv_hname | |
| I_KBED | = lv_i_kbed | |
| BEDARF3 | = lv_bedarf3 | |
| BEDARF4 | = lv_bedarf4 | |
| EINSATZ_KZ | = lv_einsatz_kz | |
| FERTIG_GRAD | = lv_fertig_grad | |
| FRUH_ENDE | = lv_fruh_ende | |
| FRUH_START | = lv_fruh_start | |
| IMPORTING | ||
| KZ_EZO | = lv_kz_ezo | |
| KZ_FKO | = lv_kz_fko | |
| KZ_GKO | = lv_kz_gko | |
| REST_RUNDUNGSWERT1 | = lv_rest_rundungswert1 | |
| REST_RUNDUNGSWERT2 | = lv_rest_rundungswert2 | |
| REST_RUNDUNGSWERT3 | = lv_rest_rundungswert3 | |
| REST_RUNDUNGSWERT4 | = lv_rest_rundungswert4 | |
| TABLES | ||
| INDTAB | = lt_indtab | |
| PERTAB | = lt_pertab | |
| EXCEPTIONS | ||
| DATE_INVALID = 1 | ||
| GRAD_INVALID = 2 | ||
| VERTL_NOT_FOUND = 3 | ||
| VERTL_ONLY_ONE = 4 | ||
| . " CY_LOAD_DISTRIBUTION | ||
ABAP code using 7.40 inline data declarations to call FM CY_LOAD_DISTRIBUTION
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 ANVER FROM RC65A INTO @DATA(ld_anver). | ||||
| DATA(ld_anver) | = ' '. | |||
| "SELECT single PEINHEIT FROM RC65A INTO @DATA(ld_kz_ezo). | ||||
| "SELECT single ZEITB FROM RC65K INTO @DATA(ld_fruh_zeitb). | ||||
| DATA(ld_fruh_zeitb) | = '000000'. | |||
| "SELECT single ZEITV FROM RC65K INTO @DATA(ld_fruh_zeitv). | ||||
| DATA(ld_fruh_zeitv) | = '000000'. | |||
| "SELECT single HIEVER FROM RC65A INTO @DATA(ld_hiever). | ||||
| DATA(ld_hiever) | = ' '. | |||
| "SELECT single LIEINH FROM RC65A INTO @DATA(ld_kap_einh). | ||||
| DATA(ld_kap_einh) | = 01. | |||
| "SELECT single PEINHEIT FROM RC65A INTO @DATA(ld_kz_ez). | ||||
| DATA(ld_kz_ez) | = ' '. | |||
| "SELECT single PEINHEIT FROM RC65A INTO @DATA(ld_kz_fk). | ||||
| DATA(ld_kz_fk) | = ' '. | |||
| "SELECT single PEINHEIT FROM RC65A INTO @DATA(ld_kz_gk). | ||||
| DATA(ld_kz_gk) | = ' '. | |||
| "SELECT single LIEINH FROM RC65A INTO @DATA(ld_lieinh). | ||||
| DATA(ld_lieinh) | = ' '. | |||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_rundungswert). | ||||
| "SELECT single DATUV FROM RC65K INTO @DATA(ld_spaet_ende). | ||||
| DATA(ld_spaet_ende) | = SY-DATUM. | |||
| "SELECT single PEINHEIT FROM RC65A INTO @DATA(ld_kz_fko). | ||||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_bedarf1). | ||||
| "SELECT single DATUV FROM RC65K INTO @DATA(ld_spaet_start). | ||||
| DATA(ld_spaet_start) | = SY-DATUM. | |||
| "SELECT single ZEITB FROM RC65K INTO @DATA(ld_spaet_zeitb). | ||||
| DATA(ld_spaet_zeitb) | = '000000'. | |||
| "SELECT single ZEITV FROM RC65K INTO @DATA(ld_spaet_zeitv). | ||||
| DATA(ld_spaet_zeitv) | = '000000'. | |||
| "SELECT single VERTL FROM TC29 INTO @DATA(ld_vertl). | ||||
| DATA(ld_vertl) | = ' '. | |||
| "SELECT single VERTL FROM T437V INTO @DATA(ld_vertlb). | ||||
| DATA(ld_vertlb) | = ' '. | |||
| "SELECT single WERKS FROM T437V INTO @DATA(ld_werks). | ||||
| DATA(ld_werks) | = ' '. | |||
| DATA(ld_bedplan_uhrzeit) | = ' '. | |||
| "SELECT single AVAICAPVER FROM RC65A INTO @DATA(ld_avaicapver). | ||||
| DATA(ld_avaicapver) | = ' '. | |||
| "SELECT single INDCUMCAP FROM RC65B INTO @DATA(ld_angeb_verd). | ||||
| DATA(ld_angeb_verd) | = ' '. | |||
| "SELECT single PERNR FROM KBED INTO @DATA(ld_i_pernr). | ||||
| "SELECT single PEINHEIT FROM RC65A INTO @DATA(ld_kz_gko). | ||||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_bedarf2). | ||||
| "SELECT single PER_EX FROM KBEDD INTO @DATA(ld_i_per_ex). | ||||
| "SELECT single BEDID FROM KBED INTO @DATA(ld_i_bedid). | ||||
| "SELECT single BEDZL FROM KBED INTO @DATA(ld_i_bedzl). | ||||
| "SELECT single CANUM FROM KBED INTO @DATA(ld_i_canum). | ||||
| "SELECT single HNAME FROM RC65A INTO @DATA(ld_hname). | ||||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_bedarf3). | ||||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_rest_rundungswert1). | ||||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_bedarf4). | ||||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_rest_rundungswert2). | ||||
| DATA(ld_einsatz_kz) | = ' '. | |||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_rest_rundungswert3). | ||||
| "SELECT single DAUER FROM V_TC29F INTO @DATA(ld_fertig_grad). | ||||
| "SELECT single BELAS FROM RC65K INTO @DATA(ld_rest_rundungswert4). | ||||
| "SELECT single DATUV FROM RC65K INTO @DATA(ld_fruh_ende). | ||||
| DATA(ld_fruh_ende) | = SY-DATUM. | |||
| "SELECT single DATUV FROM RC65K INTO @DATA(ld_fruh_start). | ||||
| DATA(ld_fruh_start) | = SY-DATUM. | |||
Search for further information about these or an SAP related objects