on 03-16-2011 5:25 AM
Hi Frnds,
My Scenario is IDoc-File where in i do an RFC lookup to extract a value from table.
where in i give 2 inputs and expect one output value..and if any two input values are wrong throw an exception
But when i am testing the scenario Its always raising the exception Value Not Found even when the input values are perfect...
When the idoc is generated from the program in SAP the table gets updated adn when i call the RFC in PI mapping it should return the value from the table...
The table is getting updated perfectly and RFC is returning the value when i test the FM in ABAP.. but in PI for the same data its always returning exception Value Not Found..
Whats going wrong?Can you guys suggest please
Thanks,
Hello,
Can you please mention the input fields you are using.
Check if the input fields require any leading zeros or if a date than any particular format.
Check in table how the input field values are stored in R/3 and provide the same values in PI while performing RFC lookup.
-Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try following below links
http://wiki.sdn.sap.com/wiki/display/Snippets/User-definedMappingFunctionforRFC+Lookup
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
Paste your code you are using for RFC lookup.
Edited by: Rahul Kothari on Mar 16, 2011 1:36 PM
My Code
String returnValue = "";
MappingTrace importanttrace;
importanttrace = container.getTrace();
String rfcXML= "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ZFM_GET_DETAILS xmlns:=\"urn:sap-com:document:sap:rfc:functions\"><Z_ID></Z_ID><Z_MES></Z_MES></ns0:ZFM_GET_DETAILS>";
AbstractTrace trace = container.getTrace();
RfcAccessor accessor = null;
ByteArrayOutputStream out = null;
try
{
// 1. Determine a communication channel (Business system + Communication channel)
Channel channel=LookupService.getChannel("BS_ESD","CC_RFCLookup");
// 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.
// 5. Execute lookup.
Payload result = accessor.call(payload);
InputStream in = result.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);
}
returnValue = out.toString();
}
catch(LookupException e)
{
importanttrace.addWarning("Error while lookup " + e.getMessage() );
}
catch(IOException e)
{
importanttrace.addWarning("Error " + e.getMessage() );
}
finally
{
if (out!=null) {
try {
out.close();
} catch (IOException e) {
importanttrace.addWarning("Error while closing stream " + e.getMessage() );
}
}
// 7. close the accessor in order to free resources.
if (accessor!=null) {
try {
accessor.close();
} catch (LookupException e) {
importanttrace.addWarning("Error while closing accessor " + e.getMessage() );
}
}
}
// 8. return a single id value to the message mapping
return returnValue;
Edited by: maheshhhh on Mar 16, 2011 9:50 AM
Try the below RFCXML.
String rfcXML= "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><ns0:ZFM_GET_DETAILS
xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><Z_ID></Z_ID><Z_MES
></Z_MES></ns0:ZFM_GET_DETAILS>";
Also, check in the length of inputstream in, outputstream out below code if anything is returned by FM by adding trace.
InputStream in = result.getContent();
out = new ByteArrayOutputStream(1024);
byte[] buffer = new byte1024;
for (int read = in.read(buffer); read > 0; read = in.read(buffer)) {
out.write(buffer, 0, read);
}
If no value is populating then try to map the response as mentioned in the wiki of above post.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.