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:

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:

ExecutableApplicationDescription
vsropsvr.exeTVSRVehicle 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.exeTVSSVehicle 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.exeTVRGTransportation 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.exeTSPSCarrier/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.exeTSFMStrategic 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.exeTVSOLoad 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. 
SAP TM Optimizer applications

Planning profile configuration

In addition to the basic connectivity setup between SAP Transportation Management and SAP SCM Optimizer, we need to maintain the necessary planning profile configuration.  This is done using the TM Fiori menu path of Profiles & Settings > Edit Planning Profile and involves a significant number of settings that can influence the optimizer behavior.  

While we will not go into a detailed explanation of every setting within a planning profile, let’s highlight a few key areas of configuration:

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:

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:

As long as the aforementioned settings are maintained, the next time that particular user executes an optimization, we can proceed to transaction RCC_LOG and review the results, including access to the raw input and output files.  If the optimization run was executed from the Transportation Cockpit application, then using the Explanation button at the top of the screen will take you to the same place.

Transaction RCC_LOG initial screen shows a table of optimizations that have been launched and sorted by date and time of execution:

Clicking on the icon in the “Ext.Column” will take you to the Optimizer File Analysis screen, which provides a UI to review the inputs and outputs of a particular optimization run.  It’s worth noting that this icon only appears in a select few application scenarios – TVSR and TVSO.  For all other application scenarios we have to rely on review of raw input and output files.  

Once inside the Optimizer File Analysis application, we can utilize the tree structure on the left to navigate around.  All the information associated with the *.in input file is displayed under the “Input” folder, while data associated with the *.out output file is displayed under folder titled “Result”.

From here we can navigate to detailed information associated with each optimization.  For example, by double-clicking on the Freight Units folder, we can review root and stage-level data of Freight Units that were part of the optimization.

Note that anytime you see a piece of data that is underscored, such as FU UI or Source Loc in the example above, it is actually a hyperlink that will take you to display transaction associated with that particular object.

One area that is particularly useful while troubleshooting optimization results is under Result > Freight Units > Messages for Stages where we can often locate clues as to why a particular Freight Unit stage failed to plan through optimization.

In certain cases, using the Optimizer File Analysis is not sufficient or even possible.  For example, in cases when troubleshooting requires the creation of an incident with SAP you will need to attach raw input and output files.  To access those files, select an optimization in transaction RCC_LOG and then use the top menu “Extras”.  For SAP incidents you will want to choose the “Compressed Archive File” option.  However, if you just want to review the raw input and output files yourself, you can choose “Download Data File”. Keep in mind that in both cases, you will download archived files with extension *.gz that you will need to extract to get to actual *.in and *.out files, which you can then open in any text editor such as Notepad++ or TextMate.

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.

The primary mechanism for enhancing the data inside the input file is “Optimizer Pre-Processing” BAdI. There are several of such BAdIs present, but the one is typically utilized the most for VSR optimization is BAdI /SCMTMS/PLN_PRE_PROC with method CHANGE_OPT_INPUT.  This BAdI provides full access to all of the tables that are passed to the optimizer via the input file and allows us to insert/update/delete entries in those tables.  Here are some examples of enhancements that can be achieved via this BAdI that are otherwise not currently possible via standard configuration in SAP Transportation Management:

Another less-known mechanism for influencing optimizer behavior is through the use of RCCF Expert Parameters.  Such parameters can be maintained globally or specific to a particular planning profile.  They are maintained via transaction RCC_PARAM and are generally considered “last resort” as they often lead to unwanted side effects.  On top of this, SAP does not document the use of these parameters very well (on purpose) and so there is no formal list of all possible parameters along with their impact on optimizer behavior documented in a single concise list.  Instead, we have to rely on SAP support or existing SAP notes (for example 578044) to help understand what kind of behavior is achievable via such Expert Parameters.  Here are some examples:

Additional Information

Thomas Engelmann from SAP optimizer team has published a wonderful series of articles on TM optimization that you locate here.

A good starting point for the topic of Planning in SAP Transportation Management can be located at the following link on SAP Help portal.

This SAP help page provides an overview of constraints used by VSR optimization in SAP Transportation Management. 

For general SAP Transportation Management topics, refer to our FAQs for SAP Transportation Management and S/4HANA Embedded TM.

Leave a Reply

Your email address will not be published. Required fields are marked *

XpertMinds

Sign up to receive latest news, updates, promotions, and special offers delivered directly to your inbox.