on 12-15-2011 5:04 PM
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.
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;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Yes the logic worked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sethu,
The problem is with the method signature of your UDF. If you look at the error message it indicates that your UDF has a void return type, but you have a return type of String. You need to change the method signature so that the UDF is expecting to return a String and then you should be able to activate your code successfully.
' 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;
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
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;
cannot return a value from method whose result type is void return MSGID
Your code looks okay. But are you sure that the UDF execution type is set to Single Values and not Context or Queue Type?
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The possibility depends on your requirement.
If you give us the source and target message that you want to achieve we can decide whether you need UDF or Java Mapping
ok
regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.