cancel
Showing results for 
Search instead for 
Did you mean: 

RFC LOOKUP Exception

Former Member
0 Kudos

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,

Accepted Solutions (0)

Answers (1)

Answers (1)

RKothari
Contributor
0 Kudos

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

Former Member
0 Kudos

its actually date and month field..

i need to send 2011 and 03 for month for an ex..

and i am sending it in the same format

Former Member
0 Kudos

i have mapped the two fields of the rfc and from the test tab i took the rfx xml sig of it and using it in my code..

these 2 fileds are the things which i provide as input for FM..

is this correct or do i need to map the response also????

Former Member
0 Kudos

Hi,

Try to stop and start the RFC receiver adapter from RWB and check whether the problem still persists.

Regards

Pravesh

Former Member
0 Kudos

Yeah i stopped my channel.. and tried processing..

The output field is empty now no value is passed to it

Edited by: maheshhhh on Mar 16, 2011 7:41 AM

Former Member
0 Kudos

Have you started the channel as well...

Former Member
0 Kudos

yes still the same error..

RKothari
Contributor
0 Kudos

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

Former Member
0 Kudos

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

RKothari
Contributor
0 Kudos

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.