Skip to Content

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.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Thomas Jung
    I would be very cautious about using MATERIAL_MAINTAIN_DARK directly.  It is not a released function module and it has a rather low level interface.  It is possible through an incorrect combination of interface parameters to create quite a mess. It would be far safer to use one of the public, released BAPIs – like BAPI_MATERIAL_SAVEDATA whenever possible.
    1. Former Member Post author
      Hi Thomas,
          I would be glad if you can provide me details as to why this function module is not a good choice for material master upload,since I am not aware of it.
      1. Thomas Jung
        I pretty much said that in my original comment.  It is not a released function module (check the General Data are of the attributes tab). You should read OSS Note 109533 for the meaning of the different SAP Function Module statuses. In short the usage of any function module without the Released for Customer status is NOT supported outside of standard SAP programs.

        Additionally the interface of the MATERIAL_MAINTAIN_DARK function module is fairly low level and therefore a bit more complex to use. The BAPI that I mentioned is a wrapper around MATERIAL_MAINTAIN_DARK that provides a clearer interface, better documentation – but most importantly – support from SAP because it is Released for Customer.

    2. Former Member
      Hi Thomas,

      Thanks for the FM.

      Do you have infomration of any BAPI for update the accounting view of Material Master ?

      Thanks in advance for your help.



Leave a Reply