Although customer cash discounts form only a small percentage of the overall P&L of a company, they can be quite important, when it comes to the overall profitability of a specific customer.
Therefore it is not advisable to assign these postings to a generic internal order or even cost center in OKB9. Rather an assignment directly to the correct profitability segment is recommended.
ERP 6.0 with costing-based CO-PA
In ERP 6.0 with costing-based CO-PA the standard solution involves implementing user exit COPA0005 and then add some custom coding to include ZXKKEU07.
Solution for S/4 Margin Analysis
In Margin Analysis in an S/4 system there is no direct equivalent as noted in SAP-Note “2559609 – FAQ in CO-PA (Part V.)” – item 13. So when implementing Margin Analysis what is the new solution?
As explained in the New G/L related SAP-Note “1652002 – CO account assignmts/customer fields as doc splitting chars”, the solution in S/4 is actually much simpler than in ECC 6.0 – provided you have activated the document split functionality of the New G/L as is explained in the above mentioned COPA FAQ note. It involves no coding at all. It is indeed sufficient to add the profitability segment (PAOBJNR) as a “Controlling split criterion” in the customizing of the document split functionality under Financial Accounting->General Ledger Accounting->Business Transactions->Document Splitting->Define Document Splitting Characteristics for Controlling.
From my own testing the only prerequisite seems to be, that the inheritance of the invoice for the payment including the cash discount only works correctly, if the new customizing setting has been in place, when the original customer invoice was posted to Accounting. Otherwise, the cash discount line will not be enriched with the profitability segment of the customer invoice.
I hope this helps especially when implementing a green field S/4 system with Margin Analysis, as the direct transfer from ERP 6.0 with costing-based COPA is far from obvious.