calculation of freight costs
SAP R/3 function group for easier invoice writing
deliveries and packages - rates and extra charges
information and contact over

Target of this function
In the forwarding department during invoice writing the freight costs shall be calculated automatically, which arise for this delivery until it will reach the goods receiver. The freight charges can include rates, extra charges, price reduction or insurances and they have to be configurate free and variable and valid for every case, every country, every region and every dispatch type. The program package has to have anyhow to the really calculating an administration program as well as a simulation program and also an overview over all founded rates. The way or path to the result has to show in an understandable and easy way and the calculation tool has to adjust to the SAP standards and reproduce them as similar as possible.

Further a cost comparison is included to check simultaneuos several carriers who serve the same route and you can use the result for lists and other evaluations.

But centre of interest for this program is the simple and very easy maintenance of the involved tables. The whole logic and structure of the keys of the freight zones and their switch over to the access keys are designed in a kind, that as much as possible can again join to a group. Therefore the expenditure in time, costs and maintenance can be minimized, the clearness can be kept and the master data keep in manageable size and won't form a too complex building.

If you like to use the freight calculation module, you need the SAP R/3 system. Special installed modules or program packages are not necessary, because the freight costs function use only common master data tables plus 2 extra generated. Which master data tables are included you can get in appendix B. More technical information you can get under appendix C.

Preparation / customizing
Before the calculation can be start at all, there have to make some settings in the customizing. Essentially it concerns only the pricing and also even there not all functions have to be completly build up. In this documentation we fall back to the standard pricing of the freight calculation, but certainly you can use every other section as well.

Entrance path customizing
picture 1.1.1 - Entrance path for the customizing (transaction /nspro)

Condition type
First ALL condition types have to be created and maintained, which can appear in all shipping agent constellations. In this example all conditions beginning with charges: in the name / description, are assigned to the freight calculation, the others are made for others applications, but can be used as well.

Create a condition type
picture 1.1.2 - Create a condition type

If creating or changing a condition (double click on the condition type) you can set parameters to the choosed condition.

changing a condition
picture 1.1.3 - Changing a condition. Parameterism

The calculation tool checks and navigate only on 2 parameters.

the first is the condition class and it is of central meaning and importance. If in that a B = prices is configurated, then only rates are considered for the value determination. If an E is configurated, then the system uses for comparison the calculated rate up to this moment for the actual rate type (interesting in case of proportional formulas). In all other cases the system looks for extra charges. The difference if rate or charge is done the the key type in the data table for rates.

The second point is the improper use of the field value in the section changes which can be made. If it is checked, the calculation is switched from the gros weight to the net price of all positions of the invoice. This is meaningful if you like to use high value insurance of the delivery.

Calculation procedures
After all conditions are build up, when follows the concatenation of the single conditions to a calculation procedure or scheme. First the diagram or the processing of the procedure has to be create and titled.

Create a calculation scheme
picture 1.2.1 - Create a calculation procedure

By marking the procedure and double click on cpntrol data the system will direct you to the concatenation of the condition types.

condition types in the calculation scheme
picture 1.2.2 - which condition types will be touched at which position inside the calculation diagram

The sequence of the conditions, when is used which, is important, if proportional extra charges or reduction shall be calculate, because they relate to the actual, up to this moment calculated sum. The from/to staggering is not be regarded ! For fixed prices and values, which are based on formulas and the weight, the sequence in inrelevant.

Mandatory flag: if the flag is checked, the condition is mandatory in the calculation, that means that it has to be founded a value for this condition type. If no value can be found, the system sets an error, except an condition requirements is given to the rate. Important is, that the condition was found, insignificant, if the requirement will give a rate or not.

Requirement of a condition: if a requirement is set to the condition in the scheme or procedure, then this requirement is processed during the pass through of the calculation. In case that a requirement is set direct in the rate or charge, this requirement is processed, because she is more specified. In contrast to the SAP standard the requirement is programmed inside the calculation function group as a function, but as normal ABAP code. The kind of programming has the advantage that it is possible to use already calculated variables or internal tables without reading another time. As in SAP too, the function finishes in the name by the requirement. Example: Requirement 901 will search for and call function function group_KOBED_901.

Administration program
The administration program to the calculation tool allows the mainteance to all 4 tables, which are ecessary for the direct use in the calculation. The possibilities of the functions are in all 4 screens the same. All functions like create, maintain, change, copy or delete are integrated. Changes inside the master data keep on temporary stock as long as it is not saved. Only at the point of saving all changes will transferred on physical disk. On jumpojng on another table screen or when you like to leave the program without saving the system will remember and ask, if you like to save your changings or not.

