Step by step through rail freight cost accounting in SAP S/4HANA TM

Alexander Regin-Lück

Alexander Regin-Lück

All SAP TM rail benefits at a glance.

In these last weeks we started our multi-part blog series about the digitalization of railway and shipping processes with mapping in integrated solutions. After the focus in the last two blog articles was on master data in SAP TM and basics as well as planning of wagons and cargo, we now deal more intensively with the accounting of railway processes in SAP S/4HANA TM.

The subject of freight costs is becoming more and more of a priority for companies as a result of growing competition and the associated cost pressure. Cost structures should be efficient and transparent.

The basis of freight invoicing is formed by different data of the freight order, e.g. the type of wagon, the weight of the load, the shipping railroad station and the receiving railroad station. To ensure that all these parameters are transparent along the transport process, the standardised CIM consignment note was introduced for exchange between the parties involved in the transport. Initially still as a standardised paper format, it has also been used for some time for digital exchange in electronic form.

CIM rail waybill - the hub of all rail transports

The most important document in rail freight transport before the transport is invoiced is the CIM waybill. In the rail freight business, the CIM waybill (CIM: Règles uniformes concernant le Contrat de transport international ferroviaire des marchandises) is a document that accompanies the goods and is issued when the goods are transported by freight train.

Example of a CIM waybill:

Example of a CIM waybill

The document is part of the TM template of leogistics. After the loading is reached, the event “Loading end” is set and the CIM form is created automatically. The document can be viewed in the freight order via the tab “Output management”. SAP TM sets the execution status to “In execution” based on the event “Loading end” (after completed wagon loading).

Event-based transport execution

As shown in the previous example, the transport execution in SAP TM is based on events.

Automated adaptation to events

A time stamp is set after each process (e.g. railway carriage has been provided, train has left the station, etc.). The time stamp contains the ACTUAL date and time as an event. The data input for the events originates from other systems, such as myleo/ntntnt or SAP Event Management. The data is transferred to SAP TM. The tab “Execution” is useful for a wagon scheduler to know where the wagons are located at any time. Thanks to Track & Trace, real-time monitoring of the wagons is possible. We take a closer look at the topic of Track & Trace in the fourth article in the blog series.

A distinction must be made between “expected” and “unexpected” events.
You can find examples of expected events in the second article of our blog series (s.

An “unexpected” event is, for example, a disturbance on the train path with a standstill in operations. A transport planner thus has an overview of disruptions or delays and the associated effects on the further transport chain. If an “unexpected” event occurs, it can be inserted automatically via an external event system, for example. The planned event date of the subsequent events will then automatically be shifted into the future (by the delay caused by the “unexpected” event). The system can also call up follow-up actions by the transportation planner or, depending on the business rules defined, trigger follow-up actions.

The occurrence of unexpected events can also change the freight costs calculated in advance. Thus, SAP TM makes it possible to settle transports event-based.

In addition, notes can be entered in the view and attachments (e.g. files) can be inserted. For example, a wagon scheduler can add a note regarding a damage and pictures as attachments.

The tab "Executiom" in the railcar unit

After the input parameters for shipment cost settlement have been shown, we will now begin to introduce shipment cost management in SAP TM.

Charge calculation and freight settlement in the transport process

The following diagram shows the typical process of the charge calculation and settlement in the transportation process:

Freight calculation and accounting as part of the transport process

Structure of Freight Cost Management in SAP TM

Freight cost management in SAP TM is divided into the areas of charge calculation and freight settlement.

Charge calculation

The structure of the master data for charge calculation is structured as follows:

1. Freight agreement 

Freight agreements are contracts between the purchasing organizations of a company and logistics service providers (railway transport company, traction service providers, etc.). At least one freight agreement is created as master data for each logistics service provider. The following figure shows the freight agreement header in SAP TM.

The header data of the freight agreement

2. Calculation sheet

The calculation sheet is a hierarchical table. Here, the individual TM cost elements relevant for the calculation are maintained.

The calculation sheet in the freight agreement

3. Rate table and Scales 

Rate tables are called up in calculation sheets so that prices can be stored on the basis of configurable scales and scale values.

Example of a rate table with scales in the freight agreement

In the rate tables different options are used for the calculation of transports depending on the type of production (block train / wagon group / single wagon), the most important ones are shown in the following table:

Calculation options Description
Fixed prices For single wagons, wagon groups and block trains.
Prices by weight For single wagons and wagon groups.
Minimum prices (Minimal) For trains and wagons (e.g. in a unit of weight such as tons) and in number of wagons per wagon group / train there is a minimum price ( minimal).
Alternate calculation A balance between two scale levels, whether the price for the higher scale level is used (if the total price for a transport is cheaper). You must consider from when the higher scale level is cheaper (break even).
Standard and special trains The regular train is defined in advance and used "regularly" for rail transport. The regular train is more favourable than a special train in terms of freight costs. A special train is booked in addition to a regular train (usually once). The special train is more expensive to use than the regular train.
Demurrage charges (stand fees) for empty wagons If rented wagons are left on the factory premises for too long, a demurrage charge (stand fee) will normally be invoiced. The demurrage can, for example, be subsequently included manually in the calculation sheet of the freight agreement (event-based freight settlement).
In order to reduce demurrage charges, it is important for companies to have transparency about the standing time of empty wagons, that is, the rail wagons are booked in and out on time. The leoRail Solution offers such a possibility.
Besides rented rail cars, companies are increasingly using their own fleets of cars (private cars) in order to reduce costs and avoid demurrage charges. The use of these fleets can be optimally planned with leoRail (

Example of minimum price ( minimal): Wagon group with minimum price of 600 € per wagon and price per ton: 15 €

Wagon Total weight of the load per wagon Total price of the load per wagon
Wagon 1 30 t 30 t x 15 €/t = 450 € -> Minimum price: 600 €
Wagon 2 35 t 35 t x 15 €/t = 525 € -> Minimum price: 600 €
Wagon 3 40 t 40 t x 15 €/t = 600 €
Wagon 4 45 t 45 t x 15 €/t = 675 €

For wagons 1 and 2 the minimum price of 600 € applies. Example for alternative calculation: Wagon transport with a total weight of 38t.

Weight scale Preis per t Total price
Starting at 30 t 16,00 € 608 €
Starting at 40 t 15,00 € 600 €
Freight Settlement

After the charge calculation has been carried out in the freight order, the freight settlement is usually started after completion of the transport execution. By means of the freight calculation in SAP TM the accrual of freight costs is triggered and the verification of an invoice coming from the RU for transport costs is prepared. Freight settlement includes an integration into the materials management, because the actual invoice verification is done in the logistics invoice verification of SAP ERP (MM module). Transferring the data from the freight settlement document creates subsequent documents, including a service purchase order and a service entry sheet.

Thereafter, depending on the agreement with the railway ransport company, the entry of the incoming invoice and invoice verification or a self billing process is possible.

Preview to the final of this blog series

Following the extensive insight into the world of freight costs in SAP TM with a focus on rail freight, the fourth and final part of our blog series deals with reporting in SAP TM and the integration of SAP TM with leoRail.

Have we caught your interest? Then follow our blog series or contact us directly.

If you have any questions about this or other topics on the blog, please contact

Nina Mallien
Matthias Platzer
Alexander Regin-Lück
Consultants SAP Logistics 



Are you interested in state-of-the-art logistics solutions? Then I am your contact person. I look forward to your call or your message via contact form.

Stay up-to-date

Sign up now and get access to our free whitepaper and downloads.