SAP MD_CALC_RESTRICTIONS Function Module for NOTRANSL: Berechnungen für Restriktionen in der Belegbündelung
MD_CALC_RESTRICTIONS is a standard md calc restrictions SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Berechnungen für Restriktionen in der Belegbündelung 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 md calc restrictions FM, simply by entering the name MD_CALC_RESTRICTIONS into the relevant SAP transaction such as SE37 or SE38.
Function Group: MDR2
Program Name: SAPLMDR2
Main Program: SAPLMDR2
Appliation area: W
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function MD_CALC_RESTRICTIONS 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 'MD_CALC_RESTRICTIONS'"NOTRANSL: Berechnungen für Restriktionen in der Belegbündelung.
EXPORTING
I_BOPNR = "Restriction Profile Number
* I_KZREFRESH = 'X' "DE-EN-LANG-SWITCH-NO-TRANSLATION
* I_RESTRI_PLUS_EXT = ' ' "
IMPORTING
E_RES_WAERS = "
E_RES_GEWEI = "
E_RES_VOLEH = "
E_RES_MEINS = "
TABLES
* T_ITEMS = "DE-EN-LANG-SWITCH-NO-TRANSLATION
* T_RESTRI = "Restrictions
* T_RESTRI_PLUS = "DE-EN-LANG-SWITCH-NO-TRANSLATION
EXCEPTIONS
RESTRICTION_NOT_FOUND = 1 INVALID_RESTRICTION = 2
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_SAPLMDR2_001 User Exit for Load Building: Calculate Restriction per Material
EXIT_SAPLMDR2_002 User Exit Load Building: Check Whether Restrictions Are Adhered to
EXIT_SAPLMDR2_003 User Exit for Document Bundling: Change Calculated Values
IMPORTING Parameters details for MD_CALC_RESTRICTIONS
I_BOPNR - Restriction Profile Number
Data type: TWBO1-BOPNROptional: No
Call by Reference: No ( called with pass by value option)
I_KZREFRESH - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: CDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_RESTRI_PLUS_EXT -
Data type: CDefault: ' '
Optional: Yes
Call by Reference: Yes
EXPORTING Parameters details for MD_CALC_RESTRICTIONS
E_RES_WAERS -
Data type: TWBO1-WAERSOptional: No
Call by Reference: Yes
E_RES_GEWEI -
Data type: TWBO1-GEWEIOptional: No
Call by Reference: Yes
E_RES_VOLEH -
Data type: TWBO1-VOLEHOptional: No
Call by Reference: Yes
E_RES_MEINS -
Data type: TWBO1-MEINSOptional: No
Call by Reference: Yes
TABLES Parameters details for MD_CALC_RESTRICTIONS
T_ITEMS - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: MDR2P_T_ITEMOptional: Yes
Call by Reference: No ( called with pass by value option)
T_RESTRI - Restrictions
Data type: MDR2P_T_RESTRIOptional: Yes
Call by Reference: No ( called with pass by value option)
T_RESTRI_PLUS - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: MDR2P_T_RESTRIOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
RESTRICTION_NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_RESTRICTION -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for MD_CALC_RESTRICTIONS 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_i_bopnr | TYPE TWBO1-BOPNR, " | |||
| lt_t_items | TYPE STANDARD TABLE OF MDR2P_T_ITEM, " | |||
| lv_e_res_waers | TYPE TWBO1-WAERS, " | |||
| lv_restriction_not_found | TYPE TWBO1, " | |||
| lt_t_restri | TYPE STANDARD TABLE OF MDR2P_T_RESTRI, " | |||
| lv_e_res_gewei | TYPE TWBO1-GEWEI, " | |||
| lv_i_kzrefresh | TYPE C, " 'X' | |||
| lv_invalid_restriction | TYPE C, " | |||
| lv_e_res_voleh | TYPE TWBO1-VOLEH, " | |||
| lt_t_restri_plus | TYPE STANDARD TABLE OF MDR2P_T_RESTRI, " | |||
| lv_i_restri_plus_ext | TYPE C, " ' ' | |||
| lv_e_res_meins | TYPE TWBO1-MEINS. " |
|   CALL FUNCTION 'MD_CALC_RESTRICTIONS' "NOTRANSL: Berechnungen für Restriktionen in der Belegbündelung |
| EXPORTING | ||
| I_BOPNR | = lv_i_bopnr | |
| I_KZREFRESH | = lv_i_kzrefresh | |
| I_RESTRI_PLUS_EXT | = lv_i_restri_plus_ext | |
| IMPORTING | ||
| E_RES_WAERS | = lv_e_res_waers | |
| E_RES_GEWEI | = lv_e_res_gewei | |
| E_RES_VOLEH | = lv_e_res_voleh | |
| E_RES_MEINS | = lv_e_res_meins | |
| TABLES | ||
| T_ITEMS | = lt_t_items | |
| T_RESTRI | = lt_t_restri | |
| T_RESTRI_PLUS | = lt_t_restri_plus | |
| EXCEPTIONS | ||
| RESTRICTION_NOT_FOUND = 1 | ||
| INVALID_RESTRICTION = 2 | ||
| . " MD_CALC_RESTRICTIONS | ||
ABAP code using 7.40 inline data declarations to call FM MD_CALC_RESTRICTIONS
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 BOPNR FROM TWBO1 INTO @DATA(ld_i_bopnr). | ||||
| "SELECT single WAERS FROM TWBO1 INTO @DATA(ld_e_res_waers). | ||||
| "SELECT single GEWEI FROM TWBO1 INTO @DATA(ld_e_res_gewei). | ||||
| DATA(ld_i_kzrefresh) | = 'X'. | |||
| "SELECT single VOLEH FROM TWBO1 INTO @DATA(ld_e_res_voleh). | ||||
| DATA(ld_i_restri_plus_ext) | = ' '. | |||
| "SELECT single MEINS FROM TWBO1 INTO @DATA(ld_e_res_meins). | ||||
Search for further information about these or an SAP related objects