cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Tracing in Java Section of Message Mapping

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Is it possible to get the Mapping Trace Object in the JAVA SECTION of the Message Mapping?

To access the<a href="http://help.sap.com/saphelp_nw04/helpdata/en/c8/98e7d5c1620642973565ea3dd319d1/content.htm">Mapping Trace Object</a>, we need the instance of the <a href="http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm">Container Object</a>. SAP help says, Container Object is made available to every User Defined Function .

What we need is how can we get the current instance of the Container Object in the JAVA Section of Message Mapping. Any ideas?

Regards,

Bhavesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bhavesh,

It seems you can access global container from any part of Graphical mapping.

According to :

<b>The mapping program is a class derived from the interface GlobalContainer. So you can use the methods of GlobalContainer all the time during the mapping program.</b>

Plz refer the link to the related thread.

Regards,

Ananth

Answers (2)

Answers (2)

MichalKrawczyk
Active Contributor
0 Kudos

hi Bhavesh,

>>>>What we need is how can we get the current instance of the Container Object in the JAVA Section of Message Mapping.

why do you want to do anything like that in java section?

you can create a global variable and fill it once

(in UDF) and resue it in many other UDF

but can you tell why you need it in java section ?

Regards,

michal

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Michal,

Am writing a few lines of Java code in my Initialization and Clean Up Section of the JAVA section. I need to trace / debug my code and was looking if it is possible to use the TRACE statement in the JAVA section to write to the TRACE log.

Also, I wanted to know the flow of my message when I have the JAVA section and thought using a TRACE log will help clarify lot of doubts that I ve got

Any ideas?

Regards,

bhavesh

MichalKrawczyk
Active Contributor
0 Kudos

hi,

I don't think you can use it as

when I try to do it in the initialization section

the mapping does not want to compile - during activation

but if you move your code to UDF for sure everything will work fine:)

Regards,

michal

bhavesh_kantilal
Active Contributor
0 Kudos

Ananth / Michal,

<b>AbstractTrace trace=(AbstractTrace)getParameters().get(StreamTransformationConstants.MAPPING_TRACE);</b>

Using this piece of code in the Initialization Section , I could get the Trace object in the JAVA section of the mapping and am now able to add Trace Statements successfuly.

Thanks to Ananth for that thread by Stefan.. I had somehow forgotten about it

Regards,

Bhavesh

MichalKrawczyk
Active Contributor
0 Kudos

nice:)

Regards,

michal

Former Member
0 Kudos

Hi Bhavesh,

Yes we have a option.We can achieve through simple UDF.

sample code:

MappingTrace t=container.getTrace();

t.addInfo("Info:"+a);

return a;

Thanks,

Sekhar

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Sekhar,

Thanks for the reply. But, what I was looking for was to acess the Trace object in the JAVA section of the message mapping and not from a UDF.

Regards,

Bhavesh