SAP MD_PEGGING Function Module for Pegged requirements









MD_PEGGING is a standard md pegging SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Pegged requirements 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 pegging FM, simply by entering the name MD_PEGGING into the relevant SAP transaction such as SE37 or SE38.

Function Group: M61B
Program Name: SAPLM61B
Main Program: SAPLM61B
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function MD_PEGGING 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_PEGGING'"Pegged requirements
EXPORTING
* EDELET = 0000 "Schedule line number of the MRP item
* EPLAAB = ' ' "MRP segment (only necessary for stocks)
* EPLANR = ' ' "MRP segment number (only necessary for stocks)
* EVERTO = ' ' "
* DISPLAY_ONLY = ' ' "
* EDELVR = ' ' "
* EDAT00 = 00000000 "
EDELKZ = "Indicator of the MRP item
EDELNR = "Number of the MRP item
* EDELPS = 000000 "Line item number of the MRP item
* EPLSCN = 000 "Planning scenario
EMATNR = "Material number of the MRP item
EWERKS = "Plant of the MRP item
* EBERID = ' ' "
* EPLWRK = ' ' "

TABLES
* EMDPSX = "

EXCEPTIONS
ERROR = 1 NO_REQUIREMENTS_FOUND = 2 ORDER_NOT_FOUND = 3
.



IMPORTING Parameters details for MD_PEGGING

EDELET - Schedule line number of the MRP item

Data type: MDPS-DELET
Default: 0000
Optional: Yes
Call by Reference: No ( called with pass by value option)

EPLAAB - MRP segment (only necessary for stocks)

Data type: MDPS-PLAAB
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EPLANR - MRP segment number (only necessary for stocks)

Data type: MDPS-PLANR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EVERTO -

Data type: MDPS-VERTO
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

DISPLAY_ONLY -

Data type: RM61M-BOOLEAN
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EDELVR -

Data type: MDPS-DELVR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EDAT00 -

Data type: MDPS-DAT00
Default: 00000000
Optional: Yes
Call by Reference: No ( called with pass by value option)

EDELKZ - Indicator of the MRP item

Data type: MDPS-DELKZ
Optional: No
Call by Reference: No ( called with pass by value option)

EDELNR - Number of the MRP item

Data type: MDPS-DEL12
Optional: No
Call by Reference: No ( called with pass by value option)

EDELPS - Line item number of the MRP item

Data type: MDPS-DELPS
Default: 000000
Optional: Yes
Call by Reference: No ( called with pass by value option)

EPLSCN - Planning scenario

Data type: MDKP-PLSCN
Default: 000
Optional: Yes
Call by Reference: No ( called with pass by value option)

EMATNR - Material number of the MRP item

Data type: MT61D-MATNR
Optional: No
Call by Reference: No ( called with pass by value option)

EWERKS - Plant of the MRP item

Data type: MT61D-WERKS
Optional: No
Call by Reference: No ( called with pass by value option)

EBERID -

Data type: MT61D-BERID
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EPLWRK -

Data type: PLAF-PLWRK
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for MD_PEGGING

EMDPSX -

Data type: MDPS
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

ERROR -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NO_REQUIREMENTS_FOUND -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

ORDER_NOT_FOUND - MRP item not in MDPSX

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for MD_PEGGING 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_error  TYPE STRING, "   
lv_edelet  TYPE MDPS-DELET, "   0000
lt_emdpsx  TYPE STANDARD TABLE OF MDPS, "   
lv_eplaab  TYPE MDPS-PLAAB, "   SPACE
lv_eplanr  TYPE MDPS-PLANR, "   SPACE
lv_everto  TYPE MDPS-VERTO, "   SPACE
lv_display_only  TYPE RM61M-BOOLEAN, "   SPACE
lv_edelvr  TYPE MDPS-DELVR, "   SPACE
lv_edat00  TYPE MDPS-DAT00, "   00000000
lv_edelkz  TYPE MDPS-DELKZ, "   
lv_no_requirements_found  TYPE MDPS, "   
lv_edelnr  TYPE MDPS-DEL12, "   
lv_order_not_found  TYPE MDPS, "   
lv_edelps  TYPE MDPS-DELPS, "   000000
lv_eplscn  TYPE MDKP-PLSCN, "   000
lv_ematnr  TYPE MT61D-MATNR, "   
lv_ewerks  TYPE MT61D-WERKS, "   
lv_eberid  TYPE MT61D-BERID, "   SPACE
lv_eplwrk  TYPE PLAF-PLWRK. "   SPACE

  CALL FUNCTION 'MD_PEGGING'  "Pegged requirements
    EXPORTING
         EDELET = lv_edelet
         EPLAAB = lv_eplaab
         EPLANR = lv_eplanr
         EVERTO = lv_everto
         DISPLAY_ONLY = lv_display_only
         EDELVR = lv_edelvr
         EDAT00 = lv_edat00
         EDELKZ = lv_edelkz
         EDELNR = lv_edelnr
         EDELPS = lv_edelps
         EPLSCN = lv_eplscn
         EMATNR = lv_ematnr
         EWERKS = lv_ewerks
         EBERID = lv_eberid
         EPLWRK = lv_eplwrk
    TABLES
         EMDPSX = lt_emdpsx
    EXCEPTIONS
        ERROR = 1
        NO_REQUIREMENTS_FOUND = 2
        ORDER_NOT_FOUND = 3
. " MD_PEGGING




ABAP code using 7.40 inline data declarations to call FM MD_PEGGING

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 DELET FROM MDPS INTO @DATA(ld_edelet).
DATA(ld_edelet) = 0000.
 
 
"SELECT single PLAAB FROM MDPS INTO @DATA(ld_eplaab).
DATA(ld_eplaab) = ' '.
 
"SELECT single PLANR FROM MDPS INTO @DATA(ld_eplanr).
DATA(ld_eplanr) = ' '.
 
"SELECT single VERTO FROM MDPS INTO @DATA(ld_everto).
DATA(ld_everto) = ' '.
 
"SELECT single BOOLEAN FROM RM61M INTO @DATA(ld_display_only).
DATA(ld_display_only) = ' '.
 
"SELECT single DELVR FROM MDPS INTO @DATA(ld_edelvr).
DATA(ld_edelvr) = ' '.
 
"SELECT single DAT00 FROM MDPS INTO @DATA(ld_edat00).
DATA(ld_edat00) = 00000000.
 
"SELECT single DELKZ FROM MDPS INTO @DATA(ld_edelkz).
 
 
"SELECT single DEL12 FROM MDPS INTO @DATA(ld_edelnr).
 
 
"SELECT single DELPS FROM MDPS INTO @DATA(ld_edelps).
DATA(ld_edelps) = 000000.
 
"SELECT single PLSCN FROM MDKP INTO @DATA(ld_eplscn).
DATA(ld_eplscn) = 000.
 
"SELECT single MATNR FROM MT61D INTO @DATA(ld_ematnr).
 
"SELECT single WERKS FROM MT61D INTO @DATA(ld_ewerks).
 
"SELECT single BERID FROM MT61D INTO @DATA(ld_eberid).
DATA(ld_eberid) = ' '.
 
"SELECT single PLWRK FROM PLAF INTO @DATA(ld_eplwrk).
DATA(ld_eplwrk) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!