on 02-07-2007 9:24 AM
Hi all,
I am trying to understand the concept of Global Container.
i have referred to the following blog by Michal
<a href="/people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi:///people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi
I have created the Second UDF 'getContainer'.
But, while testing I am getting the following error:
RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_TEST_IN_ method getContainer$[]
Code that i am writing in getContainer is as follows:
<b>GlobalContainer globalContainer = container.getGlobalContainer();
String[] b = (String[]) globalContainer.getParameter("our_number");
for (int i=0; i<b.length; i++)
{
result.addValue(b<i>);
}</b>
getContainer function does not have any input parameters.
Kindly, provide me some guidance about where am I getting wrong.
Thanks & Regards,
Nilima Rodrigues
Hi Nilima,
Try like this for UDF getContainer
GlobalContainer globalContainer = container.getGlobalContainer();
String[] b = (String[]) globalContainer.getParameter("our_number");
if( (b != null) ) {
for (int i=0; i<b.length; i++)
{
result.addValue(b);
}
This should work, Else reply again
regards,
sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sridhar,
I used the same piece of code provided by you.
Now, I am not getting any error during testing.But still I am unable to get the desired result.
As specified in Michal's blog, I want to display the Numbers between given range of 'FROM' AND 'TO'.
My first UDF(setContainer) works perfectly and creates appropriate context for DEST_LINE.
But getContainer is still not working.
Awaiting for your reply.
Thanks & Regards,
Nilima Rodrigues
Hi Nilima,
Hi Nilima,
//write your code here
GlobalContainer globalContainer1 = container.getGlobalContainer();
String[] b = (String[]) globalContainer1.getParameter("our_number");
String str_result = "";
if( (b != null) ) {
int a1 = Integer.parseInt(b[0]);
int cnt = Integer.parseInt(counter);
int ans = a1;
str_result = String.valueOf(ans);
}
return str_result;
Note counter is a arguement for value based...
Map Now like this
use COUNTER standard function --> UDF getContainer --> then target field..
this will work..
regards,
sridhar
Message was edited by:
sridhar reddy kondam
Hi Nilima,
getContainer calls for values which are already present in container , set by ur first UDF(setContainer). When you check the display queue, the getContainer will throw null pointer exception as setContainer has set no value in container. So, try executing the complete scenerio or test the mapping with the UDF what Sridhar has suggested.
Hope it would work.
Regards,
Rahul
Nilima,
>>getContainer function does not have any input parameters
u mean to say ur not passing any parameters to this function but I suppose Container is one of the default argument to this function .
Can u place this function before ur setContainer ( for testing purpose)
ur resultset in the above case will contain NULL but if there is no exception
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Nilma,
do you have SP14 (XI)?
if so you can try using global variables
/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
they are much easier to use then globalcontainer
Regards,
michal
-
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.