cancel
Showing results for 
Search instead for 
Did you mean: 

Determine the sales delivery plant always from material master

jrgkraus
Active Contributor
0 Kudos

in SAPMV45A, we added code to USEREXIT_SOURCE_DETERMINATION that makes the program take the delivery plant from the material master data (mvke-dwerk), when an item is added to the document, and it works fine.

However, when we change the goods recepient afterwards, the delivery plant is being overwritten by the value stored in the customer master. I am now searching for a possibility to avoid this. I am wondering if there is a better way to influence on the path, which is taken to determine the delivery plant (material/customer-info, customer master, material master), changing it to only consider the material master.

Any suggestions?

Accepted Solutions (0)

Answers (1)

Answers (1)

VeselinaPeykova
Active Contributor
0 Kudos

Probably I failed to understand the whole story...

If you wish to determine the delivering plant always from the material master - why do you need custom code at all? Just don't maintain plant in the CMIRs and customer master records.

Well, if you intend to overwrite what a user sets manually as delivering plant in the order, then, yes, you need custom code, but it is not a very nice thing to do.

Why do you maintain plant in the customer master data if you do not plan to use it?

Or should this logic be valid only for a subset of all your materials?

Probably I am doing something wrong, because when I made a quick test in a ECC6 sandbox, the logic in the exit is triggered when you change the ship-to-party and select redetermine from the popup. If you choose do not determine, then nothing is changed, the exit logic is not called, but this should not be a problem if you have already determined correctly the delivering plant.

I am not a developer and I did not actually write any code in the exit. What I did was: I set a plant in the material master, say 9620, created an order for customer 227 for which I have plant 1200, changed VBAP-WERKS to 9620, saved the order. Then I changed the ship-to party with customer 228, for which I have plant 9610, changed again vbap-werks in userexit_source_determination to be 9620... all went well. I also tried changing ship-to parties in VA01 - again no issues.

Apologies for asking something that you have probably looked into, but can it be that the delivering plant value is set by logic in some other place as well, e.g. in mv45afzz, userexit_move_field_to_vbap? It should not be the case, but still - no harm in double-checking.

If you post some code example I could try to replicate the problem (I am a bit curious what is causing the described behaivior).

jrgkraus
Active Contributor
0 Kudos

Thank you for caring - there is nothing wrong with your doubts. In fact, I omitted a fact: when the delivery plant of the material is not set, the plant of the customer should be used. SAP implemented it the other way round: only when the customer has no delivery plant, the plant of the material is used.

The problem is, that the popup you mentioned does not appear in one of our use cases, where we trigger the creation of an order from a quotation using batch input. Using mode "E" we make the transaction stop the automatic process on the main screen of VA01 to give the user the possibility to change the customer. Therefore the transaction is in batch input mode and does not show the popup. The delivery plants of the items are being quietly changed. Maybe I should look for a different solution here.

What I was asking the community is if maybe there is a more simple way to override the standard logic that treats the customer delivery plant with higher priority than the material delivery plant without having to change (too much) coding in the user exits.