new selection Back to the beginning and make a new selection or filter other words and expressions for the display mode.

Jumping inside the tables

connecting freight zones Setting and connecting freight zones. The interface or first table between the SD document and the calculation. With the values out of the SD documents the freight zone will searched, which will fulfil the pattern.

Swithced keys Switching from the founded freight zone to the internal rate keys. The detected freight zone is only the base for the further processing and the keys used there. The keys are hold, which are responsable to get the rates and charges and another key for the general data, with which parameters the calculation has to be done.

general data Jump to the general dates of the calculation. Here you can define, with which parameters the tool has to work, like units of measurement or currencies, as well as the maximum values for weight, length, width and height. For airfreight deliveries also the special factors and forms of IATA regulation will deposit here.

rates and charges Rates and charges. All values are guarded here.

Due to the fact that the calculation is based on finding more than only one tariff zone , you have to pay attention then create the data base, that a difference is inside the record key. Therefore the field postal code can be used when appending an index to the postal code itself.

Background for multiple results on one route or relation are for example if you like to get rates on cargo flight connections. The airline or carrier flies to several destinations in the country, where you like to ship your freight, but doesn't fly every day and there can be a price difference for each airport. The starting point and basic fields to detect the right tariff zone are the same (shipper here airline, shipping type or conditions here airfreight, country and postal code), but you like to start several different calculations.

Data interface inside the administration program
Additionally the administration offer to upload and download the master data for the freight calculation from external files. While upload the SAP ddic-tables you have the choice between a xls-file (Excel) or a txt-file (normal text, fixed structure). The building of the external file, which field has to be placed at which position in the structure, are fixed prescribed (see appendix A). The data file names, from where had to be read, are variable and can be tipped into while enter the system on the selection screen. You have the possibility to read the data from a file system (platform, xls and txt) or get by FTP (only txt). The upload destroy the whole existing data archive.

Note: Changing data and files by FTP is done the another universal developped function group of BJH Software and so not only fixed and programmed for the caluculation tool.

Entrance to the administration
2.1 - Entrance to the administration program. Declarations of the files, which are used for the data interface. The names are the same for input and output.

Upload and download are done in the general administration screen by pushbutton in the task line above the regular work, as shown inside the picture below. These pushbutton are active in all maintenance screens and will interrupt all chenagings immediately, also the question save changings will not appear. There is no necessary, if the data are destroyed and lost and overwritten in the next instance.

Upload and download
2.2 - Upload and download data. Start off inside the administration screen

Simulation program
Testing program for the calculation. With this program you can enter all necessary data manual or you can fetch the necessary data out of a SD document, where you only have to give the invoice number. In this case the fill up of the necessary data are fetched from the SD documents like delivery and handling units. The SD type is an export parameter. In standard the invoice is defined, because a collective shipment (join several deliveries together) is not configurated unter the module SD. The freight costs calculation tool is independant to modules !

First screen for the simulation program
3.1 - First screen for the simulation program

To make the enter of data more easier, already some preselections are given as pushbuttons. Click them and the hidden data will appear. Certainly a changing of this values is possible.

After starting the program will run in the function group of the calculation and give back after leaving the result, detailed in a single overview over all conditions and also the parameters, which you have entered at the beginning. Additionally also the values of the founded paths and records are shown as well as the upper limit inside of the selected item of the rates and charge table. So a very easy checkup can be made and errors shall be detected and explained very fast, why a package can not be calculated. If a rate is connected with a requirement and this requirement is false while checked, the rate will nevertheless saved as null set. But in this case the display isn't fitted with the green point, a yellow triangle is painted. Only in error case a red led shows you an interrupt and the finish of the calculation, but the program decide the stop point, when go back. Intension was to collect as much information as possible.

Result of the simulation
3.2 - Result of the simulation

Interpretation of the result
In the example in the frame all data are shown, which have be entered at the beginning. Further all dates and keys the calculation tool have found. The shipment is a delivery to Japon, forwarding agent is registrated by the number 234685 and validated as Lufthansa. The system has detected the freight zone Lufthansa flight to Narita (airport of Tokio - Japon), rates and charges are calculated by the freight tariff of Lufthansa Japon, but the general data like customizing and maximum ranges will done by switched to the Lufthansa freight key.

