This wiki purely concentrates on the working of the function module ' BAPI_MATERIAL_SAVEDATA ', which is used for the Creating and Changing the Material Master Data.
The outcome of the usage of this "Material Master Upload Tool" program, which consists of this function module would be that an automated background job can be set-up, which can avoid manual intervention in the MRP Profile assignment to the materials in the material master, thereby saving a lot of time.
The prerequisites required before executing this function module are many. This function module mainly consists of Header Data structure and the structures corresponding to the various views of the material. Some of them are: HEADDATA - Header segment with control information. The view for which data need to be saved can be selected from this structure. PLANTDATA- Plant-specific material data.., The data upload into these internal tables should be done by using the field-symbols. The structure PLANTDATA plays a major role in the upload of the MRP Profile data. This structure at run-time would consist of the Plant and the MRP profile that need to be updated for this particular plant.
For e.g., To update MRP profile 'POLL' for material '52134 SPM' , the first step would be to select MRP view from header structure HEADDATA for the above material.
Headdata-material = '52134 SPM'.
Headdata-mrp_view = 'X'.
Then PLANT AND MRP Profile is assigned to the corresponding fields in structure PLANTDATA
Plantdata-plant = <l_fs_outtab>-plant.
Plantdata-mrpprofile = <l_fs_outtab>-mrp_prof (having value POLL).
The structure 'RETURN' plays a role of capturing all the messages which occurred during the MRP profilel update. These messages can be used to decide further processing.
After all the tables are loaded with the relevant data and the structure Headdata and Plantdata is filled, the function module can be executed.
After the execution of the module, if the 'Return' returns message type S, then all the MRP Profile is updated in the material master. If it returns error message then data is not updated in material master.
Call FM 'BAPI_TRANSACTION_COMMIT' to get the changes reflected IN Material Master.
The process of updating the material master is a critical task in any ERP environment because material is the basic entity and any wrong update can cause serious consequences. Mass material maintenance which cannot be done manually and are prone to many errors can be done with the help of this function module and the entire process can be automated.