Using Mapping Tables

Objectives

After completing this lesson, you will be able to:
  • Create a mapping table class.
  • Explain the difference between a mapping table class and a mapping table.
  • Create a mapping table.
  • Use mapping tables in price plans.
  • Fill a mapping table with data.

Introduction to Mapping Tables

Mapping tables allow us to store data like prices or other information, which might change regularly. The advantage of using tables is that the data can usually be modified by external systems using the APIs of SAP Convergent Charging, without necessarily having to modify price plans of charges.

If you are familiar with relational databases and their tables, then you will probably assume that the tables in SAP Convergent Charging work in the same way. However, there are some significant differences:

  1. Mapping Tables in SAP Convergent Charging have three mandatory columns:
    1. Identifier
    2. Start Date
    3. End Date
  2. One to 40 input columns can be declared. Input columns contain the data, that is used to find an entry in the table. In a database these columns would be considered to be part of the "key". Input columns can have the datatype string or currency. The currency datatype is a string, which consists of all possible ISO / SAP currency codes known in the corresponding currency dictionary.
  3. One to 30 output columns can be declared. Output columns contain the data, that is associated to the data in the key-columns.
The columns of a mapping table class.

In the SAP Convergent Charging Core Tool, a typical mapping table could look like this:

Example of a Typical Mapping Table.

This table expects a service level agreement value (column SLA) and a currency code value (column CURRENCY) as search criteria or inputs. For a certain combination of such values, it associates a price (column AMOUNT).

The identifier column is always part of a mapping table. It serves as a primary key to address a single line of a table using the APIs, but it cannot be used as a search criterion when reading from a table within a price plan tree.

The interval that the table line is valid for is contained in the validity columns. When searching a table with a set of search criteria, a reference date must be provided. A result only contains those lines which match the search criteria, and are valid at the given reference date.

Output columns can have the data type string or number. This way you can store numerical values like prices, as well as alphanumerical values like country names, colors, and so on.

Mapping Table Classes

In SAP Convergent Charging the structure of a mapping table is defined separately from the data that one or several tables contain. The separation is done by defining the structure of a table as a so called "Mapping Table Class". Once the class is defined, you can create several mapping tables of the same structure by referencing the class. You cannot create a mapping table without referring to a mapping table class. The class is mandatory during design.

The mapping table class for the table described looks like this:

Example of a Typical Mapping Table Class

Creating Mapping Tables

New mapping tables can be created by choosing FileNewMapping Table Class in the Core Tool. Each mapping table class must be given a name. You must provide at least one input column, and one output column to the class. A column must have a name and a description text, as well as a type. The additional information tab contains optional information. The information added to this tab is not accessible in the price plan. It can, however, be used to restrict access to tables for different user groups via the SAP Convergent Charging Cockpit.

Once a mapping table class has been defined and saved to the database of SAP Convergent Charging, the input columns and output columns are fixed. It is not possible to add or remove columns once the mapping table class is saved. However, it is possible to open the mapping table class as a copy and then add, or remove columns as needed. The new table class can then be saved using a different name.

Mapping Tables

Once the mapping table class is defined and saved to the database, a mapping table can be created with reference to the existing mapping table class. All tables created with reference to the same mapping table class share the same input and output columns. To create a new mapping table, you need to choose FileNewMapping Table. Provide a name for the new mapping table and select the mapping table class your new table is based on. When you change the mapping table class to be used, the table columns will change accordingly.

On the Table Instance tab, you can maintain the table content. You can either manually add and maintain line by line, or import the table content from the comma-separated value file (CSV file). Importing table content using a CSV file makes it easy to import thousands of table lines in one step.

The easiest way to create a template for the CSV file format is to add a line to the table, save it, and export the table data into a CSV file.

Each mapping table can be found in the catalog within the Mapping Tables group.

Mapping tables can technically be accessed by any subscriber account. Therefore, mapping tables are best suited for data that should be available to all, or most of the subscriber accounts of a system.

Subscriber Mapping Tables

When you want to store data in a mapping table that should only be accessible to a specific subscriber account, you should use subscriber mapping tables. Subscriber mapping tables are similar to mapping tables. They use the same mapping table classes as mapping tables. However, they are assigned to a specific subscriber account. Only the subscriber account the table is assigned to can read from the subscriber mapping table.

Agreement Mapping Tables

Agreement mapping tables are like regular mapping tables, as they can be accessed by several subscriber accounts. Each table is given a so called Agreement ID. These tables are used when SAP Subscription Order Management is creating master agreements. As these master agreements are shared across several subscriber accounts, this table type is used to store the data relevant for rating that is part of the master agreement. Another key difference is that agreement tables are not read when the catalog is displayed. They are read when the subfolder with the agreement tables is expanded, which optimizes performance, and allows management of more agreement tables than mapping tables within one SAP Convergent Charging system.

Using Mapping Tables in Price Plans

When the mapping table name is supposed to be read, the comparator component Mapping Table Introducer must be used.

Using the Comparator Component: Mapping Table Introducer

It creates two outbound branches in the price plan. The first branch is executed when an entry was found in the table, while the second branch is executed when no entry could be found.

The outbound branches of a mapping table comparator component.

When a mapping table is checked, the mapping table introducer component needs to know the mapping table class that the mapping table check is based on. This information is key, as it tells the component which input and output columns it will deal with at runtime.

The name of the mapping table to read from can be provided by a parameter of type Mapping Table ID or by choosing a specific mapping table at design time. Using a parameter allows the mapping table instance to be determined at runtime, which provides more flexibility.

Using a Parameter to select the mapping table to check.

The Reference Date field requires a property of the data type date to be selected, which serves as the baseline to determine a valid line. Only those lines that are valid at the date and time stated by the reference date property are considered a hit.

The column for longest prefix match setting allows to non strictly matching of the input property value against the table’s column value, but rather a check for the value that matches the longest prefix. This is important when you need to find the closest match for a hierarchical zone logic. The value in the table is considered the prefix.

In the Mapping of Rating Context section, you must assign a type-compatible property to each of the input columns. The comparator component takes the values from all these properties and go through all table entries from the top to the bottom, until it finds an exact match for all of them. If you selected a column for the longest prefix match, this column will not be checked for an exact match, but for a longest prefix match instead.

The Mapping of Generated Properties section contains all output columns of the table. In the Generated Property Name field the output property name is stated, which will contain the respective result value further down the Row found branch of the price plan tree. You can rename these property names as you see fit by double-clicking into the Generated Property Name cell.

If the comparator component couldn’t find any table line matching the input search criteria, then the branch Row not found is taken. The generated properties of the component will not be available down that branch. But not finding a line is necessarily a problem: You can search several tables–one after the other–until you find an entry. This is common practice when you organize prices on different hierarchical levels (contract level, subscriber account level, general level). In that case, you search from the most specific (contract) to the most general level (general). Prices of each level could reside in a dedicated table, which results in a cascade of table comparisons. Only when the last check doesn’t return any result calling a No Access function does it make sense.

How to Create Two Mapping Tables to Store Price Information

In this video, Melissa shows Jonathan how to create two mapping tables to store price information for CPU and RAM usage for the cloud selection service. First, a new common mapping table class is created to support prices for both services. After the class is ready, two distinct mapping tables will be set up and maintained with the prices for CPU and RAM service usage.

How to Create a Usage Charge Using a Mapping Table

In this demo, the charge calculating the CPU usage fees are updated. These fees are based on a prefix switching component to read the price information from the mapping table that was created in the previous video.

The demo also shows how to use the trial run feature to test the charge logic.

Log in to track your progress & complete quizzes