on 01-24-2008 9:11 PM
I am receiving errors when trying to activate my MM. I believe the issues are in one of two UDF's. These UDF's do work in another MM without error. Below are the error's and UDF's.
ERRORS:
Activation of the change list canceled Check result for Message Mapping MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE | http://wawa.com/xi/erp/pos: Starting compilation Source code has syntax error: /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3291: cannot resolve symbol symbol : variable container location: class com.sap.xi.tf._MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_ map = container.getTransformationParameters(); ^ /usr/sap/XID/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5420e070cabe11dcab4b00306ef38da9/source/com/sap/xi/tf/_MM_WPDBBY_WPDBBY01_TO_POS_WAWAFILE_.java:3293: cannot return a value from method whose result type is void return constant; ^ 2 errors
UDF's:
public String getSender(Container container){
String constant;
java.util.Map map;
// get constant map
map = container.getTransformationParameters();
constant = (String) map.get (StreamTransformationConstants.SENDER_SERVICE);
return constant;
IMPORTS: com.sap.xi.mapping.parse.dom.;javax.xml.parsers.;java.io.;com.sap.aii.mapping.lookup.;org.w3c.dom.*;
public String getSeqNum(String fileType,String objNum,String Sender,Container container){
String request = "<ns0:ZRFC_NUMBER_GET_NEXT xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><NR_RANGE_NR>" + fileType + "</NR_RANGE_NR><OBJECT>" + objNum + "</OBJECT><QUANTITY/></ns0:ZRFC_NUMBER_GET_NEXT>";
InputStream isRequest = new ByteArrayInputStream(request.getBytes());
SystemAccessor accessor = null;
String num = null;
try{
// 1. Determine a channel.
Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
// 2. Get a system accessor for the channel.
accessor = LookupService.getSystemAccessor(channel);
// 3. Create a payload according to the data type which the adapter expects.
// Use service.getBinaryPayload() for binary payload,
// and service.getTextPayload() for text payloads.
Payload payload = LookupService.getXmlPayload(isRequest);
// 4. Execute lookup.
Payload response = accessor.call(payload);
//Parse response
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputStream resStream = response.getContent();
Document doc = builder.parse(resStream);
Element sequence = doc.getDocumentElement();
NodeList number = sequence.getElementsByTagName("NUMBER");
//Extract Number
num = DOMUtil.getSimpleElementText((Element) number.item(0));
} catch (Exception e) {
return e.getMessage();
} finally {
try {
if (accessor != null) accessor.close();
} catch (Exception e) {
return e.getMessage();
}
}
GlobalContainer gc = container.getGlobalContainer();
gc.setParameter("Num", num);
return num;
Any help is appreciated.
Regards,
Darrell
hi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check what kind of UDF you are using :simple/advanced ie Check whether it is Value/Context/Queue
If it is Context/queue,then the target element is populted using ResultList object.
Regards
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the import statements:
com.sap.xi.mapping.parse.dom.;javax.xml.parsers.;java.io.;com.sap.aii.mapping.lookup.;org.w3c.dom.*;
There are missing stars (*)
com.sap.xi.mapping.parse.dom.;javax.xml.parsers.;java.io.;com.sap.aii.mapping.lookup.;org.w3c.dom.*;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your first UDF seems to be ok but the error is thrown for it. You could try out following things:
1. Do compilation check on UDF 1. This would ensure if the error is thrown from this.
2. If the compilation check gives same error on statement return constant; then ensure that definition of UDF is correct i.e. it returns a string. Make sure that you have not created a UDF passing queue or context in cache. It should pass value, only then the return type would be string.
3. If none of above works, try restarting repository again.
Thanks,
Bhavish
Reward points if comments helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Darrell,
I can't see any errors with UDF-1.It seems to be perfect, even I copied and executed the same. Do one thing, just right click
on the UDF1 and use display queue, see whether it's throwing out the error. If there is no error then go to UDF-2 and check the same.
First we will figure it out which one causes the issue, then we proceed further.
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fauver,
Just to narrow down the problem first remove the first udf and only use the 2nd user defined function. Also in the 2nd udf you have to change this line:
try{
// 1. Determine a channel.
Channel channel = LookupService.getChannel(Sender, "R_RFC_ERP");
In the above line instead of Sender you use the business service or business system where R_RFC_ERP RFC communication channel is created in Integration Directory. So you are hardcoding it first.
Once you have done this changes do save and test it once again. If this works then you can change back to original and your first udf needs to be checked.
Regards,
---Satish
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.