SAP Transportation Management Optimizer Demystified

The most mysterious part of SAP’s Transportation Management solution is the Optimizer, and it’s not even close. With almost every other functionality in SAP TM, we can always fall back on good old ABAP debugging to clear things up. However, we are not afforded such luxury while troubleshooting or trying to understand Optimizer behavior. And so, it is often viewed as a “black box” solution never to be fully accessible and comprehended. While there is some truth to that, we can certainly help you get a much better understanding of the SAP Transportation Management optimizer functionality and ways of influencing its behavior.

Fundamentals of SAP Transportation Management optimizer architecture

Many of Optimizer’s mysteries are sealed away due to the underlying architecture whereas the Optimizer itself is a separate proprietary program created by SAP and written in C++ programming language, as opposed to ABAP, and that is executed remotely by the SAP Transportation Management application through a defined interface with a set of input parameters. It is important to note that such architecture is not unique to SAP. Many Transportation Management Systems (TMS) rely on a similar approach for optimization, leaving the actual optimizer engine inaccessible for debugging and any type of enhancements.

Despite our inability to see the actual C++ syntax of the SAP SCM Optimizer, we do have some information that SAP has shared over the years on the inner workings of the optimization approach:

  • Most of the SAP SCM optimization scenarios utilize metaheuristic to iterate through possible plans and find the optimal solution.
  • The solution generated by the optimizer is subject to a set of a) hard and b) soft constraints.
  • Hard constraints cannot be violated by the proposed solution under any circumstances—for example, the maximum capacity of a vehicle resource.
  • Soft constraints can be violated, but such violations result in a “cost” penalty. The cost we are referring to here is a statistical cost used to guide the optimization solution, not the actual cost from freight contracts.
  • Ultimately, the best solution is the one that does not violate the hard constraints and results in the lowest possible statistical cost.

As part of every SAP Transportation Management implementation, following the instructions in the SAP TM Master Guide, we are directed to download the SAP SCM Optimizer software package from SAP Software Center portal, which as of the time of writing this article is on version 14.0. We then need to upload the unarchived optimizer package to a Windows or Linux server instance of our choice. Typically, this is a separate server instance from SAP Transportation Management application – one optimizer server for development and QA and a second server for production. The reason for such separation is not only due to Operating System requirements but also due to the spiky nature of optimizer utilization, which is sitting idle most of the time, followed by short bursts of high CPU and memory usage.

Finally, we follow the remaining steps in the SAP TM Master Guide to set up the Remote Functional Call (RFC) integration between the SAP TP application and optimizer server executables. Technically, there are 3 executables on the optimizer server, dealing with 6 different application scenarios, as represented in the table below:

Executable Application Description
vsropsvr.exe TVSR Vehicle Scheduling and Routing. Application used to perform most of the transportation planning functions, such as creation of freight orders and freight bookings from background processing or interactively via the Transportation Cockpit.
vsropsvr.exe TVSS Vehicle Scheduling. Application used to perform the scheduling function against existing freight orders and bookings. This is in some way a subset of the TVSR optimization with a smaller scope, where the system recalculates planned dates due to some change made to the freight order or booking.
vsropsvr.exe TVRG Transportation Proposal. Application used to propose alternative ways of executing transportation for a given transportation demand (freight unit, etc.). For example, it allows planners to compare the options of delivering an order via different means of transport – FTL vs LTL vs intermodal, etc.
csopsvr.exe TSPS Carrier/Service-Provider Selection. Application used to determine a ranked list of applicable carriers or service providers for a given freight order or booking. The primary reason the optimizer is involved in this scenario is to account for business share, transportation allocation and continuous move requirements while determining carrier ranking.
csopsvr.exe TSFM Strategic Freight Management. Application used to determine the optimal carrier assignment on transportation lanes, given historical transportation execution documents and proposed transportation costs submitted by carriers as part of freight procurement process.
vsoopsvr.exe TVSO Load Optimization. Application used to determine the optimal layout of products/pallets inside a vehicle resource, such a trailer or container, given the shape and dimensions of individual packages, stacking restrictions, physical constraints of the vehicle resource including maximum load on vehicle axles.

TM and Optimizer integration

Ultimately once all of the necessary configuration is in place we are able to launch optimization either interactively from within the Transportation Cockpit or in background via program /SCMTMS/VSR_OPT_BGD. When an optimization request is initiated SAP Transportation Management assembles an input file that is passed to the SAP SCM Optimizer executable.

The input file is nothing more than a space-delimited text file with extension *.in containing a number of tables and rows of data that follow.

Here is an example of the formatting within the input file:

// TABLE ET_MOT

// MOT    MOT_CAT DESCRIPTION

// STRING STRING  STRING

01      1       Road
02      2       Rail
03      3       Sea
04      3       Inland Waterway
05      4       Air
06      1       Postal Service

This section of the input file represents table ET_MOT which is used to pass the relevant Modes of Transport from TM to the optimizer. This table contains three columns – MOT, MOT_CAT and DESCRIPTION – and 6 rows of actual data for the various modes of transport configured in TM.

As a result, the input file contains all the data necessary for the SCM Optimizer to perform its function, including:

  • Transactional document details – freight units, transportation units, freight orders, etc. – including ROOT/header, item and stage-level information
  • Vehicle resources
  • Location master data, including inbound and outbound calendars and handling resources
  • Transportation zones and lanes, including associated Means of Transport assignments
  • Incompatibilities
  • Hard and soft constraints maintained in the planning profile that we discussed above

Similarly, the output of the SCM Optimizer is a delimited text file with extension *.out that is sent to and interpreted by the ABAP logic maintained in SAP Transportation Management. It follows the same formatting rules as the input file, containing tables along with data, detailing the proposed solution, including the proposed creation of new capacity documents (freight orders, bookings, etc.), assignment of freight units to capacity documents, as well as the breakdown of statistical costs associated with the proposed solution.

Both the input and output files can be viewed in the raw format using SAP transaction RCC_LOG, if the appropriate logging settings have been maintained.

Enhancement options

Looking at the structure of the *.in input file is helpful for understanding the options we have with enhancing optimizer behavior. While we cannot change or enhance the syntax of the optimizer executable itself, we can change the data inside the input file, thereby impacting the results produced by the optimizer.