SAP PI 7.1 Mapping Enhancements Series: Using Graphical Variable

Introduction:
Graphical variable is a new feature in the Message Mapping tool of PI 7.1. Among many of the new features, I think this simple feature will probably be one of the most useful, if not the most used new feature in PI 7.1.

Graphical varaible will replace a lot of previously development effort for global variables. It makes the development process much easier and brings a lot of clarity on when a "global" value will be calculated.

This blog will go into the details on its advantages and usage.

Using Graphical Variable:
Let's take a look at the following mapping requirement:
  1. Assign the source's "record" count value to the "recCount" element of every row in the target.
  2. Concatenate the source's "lastName" and "firstName" to the target's "fullName".

image

Create 2 graphical variables:
  1. Right-click on the root node (target_MT) and select "Add Variable".

    image

  2. Name the variable "varNoOfRec".

    image

  3. Create another variable, "varFullName", for the target's node "rows", by right-clicking on "rows" and select "Add Variable".

    image

Assign values to the 2 graphical variables:
  1. Double-click on the variable "varNoOfRec" and assign the following mapping.

    image

    This variable "varNoOfRec" will be executed for each occurence of "target_MT". In this case, it will be executed only once, since "target_MT" is the root.

  2. Double-click on the variable "varFullName" and assign the following mapping.

    image

    This variable "varFullName" will be executed for each occurence of "record" in the target.

NOTE: With where the variable is defined, it is clear as to when it will be executed and can be used.
Use the variables in mapping:
  1. Double-click on "recCount" and drag-n-drop (do not double-click) the variable "varNoOfRec" to the mapping area and assign the following mapping.

    image

  2. Double-click on "fullName" and drag-n-drop (do not double-click) the variable "varFullName" to the mapping area and assign the following mapping.

    image

  3. Assign something to the target's "var2", it is not important what. In this case, I just assigned it the element "data2" from the source. Also, we need to assign "record" to "rows" to complete the mapping.
Verifying the mapping:
Even though the mapping shown here is quite simple, but when there is a complex structure, using variables (especially, when they have to be re-used over-n-over again) can save a lot of development and processing time.

Below is the result of the mapping. The graphical variables are not sent to the target structure. The "recCount" value for each row is only calculate once during the mapping, not for every row. The "fullName", however, is calculated for each row.

image

Blogger Labels: Series,Graphical,Variable,Introduction,Message,tool,Among,features,development,effort,advantages,usage,requirement,Assign,element,Concatenate,lastName,firstName,Create,node,Name,Double,NOTE,area,Also,result,Enhancements,variables,recCount,fullName,target_MT,varNoOfRec,varFullName,occurence

SAP PI Interview Questions SAP PI Certification Questions

SAP Developer Network SAP Weblogs: SAP Process Integration (PI)