TM Cost Distribution Document duplicate charge posting
In S4 HANA embedded TM (Transportation Management), cost distribution is used to split the freight and related charges from the carrier over to the materials on the original purchase or sales orders (any other transportation-relevant documents).
Firstly, the freight and other carrier charges are transferred from the freight order to the freight settlement document at a summary level. The usual accounting treatment across many industries is to accrue this total charge to a balance sheet/clearing GL account. Next, using the “cost distribution” document functionality, these charges are allocated to all the products (materials) involved in the shipment (either inbound or outbound). The allocation can be posted to a COGS (cost of goods sold) type of P&L (profit and loss) account. In this blog, I will call it an “expense” account to keep it generic.
In S4 HANA 2020, a common error encountered is to see a “double or duplicate” posting of this cost distribution document. One can also come across this issue in some other related areas where S4 HANA settlement management functionality is used. The next section will describe the issue taking one example of posting freight charges worth $0.10.
Figure 1 shows the service PO that is created by the freight settlement document posting. The charges ($0.10) from the freight order are transferred over to this service PO via the freight settlement document (acronym FSD).
If the cost distribution process is activated, there are chances that you will see the “duplicate” posting on this type of document. Figure 2 shows the errored entry example ($0.20).
If you encounter a similar issue, there are several ways to get around this problem. One of the options is to use the following BADI “WZRE_DET_CONTR_FIELDS_BADI” (Figure 3) and check if it’s activated in the system. If this BADI is activated (most likely this will be activated in your system), then use this method to write a custom code to remove the duplicate entries from the “control fields” internal table. Using this BADI, we can remove the duplicate charges by just using a simple “delete adjacent duplicate ABAP statement”.
This next section describes this duplicate posting problem with an example of T accounts.
Figures 4 and 5 show debit and credit entries for the Service Entry confirmation. Take an example of $100 freight charges. Service entry confirmation posted by freight settlement document is just like the receipt of the goods for the purchase order (in this case a freight service purchase order).
If a duplicate posting occurs during the cost distribution posting, the following issue would be found (doubling the expense account balance and the corresponding balance left under the Freight Clearing GL account). Figure 6 and 7 shows the debit and credit side entries in an incorrect cost distribution document. Once we enhance the BADI and remove the duplicate charge elements, the expense accounts and their corresponding offset will be posted at $100 as desired.
This concludes this blog about the issue found around duplicate posting for TM cost distribution and one of the ways to avoid the said accounting error. There are a few configuration routes available as well but I have found this BADI method as the most flexible.