[SAP PI] – Mapping Enhancements Series: Using Graphical Variable

15 02 2011

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.imageThis 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.imageThis 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

AUTHOR

William Li SAP Employee Active Contributor Silver: 500-1,499 points
Business Card
Company: SAP Labs
Posted on Feb. 13, 2008 12:42 PM in SAP Process Integration (PI)

URL: https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/8650

Annunci

Azioni

Information

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...




%d blogger hanno fatto clic su Mi Piace per questo: