cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping variables

Former Member
0 Kudos

Hello,

I am trying to understand the use of variables in PI 7.1 message mappings. I am creating Idocs from a CSV file and would like to save variables for values that are used more than once, some for use across all Idocs (e.g. document type) and some that will vary by Idoc (e.g. description).

I have found four possible methods of storing values :

1) Graphical variables

2) Container objects

3) Global container objects

4) User defined function (UDF) attributes and methods

I would be grateful if someone could suggest when each method should be used.

Global Container objects seem to be for use by more than one UDF in a mapping, while container objects can be used to store variables for use by the same function.

What happens if the same mapping is running in more than one thread on the same server? Are the parameters shared across threads.

UDF function attributes look like a very simple way of storing variables but I can't find any examples of them being used on the web. Does anyone have any useful URLs? Again, are these thread safe?

Graphical variables seem to be the best method to use as they are more visible. Does SAP recommend their use?

Kind regards

Steve

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks to Amit and Stefan for their prompt replies to my post.

I have been doing some testing based on your comments and think I will be using a combination of :

1) graphical variables where possible (although these don't always seem to work as expected).

2) UDF attributes

3) UseOneAsMany - where the variable can be easily defined using graphical mapping. I don't want to replicate complicated mappings in several targets.

Kind regards

Steve

stefan_grube
Active Contributor
0 Kudos

> Global Container objects seem to be for use by more than one UDF in a mapping, while container objects can be used to store variables for use by the same function.

container objects ar related to target queues and independent. Global container objects can be used in different target queues.

So you need a global containers for storing data and retrieving later.

The problem here is that the order of storing data and retrieving is not transparent, so you should use containers only for one entry which never changes.

> What happens if the same mapping is running in more than one thread on the same server? Are the parameters shared across threads.

No.

> Graphical variables seem to be the best method to use as they are more visible. Does SAP recommend their use?

The use of a graphical variable is tricky. It is documented how it really works. I found some strange results in my mappings and finally replaced the graphical variables with another solution.

It is difficult to recommend a solution, it depends from your requirements.

Another option is the use of node function UseOneAsMany. In my opinion you should use this node function instead of variables.

Edited by: Stefan Grube on Oct 25, 2010 1:47 PM

Former Member
0 Kudos

Steve,

What happens if the same mapping is running in more than one thread on the same server? Are the parameters shared across threads.

I think they are not shared across threads.

Graphical variables seem to be the best method to use as they are more visible. Does SAP recommend their use?

As far as I have used graphical variables they cannot handle the changing values like your description which i feel would be changing and you want them to be stored as and when they change. As per my understanding, graphical value would contain only first value from the context of the source element of queue. I would not recommend Graphical variables if what i have perceived is correct.

UDF function attributes look like a very simple way of storing variables but I can't find any examples of them being used on the web. Does anyone have any useful URLs? Again, are these thread safe?

These UDF attributes are safe to use moreover you can change them dynamically in your UDF for some time as and when you want them to hold the new value for your description.

Thanks,

Amit