cancel
Showing results for 
Search instead for 
Did you mean: 

To Create UDF for simple Graphical mapping.

former_member205100
Participant
0 Kudos

Hello All,

I would like to create an UDF copying an existing one used in another scenario and here is the code below.

This is used in simple graphical mapping.

' public String getMessageID(String a,Container container){

' //write your code here

// get runtime constant map

java.util.Map param = container.getTransformationParameters();

// get value of Message ID by using variable key

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

return MSGID;

when i saved and activated i get the error as below.

Erro :

Source code has syntax error: /usr/sap/FXM/DVEBMGS33/j2ee/cluster/server0/./temp/classpath_resolver/Map919129ac273b11e1b2cc5611b8cdd010/source/com/sap/xi/tf/_MM_I1003_Shipment_SAP_TO_WMQ_.java:4914: cannot return a value from method whose result type is void return MSGID; ^ 1 error

since i dont know the JAVA, can any one guide on this?

1. shoud we need to declare anything globally?

2,or any JAVA program need to create and import ?

Regards,

Sethu.

View Entire Topic
Former Member
0 Kudos

u cant test this UDF in message mapping..this will only output the message id when u do end to end testing

choose execution type as: single value and use below code:



String constant;
java.util.Map map;
map = container.getTransformationParameters();
constant = (String) map.get(StreamTransformationConstants.MESSAGE_ID); 
return constant;

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1321

Former Member
0 Kudos

a litle complement... you CAN test it in Message Mapping...

but for that, you have to go in tab "Parameters" of tab "Test", and to write something (e.g 1234) in the parameter called "MessageId"

Your UdF tested locally in MM will them pick this info (e.g 1234) and return it to you.

Tips: when we want get info from SOAP header, it's better to use a TRY...CATCH to wrap the java function. by this way when test the mapping target field (display queue), we have not a dump !

Mickael

Former Member
0 Kudos

>>you CAN test it in Message Mapping

Indeed, but u wont get the actual message id..and this is what i meant


this will only output the message id when u do end to end testing

Former Member
0 Kudos

of course AmitSri ))