on 12-31-2007 5:39 AM
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
HI I have writen Custom RFC and i In UDF iam giveing right input i think. while in responce i need it
can any one who worked on LOokup they miht know what mistake i am doing.
I am following excatly RFC lookup with Communication Channel. Blog.
Regd's
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
Can You have a look at yr code containing the problem I have mentioned regarding the return.
Also first chk the RFC manually with the value and see whether it is working fine or not.
Also when U will execute the RFC the response will be an XML string and You will have to extract the required field from the Response XML and put this extracted field in yr return
esle thee node will contain the xml returned from Lookup
Regards
Edited by: Amit K Singh on Jan 2, 2008 10:48 AM
Please check the below blogs.
Lookup method from GUI mapping can be called using any of the following ways.
· RFC lookup using JCO (without communication channel)
/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
· RFC lookup with communication channel.
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
Thnx
Santosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can u confirm if dis value is present inside the table which u r sending to target by executing ur BAPI first.
Regards,
Anoop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U r sending value from the source.This value will be an input to ur UDF which is doing RFC lookup corresponding to that value.For that u must have written code in SE37.just confirm if u r giving the same value as from the source to ur function module,does it return something while executing?
Regards,
Anoop
Hi Raj,
Please check the code you are returning null strign in the return statement .Please correct the return content and then check the same.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.