Skip to Content
author's profile photo Former Member
Former Member

Message Mapping error in UDF

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Jan 25, 2008 at 05:07 AM

    hi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 24, 2008 at 09:40 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 10:08 AM

    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 😊

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 09:04 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 29, 2008 at 12:00 AM

    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.*;

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.