The light green line is the total sum in Euro, because at the beginning the amount was desired to show in Euro, even though the rates for airfreight are configurated in the general data in US-Dollars. Behind that the freight weight (volume or gross weight), added over all positions. The light yellow lines symbolize the facts of every packages or handling unit, first the freight weight, the flag B = gross weight or V = volume, then the gross weight and dimensions of the package. The system converts between the single length and weight units.

A little bit indent all rates and charges are shown with its condition type, the value and the currency as well as which rate table record has been selected. To the condition Zoll a requirement is configurated, but this was not true. In the example the requirement is true, if the delivery has to be shipped to China or Hong-Kong.

In case of an error a red light is blinked up as warning. The system decides at which point it will interrupt its work, at which point it will be impossible to collect more information. The procedure is first to check all shipment datas, if successful all keys will be searched to determine the freight zone and its switches. If this can also pass without error, all packages are checked on correctness, like if the handling units are not to heavy or to long. If still no problems have caused, the rates and charges will be calculated.

error case
3.3 Error while prechecking.

The data are the same as in the first running, only the packages have been changed a little bit. The shipment data were perfect and impeccable, the freight zone could be determined, package 1 has no objection. At package 2 were is a problem with the weight (maximum permissable weight is exceeded, 150kg are allowed) and for package 3 no height is given. To the head data only the first error is transmitted.

Comparison in forwarding business
Forwarding departments need for a cost-effective shipping for their goods the comparison of the freight costs of several carriers and shippers, who serve the desired line or dispath to the desired country / destination. Also it can be of interest, how great is the price difference in normal or express shipping. For both possibilities the simulation program and the calculation tool offer the solution: if you as the export manager or sales assistent enter in the fields forwarding agent and / or shipping type a question mark, these fields are excluded when the calculation software will create its keys to search the tariff zones for the relation from the transportation planning point to the final destination. Every founded shipping agent and / or its shipping types are calculated single and the results are saved in blocks. So you have the best overview about the results which you can use in your statistics and find the ideal way for your transport.

Comparison in forwarding business
3.4 Result of a calculation comparison for a shipping to Japan

All options for a shipping from Germany to Japan shall be evaluated simultaneously. The result shows all couriers and carriers which the system found in the example database. UPS (plus 10% fuel extra charge, KRSN = kerosene) as well as DHL plus the 2 Lufthansa Flash connections to Tokyo and Osaka. The most cost-effective carrier for our package of 8,8 kg is displayed in the top summary, but the yellow triangle shows that more than one carrier are detected and calculated by the software.

Appendix A
Data structure for the freight zones

This table correspond to the structure of the SAP standard table TVFPTZ.

Data structure for switching the key

This table correspond to the structure of the SAP standard table TVFTZ appended by some own used fields.

Data structure general data and parameters
own developped table, the fields of this table won't be publicated

Data structure for the rates
own developped table, the fields of this table won't be publicated

Appendix B

DDIC tables, which are used inside the calculation
ADRCAddresses (central address administration)
KNA1General Data in Customer Master
LFA1Vendor Master (General Section)
LIKPSD Document: Delivery Header Data
T006Units of Measurement
T173Routes: Mode of Transport for Each Shipping Type
T681VConditions: Usages
T681ZConditions: Dependent Data for Application/Usage
T683Pricing procedures
T683SPricing Procedure: Data
T685Conditions: Types
TCURCCurrency Codes
TTDSOrganizational Unit: Transportation Scheduling Point
TVFPTZTariff Zone Assignment for Postal Code Area
TVFTZTariff Zones for Shipment Costs
TVFTZTDescription of Tariff Zone for Shipment Costs
TVSBShipping Conditions
VBFASales Document Flow
VBPASales Document: Partner
VBRKBilling: Header Data
VEKPHandling Unit - Header Table

Appendix C
Use and technical information
Stateprogram package is for sale and ready to use
Sales protectionno, prgram is free marketable
Client restrictionnone
Module restrictionnone
focussed modulesSD (sales and distribution)
LE (logistic execution)
Usepricing, comparison
SAP R/3 version 4.6c
Client extensionscoding of the requirements, if needed
package involvesadministration program
simulation program
function freight costs, parameters transferred
function freight costs, based on SD document
functions for requirements

The program is for general use and can be implementated in every SAP system without great efforts or man power. The function is not only programmed on demand for a client. Open source, easy to adjust.

Contact, Information, presentation
You like to get some more information about the freight costs calculation tool or even like to use it inside your company, embedded inside your SAP configuration and environment, I like to invite you not to hesitate to get in contact with me.

BJH Software
Phone: +49 (0)172 / 5411605