cancel
Showing results for 
Search instead for 
Did you mean: 

Creating the container Object In Java Mapping

former_member181928
Participant
0 Kudos

Hi,

i I have a scenarion where i have to set some parameter in the COntainer from the Java Mapping.

How can i get a reference to the current Container object from my Java Mapping . While using user defined function this object is already avaliable as a parameter and we do not have to create it .But in java mapping how do i get the current container object.

regards

Nilesh Taunk.

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

Why would you use a container class? When you have your own Java code for mapping, you can store your parameters anywhere.

Let me know more about this.

Regards

Stefan

former_member181928
Participant
0 Kudos

HI stefan,

Basically i am calling a method on a generic component which which has been imported as a jar in the imported archive and that method has container as a parameter .

Therefore i require the container object which can be passed as a parameter to the method.

The Basic idea is to set a parameter first in the globalContainer then pass a reference of that container to the generic component so that it can retrieve the parameter from the container and modify it .

So is possible to pass the container object from The Java mapping.

regards

Nilesh Taunk.

stefan_grube
Active Contributor
0 Kudos

When I have understood right, the class provides a methods with a parameter of type com.sap.aii.mappingtool.tf3.rt.Container and expects any values to be filled inside an instance of that class?

Container and GlobalContainer are interfaces. In a graphical mapping the instance of the GlobalContainer is the mapping class itself (you can see this with a user defined function).

To achieve your goal you need to spend a lot of effort and have to know the internal code of the Mapping Tool. I think you better add methods to the generic component to enable it to be called from a Java Mapping.

Regards

Stefan

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Nilesh,

ASFAIK this is not possible as when you use the Java Mapping, the only parameters that is sent to the EXECUTE method of your Mapping prgram is the INPUTSTREAM which is nothing but the source message of your mapping.

Regards,

Bhavesh

former_member181928
Participant
0 Kudos

Does this mean i cannot set anything into the container from my Java Mapping.

regards

Nilesh Taunk.

bhavesh_kantilal
Active Contributor
0 Kudos

Nilesh,

sorry.. I think this is actually possible.

In the setParameter()


public static AbstractTrace trace;
public void setParameter(Map param) {

		map = param;
		trace =
			(AbstractTrace) param.get(
				StreamTransformationConstants.MAPPING_TRACE);

	}

Likewise, in this method setParameter, you can get and set Container objects.

I have shown how to use the TRACE .

Sorry for the confusion

Regards,

Bhavesh

former_member181928
Participant
0 Kudos

HI Bhavesh thanks for the prompt reply but in my scanario i am setting a parameter of my own

can i implement it this way.

com.sap.aii.mappingtool.tf3.rt.Container C1 = new Container();

U can include aii_mt_rt.jar in ur classpath in NWDS for accessing the COntainer class.

and then C1.getGlobalContainer().setParameter("MY_PARAMETER",20);

I am not sure will this work or not ..

Can you please comment on this.

regards

Nilesh Taunk.

bhavesh_kantilal
Active Contributor
0 Kudos

Nilesh,

Just check this link,

http://help.sap.com/saphelp_nw04/helpdata/en/75/8e0f8f3b0c2e4ea5f8d8f9faa9461a/content.htm

You can use the MAP object of the <b>setParameter()</b> to get and set GLOBAL CONTAINER elements.

Hope this is what you want,

Regards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Nilesh,


private Map mymap
public void setParameter(Map param) {
 
		mymap = param;
		mymap.put("MY_PARAMETER",20);
	}


Now , you can use this <b>mymap.get("MY_PARAMETER")</b> to get the value any where in the class

Though I ve not tried it ,think it should work.

We used the TRACE object described earlier to write TRACE statemtents into XI log from JAVA mapping.

Regards,

Bhavesh

moorthy
Active Contributor
0 Kudos

HI,

Just check this link also - Runtime environment on Java Mapping..getting and Runtime constants

http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm

Thanks,

Moorthy