Skip to Content
0
Former Member
Nov 14, 2007 at 06:18 AM

RFC Lookup error

16 Views

Hi Friends,

I'm working on RFC Lookup.

For that, I've written UDF in Message Mapping, the code is as follows:

From source I'm giving CustomerID(source field) as input, which should be received by RFC as import parameter and it should give export parameter which i've mapped to target field.

As I have hard coded payload, for whatever the input atleast it should work.

But when I test on Message Mapping, it is not giving any errors as well as not producing any output.

Please help in this regard.

-


//write your code here

String rfcOutput = "";

// filling the string with RFC-XML

String rfcInput = " 101 http://tcs.com/Team3/GroupD1"//> 101 >";

RfcAccessor accessor = null;

ByteArrayOutputStream out = null;

try {

// 1. Determine a channel (Business system, Communication channel)

Channel channel = LookupService.getChannel("Plant_Maintenance_Reciever","CC_RFCReceiver");

// 2. Get a RFC accessor for a channel. accessor = LookupService.getRfcAccessor(channel);

accessor = LookupService.getRfcAccessor(channel);

// 3. Create a xml input stream representing the function module request message.

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

// 4. Create xml payload

XmlPayload payload = LookupService.getXmlPayload(inputStream);

// 5. Execute lookup.

Payload rfcResult = accessor.call(payload);

InputStream in = rfcResult.getContent();

out = new ByteArrayOutputStream(1024);

byte[] buffer = new byte[1024];

for (int read = in.read(buffer); read > 0; read = in.read(buffer))

{

out.write(buffer, 0, read);

}

rfcOutput = out.toString();

}

catch(LookupException e) {

//importanttrace.addWarning("Error while lookup " + e.getMessage() );

}

catch(IOException e) {

//importanttrace.addWarning("Error " + e.getMessage() );

}

return rfcOutput;

-


and if u want i can send the screen shot of error that i got in RWB.