This blog purely concentrates on the working of the function module ‘MATERIAL_MAINTAIN_DARK‘,which is used for the mass material maintenance.
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 for the material master maintainance,thereby saving a lot of time.
The prerequisites required before executing this function module are many. This function module mainly consists of internal tables pointing to structures for different views of the material master. Some of them are : AMARA_UEB-Basic view of the material master,AMARC_UEB- Plant view of material master,AMVKE_UEB-Sales view of the material master etc.., The data upload into these internal tables should be done by using the field-symbols. The structure AMFIELDRES plays a major role in the upload of the data. This structure at run-time would consist of a counter ‘TRANC’ which keeps track of the number of fields and the related data to be updated.
For e.g., AMFIELDRES-TRANC = 0 for field MARA-MATNR and the data in that field is ‘1000’. So AMFIELDRES would contain all these details. Each field and it’s related data is given a unique TRANC number. In simple, each combination is unique.
The structure ‘AMERRDAT’ plays a role of capturing all the messages which occurred during the material update. These messages can be processed further through a BAPI function module.
After all the internal tables are loaded with the relevant data and the table ‘AMFIELDRES’ is filled with all unique combinations of the fields which need to be updated, the function module can be executed.
After the execution of the module, if the ‘AMFIELDRES’ table is left empty,then all the data are updated in the corresponding fields. If any entry remains back in the internal table after the function module execution,then that particular entry is not updated. This can be seen only at the time of debugging the program,so the entry which is not updated can be checked for errors through the messages stored in the AMERRDAT internal table.
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.