Have to use add-on DESTINATION when using BAPI_MATERIAL_MAINTAINDATA_RT

https://launchpad.support.sap.com/#/notes/1227242

    4. Site authorizations in BAPI_MATERIAL_MAINTAINDATA_RT:

For the BAPI “BAPI_MATERIAL_MAINTAINDATA_RT” in IS Retail, all authorizations of the authorization object M_MATE_WRK are required for all processed sites, even if you are not in the transfer table. This is because the system cannot know which changes will occur later in the process. This is due to the reference handling. Therefore, all reference sites and all sites with existing variances (for the relevant reference site) are processed in addition to the transferred data. This is the known and correct standard system behavior.

Therefore, the user in IS Retail should have all authorizations in the material master. If you do not want this for certain users that use the function module BAPI_MATERIAL_MAINTAINDATA_RT to change data, you can implement the following workaround by using a super user.

To do this, you must call the BAPI function module with the add-on DESTINATION “SUPERUSER”, where you specify an RFC destination that the super user entered as a logon user with all authorizations. However, before you call the BAPI you must ensure that the user does not change any sites for which he or she does not have authorization.

When you fill in the field CLIENTDATA-CHANGED_BY in the BAPI call with the correct user and set CLIENTDATAX-CHANGED_BY to X, the change documents are created for this user and not for the super user.