cancel
Showing results for 
Search instead for 
Did you mean: 

RFC lookup returns same values

former_member187587
Contributor
0 Kudos

Hi guys,
I have a strange behavior in my RFClookup function.I'll appreciate some ideas for solution.


My scenario is as followed:

The RFC lookup is used during message mapping when a Bar-code form a 3rd party system is needed to be translated to a SAP matching material .
After the response is received it is mapped to an IDoc as part from a whole File->IDoc message mapping. (bar-code for each line item)

Problem is that I'm getting each time in the response the same values from the RFC function on the SAP system.( the received value is a default value for no-matching material found for the bar code)

some checks I maid before posting this query:
1.the RFC function

runs perfectly

on the SAP and

returns the relevant and matching

business data ( material number for bar code)

2.the user defined in the comm. channel of type RFC sender is a dialog user. who works

fine on other standard XI- RFC interfaces.

3.there is some strange trace in the comm channel but the RFC is in green status:

from RWB comm channels:

Receiver channel 'RFC_Receiver_230' for party '', service 'SSD230' (internal name 'RfcClient[RFC_Receiver_230]')

Client data: {jco.client.lang=en, jco.client.snc_mode=0, jco.client.client=230, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=yoni, jco.client.sysnr=20, jco.client.ashost=XXXXXXX}

Repository data: {jco.client.lang=en, jco.client.snc_mode=0, jco.client.client=230, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=yoni, jco.client.sysnr=20, jco.client.ashost=XXXXXXX}

Current pool size: 2, maximum pool size : 5

Channel History

- OK: 2007-01-21 18:36:38 GMT+02:00: Message processed for interface

- OK: 2007-01-21 18:36:38 GMT+02:00: Message processed for interface

- OK: 2007-01-21 18:36:38 GMT+02:00: Message processed for interface

- OK: 2007-01-21 18:36:38 GMT+02:00: Message processed for interface

- OK: 2007-01-21 18:36:38 GMT+02:00: Message processed for interface

5.I'm running this RFC lookup for each item in an order...is there a chance for lack of resuarces or limit of lookups ??

this is my java function usign the RFClookup


String content = "";
MappingTrace importanttrace;
importanttrace = container.getTrace();
// filling the string with our RFC-XML (with values)
String m ="<?xml version="1.0" encoding="UTF-8"?><ns0:ZSD_GET_MATERIAL_FOR_BARCODE xmlns:ns0="urn:sap-com:document:sap:rfc:functions"><EAN11> + a + </EAN11></ns0:ZSD_GET_MATERIAL_FOR_BARCODE>";

RfcAccessor accessor = null;
ByteArrayOutputStream out = null;
try
{
// 1. Determine a channel (Business system, Communication channel)
Channel channel = LookupService.getChannel("SSD230","RFC_Receiver_230");
// 2. Get a RFC accessor for a channel.
accessor = LookupService.getRfcAccessor(channel);
// 3. Create a xml input stream representing the function module request message.
InputStream inputStream = new ByteArrayInputStream(m.getBytes());
// 4. Create xml payload
XmlPayload payload = LookupService.getXmlPayload(inputStream);
// 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);
}
content = 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() );} 
} 
} 
//returning the result – RFC-XML.response 
int strBeg=content.indexOf("<MATNR>")+7;
int strEnd=strBeg+18;
content=content.substring(strBeg,strEnd);
return content;

Points will be awarded ....

cheers mates

Accepted Solutions (1)

Accepted Solutions (1)

moorthy
Active Contributor
0 Kudos

Hi,

Just try out giving only one lineitem as a input and check the result. If it works, then you need to understand that, RFC returns only one value here.

So first test will be sending one line item and checkin gthe RFC lookup return value.

Also check out the context of the data how it sends ?

You can check this blog to debug the RFC calls.-/people/michal.krawczyk2/blog/2006/01/17/xi-debugging-rfc-calls-from-the-xi-not-possible-who-said-that-

Rgds,

Moorthy

Answers (5)

Answers (5)

former_member187587
Contributor
0 Kudos

Dear mates,

it was a problem on the ABAP side.

The problem was to debug the Lookup and see what I get in response.

we moved the Import parameter to the Export parameter this way I could see what was actually send.

thank you all.

Nimrod

Former Member
0 Kudos

Hi,

Please see the SAP Note ; 730870

Regards

Chilla..

former_member187587
Contributor
0 Kudos

Hi again guys,

Thanks for the advices,some points rewarded..... to any ones on a general direction to my problem...

I've found out that my RFC function receives some parameters from the string I'm sending instead of a value. + a +

nevertheless I think my code is clear....

String m = "<?xml version="1.0" encoding="UTF-8"?><ns0:ZSD_GET_MATERIAL_FOR_BARCODE xmlns:p2= "urn:sap-com:document:sap:rfc:functions"><EAN11>" + a + "</EAN11></p2:ZSD_GET_MATERIAL_FOR_BARCODE>";

Do you think it has to do with Multiply RFC calls from the same context?? even though I've checked the scenario with a single line?

appreciate your response

Kind regards

Former Member
0 Kudos

Hi,

Looks like you are trying to send more than one RFC request, in one call.

Please check Q8 of note 730870.

It talks about issuing several RFC calls withing one context.

Regards,

Smitha.

former_member187587
Contributor
0 Kudos

I've already tryed sending a single item.

this action didn't change anything in the behavior of the Lookup response.

Still waiting for someone that encountered the same problem. or have an easier way to debug the RFClookup

cheers

moorthy
Active Contributor
0 Kudos

I feel, while sending the response back, it is overwriting the original value for each line item with different value. Thats the reason, you are getting same value.

Check the context of the mapping call i,e in the mapping.

As you told, you already tried one line item, if so did you get correct result , whatever you supposed to get ? If no, from where the result value coming from ? Hardcoded ?

Rgds,

Moorthy

Former Member
0 Kudos

Hi,

Is the value u re sending is a numeric value.

If its 10 cahracter and u are sending 8 then try prefixing it with 0.

Regards

Vijaya