on 07-07-2008 11:26 AM
hi
i have scenario where i am using globalContainer variable functionality in my message mapping.
in edit java section
String usr;
Container container ;
GlobalContainer globalContainer ;
intialize usr = "";
in First UDF
String inlogin_sess = " ashutosh test value" ;
globalContainer.setParameter(usr,inlogin_sess);
return any value :
now if i create another 2nd UDF and use :
String out =globalContainer.getParameter(usr);
return out ;
now 2nd UDF is giving null pointer exception...
for testing the code functionality..
IF i use the SET and GET in 1st UDF :
globalContainer.getParameter(usr); in 1st UDF than it is working sucessfully...
globalContainer.setParameter(usr,inlogin_sess);
String out = globalContainer.getParameter(usr);
return out ;
in help.sap it is mentioned that Globalcontainer objects values can be fetched among UDF's in one message mapping....
[http://help.sap.com/saphelp_nw04/helpdata/en/0f/80243b4a66ae0ce10000000a11402f/frameset.htm]
i have gone a lot of thread in sdn where Global container are used like sequence no creation etc, but every where the
GET and SET are used in SAME UDF...
any clue where is leak..
Regards,
ashutosh R
Are you sure f the usr has the same value in the set and get parameter statements?
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi
As i mentioned if i include the Set and Get method ,in the 1st UDF
the GET is fetching the value....sucessfully.
globalContainer.setParameter(usr,inlogin_sess);
result.addValue(globalContainer.getParameter(usr));
for confirming whether my code syntex..sementics is ok or not..
the point is that my globalcontainer object is loosing its refrence outside the UDF..which it should not..
Regards
AshutoshR
Hi Ravi
I have tested this in my system and it is working perfectly as expected.
are u using both methods in 1 udf or seperately...
because for me also
globalContainer.setParameter(usr,inlogin_sess);
result.addValue(globalContainer.getParameter(usr));
is returning sucessfully value... if both are in 1 UDF
BUT
are these 2 code line can be executed in different UDF's..
udf1 and udf2.. as what globalcontainer concept says....check if i am wrong..
i tried u r test , i cou'dt got u...
i have declared global object in UDF only....
GlobalContainer globalContainer = container.getGlobalContainer();
have u executed it in Edit java -> section....?
regards
Ashutoshr
Hi all
the global object decelaration object has to be done in both UDF's...
Than it is working..
But i did'nt got the logic why to intialize the object 2 times..
Thanks a lot Ravi abhisek..for u r inputs...
Regards
AshutoshR
ashutosh.rawat83atgmail.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
That is then the error.
Please Do the Following
GlobalContainer Gb = container.GetGlobalContainer();
This container you would get as a paramter of your UDF
and then use this variable GB as the Global container.
Remember a Gloabal container is Global for a Message mapping, does not need to be defined as Global variable
Let me know if this helped.
Rewards Points if useful
Regards,
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aushotosh,
Onr point to be remebered whilr using the the Global Container is that, you Should always know the order in which the mapping is exceuted.
It is always the order of the Target Strcuture which is imopratnt.
Typically in case of Global containers you should be sure that the value you buffer is not used in a sequence before.
I think this is the issue in your case.
Reward points if useful
Regards,
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhishek
Your point is legimate, but for my their is no such issue..
even i try to use it as :see image..
[http://www.screenshots.cc/show.php/14137_GlobalVariable.JPG.html]
UDF1 :
globalContainer.setParameter(usr,inlogin_sess);
return any value :
and in UDF2
String out = globalContainer.getParameter(usr);
return out ;
mainting the sequence
My concern is object globalContainer is local in UDF1, so it will through nullpointer ,if we try to access in UDF2.
if we declare globalContainer in edit jave -GlobalVariables also, still it is having the error..
Regards
AshutoshR
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.