cancel
Showing results for 
Search instead for 
Did you mean: 

Parameter MessageId

Former Member
0 Kudos

Hi all,

I am wondering how I can get and set the parameter: MessageId using Java. Anyone ideas?

thnx!

Accepted Solutions (0)

Answers (1)

Answers (1)

justin_santhanam
Active Contributor
0 Kudos

Hello,

You can get the parameters that listed in the below URL. If you need the code to achieve the same,do reply back.

http://help.sap.com/saphelp_nw70/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm

Best regards,

raj.

Former Member
0 Kudos

I need the java code to achieve setting and getting.

Best regards,

Guido

justin_santhanam
Active Contributor
0 Kudos

Guido,

Create UDF with no input parameters.

in import section use java.util.Map;

Map param =null;

String msgid= (String)param.get(StreamTransformationConstants.MESSAGE_ID);

return ""msgid"";

UDF -


> Target Node;

Hope it helps!!

Best regards,

raj.

justin_santhanam
Active Contributor
0 Kudos

Guido,

Does it works!!!

Best regards,

raj.

Former Member
0 Kudos

Goodmorning Raj,

Thnx for the help so far!

When I test my mapping without the UDF I do not get any errors but when I add the function I am getting the following error:

08:43:16 Start of test

Compilation of I_ORDERS05_to_E_ORDERS_D96A1 successful Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._I_ORDERS05_to_E_ORDERS_D96A1_ method GetMessageId$[com.sap.aii.mappingtool.tf3.rt.Context@f25aca] com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._I_ORDERS05_to_E_ORDERS_D96A1_ method GetMessageId$[com.sap.aii.mappingtool.tf3.rt.Context@f25aca] at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:56) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:174) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:204) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:204) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:298) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:63) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:77) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:259) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:304) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:193) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Root Cause: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:47) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:174) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:204) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:204) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:298) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:63) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:77) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:259) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:304) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:193) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Caused by: java.lang.NullPointerException at com.sap.xi.tf._I_ORDERS05_to_E_ORDERS_D96A1_.GetMessageId$(_I_ORDERS05_to_E_ORDERS_D96A1_.java:1514) ... 25 more RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._I_ORDERS05_to_E_ORDERS_D96A1_ method GetMessageId$[com.sap.aii.mappingtool.tf3.rt.Context@f25aca]

08:43:26 End of test

Do you know what is wrong with it?

Thnx!

Former Member
0 Kudos

HI

For example, to read the message ID from the message header, the variable key must have the value MessageId and not MESSAGE_ID.

regards

krishna

Former Member
0 Kudos

>>I need the java code to achieve setting and getting.

You can get the value for Message Id. But you will <b>not be allowed to set</b> the value.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Guys,

When I use this, which seems to be the answer I still get an error. The error is below

String headerField;

java.util.Map map;

// get runtime constant map

map = container.getTransformationParameters();

// get value of header field by using variable key

headerField = (String) map.get(MessageId);

Source code has syntax error: D:/usr/sap/A12/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map6cf69d40286d11dcab87000bdb9152ba/source/com/sap/xi/tf/_I_ORDERS05_to_E_ORDERS_D96A1_.java:1521: cannot resolve symbol symbol : variable MessageId location: class com.sap.xi.tf._I_ORDERS05_to_E_ORDERS_D96A1_ headerField = (String) map.get(MessageId); ^ 1 error

Former Member
0 Kudos

<b>This works for me:</b>

GlobalContainer globalContainer;

AbstractTrace trace;

String headerField;

java.util.Map map;

// Get trace using the container object

// (which is passed by parameter ‘container’

// to this user-defined function)

trace = container.getTrace();

// To get a global container, use method getGlobalContainer()

// of the container object

globalContainer = container.getGlobalContainer();

// There are two ways of getting the runtime constant map now:

// a) by calling container.getTransformationParameters() or

// b) by calling globalContainer.getParameters().

map = globalContainer.getParameters();

// get the value for a header field

headerField = (String) map.get(

StreamTransformationConstants.MESSAGE_ID);

// output value to trace and return it

trace.addInfo("MESSAGE_ID:" + headerField);

return headerField;<b></b><b></b>