When I create a sales order for a material, the plant is automatically determined. I have 2 plants, US05 and US06.
If a material XYZ is marked for deletion in plant US05, VA01 should automatically take US06. This is done in userexit_move_field_to_vbap (Include MV45AFZZ). So, when I save the sales order, the plant is getting overwritten.
Now, when I save the sales order, for the material XYZ, it has plant US06, but the remaining plant master data like Strategy group, requirement type is still from US05. To copy these two fields I have used 2 function modules 'MATERIAL_READ' and 'RV_SCHEDULING_TYPE_DETERMINE'.
Now the problem is: it is copying Plant, Strategy group, and requirement correctly, but for some materials, sales order application is giving some messages and for some other, it is done correctly. VA01 is not consistent for all the materials.
Is there any way to copy the entire plant master data for a material. i.e, if material XYZ is marked for deletion in US05, I need to copy the entire plant master data of US06 and then create a sales order...
Points will be awarded...........
At what level, you have enabled the deletion indicator. It should ideally be done at Sales org/Distribution channel/Plant combination level. If you have not done this, please set the deletion indicator for the material at sales org/distribution channel/plant level.
If this is done, then the master data will not be picked from this level. Instead it will pick up the material master from the correct combination of Sales org/D.C./Plant level.
Another point to note : May be the plant and other details are determined even before the user exit is called. And when the user exit is called only the plant is getting determined. This kind of problems is rampant when user exits are used. So I advise you to debug with the help of the technical consultant and find out what actually happens? Whether the user exit determines teh plant first or standard SAP determines the plant and other details first followed by the user exit just overwritting the plant. If the second case is true, then you may have to find out the correct user exit to determine the plant before the system determines other data based on the plant information.
Hope this approach will help youto solve the problem
You can reward if the approach helps.