Skip to Content
0
Former Member
Dec 31, 2007 at 05:39 AM

Lookup Problem

30 Views

MappingTrace rfcLookupTrace;

rfcLookupTrace = container.getTrace();

String rfcRequest = "<?xml version = \"1.0\" encoding=\"UTF-8\"?><ns1:ZBAPI xmlns:ns1= \"urn:sap-com:document:sap:rfc:functions \"><EBELN>5400030033</EBELN></ns1:ZBAPI> ";

String rfcResponse = "";

RfcAccessor rfcAccessor = null;

ByteArrayOutputStream rfcOutput = null;

try{

Channel rfcChannel = LookupService.getChannel ( "lookupchanel","RFCCh2" ) ;

rfcAccessor = LookupService.getRfcAccessor(rfcChannel);

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

XmlPayload rfcPayload = LookupService.getXmlPayload(inputStream);

Payload rfcReponse = rfcAccessor.call(rfcPayload);

InputStream reponseStream = rfcReponse.getContent();

rfcOutput = new ByteArrayOutputStream(1024);

byte[] buffer = new byte[1024];

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

{

rfcOutput.write(buffer, 0, read);

}

rfcResponse = rfcOutput.toString();

}

catch(LookupException e)

{

rfcLookupTrace.addWarning("Error while RFC Lookup " + e.getMessage() );

}

catch(IOException e)

{

rfcLookupTrace.addWarning("Error " + e.getMessage() );

}

finally

{

if (rfcOutput!=null){

try

{

rfcOutput.close();

}

catch (IOException e)

{

rfcLookupTrace.addWarning("Error while closing stream " + e.getMessage() );

}

}

if(rfcAccessor!=null)

{

try

{

rfcAccessor.close();

}

catch(LookupException e)

{

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

}

}

}

return "";

IAIn Target System i am getting these Erros ?xml version="1.0" encoding="UTF-8 .

Can any one done Lookup for PO in checking R/3 before sending to Target System.

Rged's

Raj