Thursday, June 19, 2008

SAP MRP List Function Module

SAP MRP List Function Module

To get a MRP list similar to SAP Transaction MD05 you can use the following Function Module.

SAP ABAP Function Module to get MRP list

MD_MRP_LIST_API

The above mentioned Function Module gives MRP List output. For more details on the outputted list please check the following

OutPut Parameters

Structure
MDPS                              Item in MRP document
MDEZ                              Individual lines of the MRP elements
MDSU                             Total lines for MRP elements

Input Parameters

PLSCN                           Planning scenario in long-term planning
MATNR                         Material Number
WERKS                          Plant
BERID                           MRP area
AFIBZ                            Name of display filter
LIFNR                            Vendor Number

Related Tables

MDKP                             Header Data for MRP Document
MDTB                             MRP table
MDTC                             Aggregated MRP table items
T457T                             Description of MRP elements

Related Transaction Code MD05
_____________________________________________________

Please find the code below.

REPORT ZEX_MRPLIST .


Parameter: p_matnr like MARC-MATNR,
           p_werks like MARC-WERKS.


Data: st_MT61D like MT61D,
      st_MDKP  like MDKP,
      int_MDPS TYPE TABLE OF MDPS,
      int_MDEZ TYPE TABLE OF MDEZ,
      int_MDSU TYPE TABLE OF MDSU.


CALL FUNCTION 'MD_MRP_LIST_API'
  EXPORTING
*   PLSCN                          =
    MATNR                          = p_matnr
    WERKS                          = p_werks
*   BERID                          =
*   AFIBZ                          =
*   SINFG                          = 'X'
*   LIFNR                          =
*   AFHOR                          =
*   DTNUM                          =
*   INPER                          =
*   DISPLAY_LIST_MDPSX             =
*   DISPLAY_LIST_MDEZX             =
*   DISPLAY_LIST_MDSUX             =
 IMPORTING
   E_MT61D                        = st_MT61D
   E_MDKP                         = st_MDKP
 TABLES
   MDPSX                          = int_MDPS
   MDEZX                          = int_MDEZ
   MDSUX                          = int_MDSU
 EXCEPTIONS
  MRP_LIST_NOT_FOUND             = 1
   MATERIAL_PLANT_NOT_FOUND       = 2
   ERROR                          = 3
   OTHERS                         = 4
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

No comments:

Post a Comment