on 12-30-2010 6:29 AM
Hi guys,
i have to create two global variables in SAP PI 7.1 EHP1 which i want to use in mapping. I am referring to this blog to test the given scenario.
/people/karthiknarayan.kesavan2/blog/2007/08/22/file-content-conversion-for-multi-hierarchical-structure
Please let me know how can i declare the following global variables in PI 7.1
Map hashMap = new LinkedhashMap();
int cntkey =0;
Thanks
Sahil
For this ,
Goto Functions tab of message Mapping
Cick Attributes and Method (left pane) |
then in Right Pane write your variables
Map hashMap = new LinkedhashMap();
int cntkey =0;
|
Go to UDF and access these variables
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Stefan and Ritu,
I am still getting the error in my UDF as follows.
Source text of object Message Mapping: MM_Intermediate | http://XXXXX.com/ has syntax errors:
Function Populate_recd, Line 4:
cannot find symbol
symbol : method addvalue(java.lang.String)
location: interface com.sap.aii.mappingtool.tf7.rt.ResultList
result.addvalue((String)hashMap.get((String)it.next()));
i have defined the below variables in Attrubue and methods.
Map hashMap = new LinkedhashMap();
int cntkey =0;
Kinldy help me with this.
regards
Sahil
> cannot find symbol
symbol : method addvalue(java.lang.String)
location: interface com.sap.aii.mappingtool.tf7.rt.ResultList
result.addvalue((String)hashMap.get((String)it.next()));
Check the method name signature.. Since java language is case sensitive you have to define exactly same everywhere
method name: addValue
Hi,
just change this statement in your UDF from
result.addvalue((String)hashMap.get((String)it.next()));
to
result.addValue((String)hashMap.get((String)it.next()));
and it will work.
Java is case sensitive and hence cannot call the addValue method correctly from your UDF.
I hope this helps.
Regards, Gaurav.
> Please let me know how can i declare the following global variables in PI 7.1
>
> Map hashMap = new LinkedhashMap();
> int cntkey =0;
In PI 7.1 you choose tab function and put the code in section Attributes and Methods.
Don't get confused with the new variables in graphical mapping. This has nothing to do with it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
refer below blog..
/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
Regards,
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In PI 7.1 graphial variables are used as substitute for global variable.
graphical variable only works within the mapping session. It's similiar like global container.
However if you want to have real global variable that is valid across mapping session, (like it's valid from message to message), you can define static data member in a java class, then use the java class in your UDF by using the static data memeber as real global variable.
refer below discussion,
Regards
Amol
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.