cancel
Showing results for 
Search instead for 
Did you mean: 

UDF not working

Former Member
0 Kudos

Hi there

I have 3 Software components in my Integration Builder, I created a UDF that calls an RFC and in all the Iu2019m using the exact same UDF but in 1 of the 3 it does not return any results. If I display queue on it, it says successful but with no results.

What might be the most logical reason for this?

Thanks,

Jan

Edited by: Jan de Lange on Mar 12, 2009 11:53 AM

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

I found the problem, one of the segments in IDOC structure had no mapping. This was confusing cause according to me the Display queue should work regardless of the mapping.

Thanx again,

Jan

Former Member
0 Kudos

Hi

I found the problem, one of the segments in IDOC structure had no mapping. This was confusing cause according to me the Display queue should work regardless of the mapping.

Thanx again,

Jan

GabrielSagaya
Active Contributor
0 Kudos

Can you provide the elements in import and export RFC structure??

Former Member
0 Kudos

Hi

Please check if the RFC is imported in the SWC in which it is not working.

If there delete and try to re - import again

rgds

srini

Former Member
0 Kudos

Hi again

I see that ist actually not a RFC, the UDF calls data from a R/3 table, the java code is:

// declare parameters

String returnValue = "";

String WHERE_CLAUSE = fieldYouGiveName + " = " + fieldYouGiveValue;

String rfcXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <ns0:RFC_READ_TABLE xmlns:ns0=\"urn:sap-com:document:sap:rfcfunctions\"><QUERY_TABLE>ZMAPPING_TABLE</QUERY_TABLE><DATA></DATA><FIELDS></FIELDS><OPTIONS><item><TEXT>"fieldYouGiveName" = '" + fieldYouGiveValue +"'</TEXT></item></OPTIONS></ns0:RFC_READ_TABLE>";

AbstractTrace trace = container.getTrace();

RfcAccessor accessor = null;

ByteArrayOutputStream out = null;

try

{

// 1. Determine a communication channel (Business system + Communication channel)

Channel channel = LookupService.getChannel(businessSystem,communicationChannel);

// 2. Get a RFC accessor for the channel.

accessor = LookupService.getRfcAccessor(channel);

// 3. Create an XML input stream that represents the RFC request message.

InputStream inputStream = new ByteArrayInputStream(rfcXML.getBytes());

// 4. Create the XML Payload

XmlPayload payload = LookupService.getXmlPayload(inputStream);

// 5. Execute the lookup.

Payload result = null;

result = accessor.call(payload);

InputStream in = result.getContent();

// 6. Create a DOM structure from the input XML

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(in);

NodeList list = document.getElementsByTagName("WA"); // The lookupValue is available as WA tag in the response

Node node = list.item(0);

if (node != null) {

node = node.getFirstChild();

if (node != null) {

returnValue = node.getNodeValue();

}

}

// 7. To free resources, close the accessor..

if (accessor!=null) {

try {

accessor.close();

} catch (LookupException e) {

trace.addWarning("Error while closing accessor " + e.getMessage() );

}

}

} catch (Exception e) {

trace.addWarning("Error" + e);

}

// 8. return a single id value to the message mapping

return returnValue;

Still, it only works in 2 of the 3 SWC.

Regards,

Jan

Former Member
0 Kudos

Hi

All fine if am not wrong , we shud import "RFC_READ_TABLE " RFC into SWCV

please check

rgds

srini

former_member181985
Active Contributor
0 Kudos

First of all you are calling a standard RFC which internally calls a table. So it is a BAPI.

Copy the code from the working UDF to 3 rd UDF which not working.

Thanks,

- Gujjeti.