cancel
Showing results for 
Search instead for 
Did you mean: 

How to initialize Container object in Java Section .. ??

0 Kudos

Hi ,

I want to Initialize a container Object in the Java section so that i can use the corresponding methods.

Whenn i declare --

Container container;

It gives me error, container has not been initialized.

When i write container = null, i get null pointer exception.

please help me with the declaration part.

Thanks !!

Harpreet

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi harpreet,

u dnt need to "declare" ur container object. its already declared...check the signature of ur UDF.

so Container container; --> is wrong

in ordre to use it u just need to set values in it and when required retreive from it by using,

container.setParameter("name","harpreet");

conatiner.getParameter("name"); --> returns object.

refer this:

http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm

[reward if helpful]

regards,

latika.

Former Member
0 Kudos

Hi,

What you want to achieve using the container object. You can use the global container if you wanted to access the global value in the UDF.

Thanks and Regards,

Chirag Gohil

0 Kudos

I do not want the UDF. I need to write a code which will work in the clean up section of Java only after the complete message mapping is successful.

I need the container object so that I could use getTransformationParameters method of Map object.

I do not get the container object in the clean up section by default as we get in the UDF.

Former Member
0 Kudos

Hi,

Please refer the below link hope this might help you.

http://help.sap.com/saphelp_nw04s/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/frameset.htm

Thanks and Regards,

Chirag Gohil.

Former Member
0 Kudos

for ur particular requirement use the following statement.:

container.getTransformationParameters; --> returns Map

to use this MAP further, for example:

map.get(StreamTransformationConstants.SENDER_SYSTEM);

[reward if helpful]

regards,

latika.

0 Kudos

Yes Latika..

This is what i want to do exactly...

But i need to first declare and initialize container object for it as i am not writing it in a UDF. I am using the Global java section in mapping.

Else i get error - unresolved variable container

Former Member
0 Kudos

hi harpreet,

can u elaborate what is "Global java section in mapping"

assuming u have ur own class in which u want to use container..

u need to import

com.sap.aii.mappingtool.tf3.rt.Container

and then jus declare it as

Container container;

container.get.........<ur code>

ur code shud work.

regards,

latika.

0 Kudos

Hi latika,

I have already done that, but i need to initialize the container to proceed further.

Thanks !!