cancel
Showing results for 
Search instead for 
Did you mean: 

RFC lookup issue

Former Member
0 Kudos

Dear experts,

i have a file to file scenario where in the graphical mapping i have to write a RFC lookup to get some data from R3 system ...

i have written the following RFC lookup and it is working fine....

java.lang.;java.util.;com.sap.aii.mapping.lookup.;java.lang.reflect.;com.sap.mw.jco.;java.io.;

JCO.Repository mRepository;

// Change the logon information to your own system/user

JCO.Client mConnection = JCO.createClient(

"500", // SAP client

"test", // userid

"temp", // password

"EN", // language

"gadrp700", // host name

"03" ); // system number

// connect to SAP

mConnection.connect();

// create repository

mRepository = new JCO.Repository( "SAPLookup", mConnection );

// Create function

JCO.Function function = null;

IFunctionTemplate ft = mRepository.getFunctionTemplate("Zlookup_test");

function = ft.getFunction();

// Obtain parameter list for function

JCO.ParameterList input = function.getImportParameterList();

// Pass function parameters

input.setValue( a , "REC" );

mConnection.execute( function );

String ret = function.getExportParameterList().getString( "PAR" );

mConnection.disconnect();

return ret;

only problem is i have to hardcode the system details user id and pwd...i know that i can create a business service and RFC communication channel which i have done ...but i do not know what addition needs to be done in the code...can you pls help me regarding what addition needs to be done in code...

my business service name is : BS_test

RFC channels name is : RFC_channel.

Edited by: Ravi Mehta on Jun 22, 2009 4:23 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ravi,

You are doing a RFC lookup using JCO connection. It is very old. So please see this help and do accordingly. In this you dont need to hardcode anything. For business system, you can do a UDF for getting the system name. So based upon the system name do a Fix Values. Only thing you need to maintain is the communication channel when you transport.

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70d90a91-3cf4-2a10-d189-bfd37d9c...

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1...

Regards,

---Satish

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can do something like this:

If your service is a receiver or a sender, use the node Receiver /sender from the constants options. Create value mapping for your service, RFC CC pair in ID and use this in the mapping and give these two as inputs to your lookup.

Regards,

Merrilly

Edited by: Merrilly Don Thomas on Jun 22, 2009 8:39 PM

Former Member
0 Kudos

i understand that by this i will get the service and channel name in the udf but what additions i need to do in the above code

Former Member
0 Kudos

Hello Ravi,

Check this blog: [https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3404] [original link is broken] [original link is broken] [original link is broken];

If you are using PI 7.1 you need not write UDF for this but use RFC lookup function.

Thanks,

Beena.

Former Member
0 Kudos

Dear Ravi,

I do not think you make any changes to this code for dynamism. It's better that you follow the articles given by Satish. It's more flexible.

Regards,

Merrilly