cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Lookup error

Former Member
0 Kudos

Hi Friends,

I'm working on RFC Lookup.

For that, I've written UDF in Message Mapping, the code is as follows:

From source I'm giving CustomerID(source field) as input, which should be received by RFC as import parameter and it should give export parameter which i've mapped to target field.

As I have hard coded payload, for whatever the input atleast it should work.

But when I test on Message Mapping, it is not giving any errors as well as not producing any output.

Please help in this regard.

-


//write your code here

String rfcOutput = "";

// filling the string with RFC-XML

String rfcInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:MT_FileSender_Cust xmlns:ns0=\"http://tcs.com/Team3/GroupD1\"//><CID>101</CID></ns0:MT_FileSender_Cust>";

RfcAccessor accessor = null;

ByteArrayOutputStream out = null;

try {

// 1. Determine a channel (Business system, Communication channel)

Channel channel = LookupService.getChannel("Plant_Maintenance_Reciever","CC_RFCReceiver");

// 2. Get a RFC accessor for a channel. accessor = LookupService.getRfcAccessor(channel);

accessor = LookupService.getRfcAccessor(channel);

// 3. Create a xml input stream representing the function module request message.

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

// 4. Create xml payload

XmlPayload payload = LookupService.getXmlPayload(inputStream);

// 5. Execute lookup.

Payload rfcResult = accessor.call(payload);

InputStream in = rfcResult.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);

}

rfcOutput = out.toString();

}

catch(LookupException e) {

//importanttrace.addWarning("Error while lookup " + e.getMessage() );

}

catch(IOException e) {

//importanttrace.addWarning("Error " + e.getMessage() );

}

return rfcOutput;

-


and if u want i can send the screen shot of error that i got in RWB.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Krishna,

Use the ID of user who can run the TA which is being used by RFC while pushing the data.

Regards,

Shabarish_Nair
Active Contributor
0 Kudos

the user you have given in the communcation channel for RFC, can you check if it has the proper rights ?

It should be a RFC user. Confirm this with your BASIS team and then check again.

Former Member
0 Kudos

Hi Krishna,

<b>As in the mapping time you are using communication channel and business service for making RFC lookup ..</b>

so just check the mapping in IR only using Test Mapping tool...there you can easily see whether target values are coming up or not...if not then what is the errro..

<b>there is no need of running the scenario end to end for RFC lookup..</b>

hope i am clear to you..

Regards,

Former Member
0 Kudos

hi krishna,

vats the error u r getting?

also, while testing mapping with rfc look up u shud have the proper receiver communication channel in ID activated. this is the channel that is used for calling the rfc.

[reward if helpful]

regards,

latika.

Former Member
0 Kudos

Hi Latika,

Receiver communication channel (RFC Receiver) is active.

And when testing at Message Mapping i'm not getting any errors, but no output also.

And when testing in RWB Component monitoring using Test Message by giving the input payload, i'm getting the error called: <b>Error while sending the message: 401 unauthorized</b>.

If u want I can send the screen shot to ur mail id.

Thanks

krishna.

Former Member
0 Kudos

hi,

this error is because u r entering wrong uname/pwd

plz make sure u r using correct uname/pwd for connecting to <b>xi server</b> while testing thru rwb.

[reward if helpful]

regards,

latika.

Message was edited by:

Latika Sethi

aashish_sinha
Active Contributor
0 Kudos

Hi Krishna,

Check out the communication channel you configured for this RFC and check out for the System information you provided for the RFC server. You might be supplying wrong information(user , password, sys num, and server).

Regards

Aashish Sinha

PS: Reward points if helped