The following scenario considers internal produced materials and determination of actual value using the material ledger.
The SAP client where I am working has defined that the COGS account changes depending if the customer is related or not to the company corporate group. So far so good, because there is a substitution step that modifies the account depending on the value of a specific field (KNVV-KTGRD) in the customer master data.
The problem arises when performing the ML closing document. At this point I cannot find any data that allows me to link the line item to the customer or sales order so I cannot work any relation that allows me to substitute the account as it was done. The outcome is that the revaluation amount is going to be posted according to GBB-VBR, whereas the original post was posted in a different account.
What I need to know is if there is any way to retrieve the customer (or any SD relevant data) when posting the ML closing document in order to extend the substitution code to the ML closing document.