cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Lookup

Former Member
0 Kudos

Hi Experts,

Currently Iu2019m working on Oracle to CRM scenario, wherein the oracle system will create a customer master file on the ftp server. From ftp server I need to pick up the file and send it to CRM system via IDOC. While sending the IDOC I need to check whether the customer is exists in CRM system. To know whether the customer entry is exists or not in CRM system we have designed a RFC which takes input as email address from the source and pass it to RFC and that RFC will return Y or N and PARTNER_GUID(if customer is exists then only itu2019ll return PARTNER_UID).

RFC contains one input parameter EMAIL and two output parameters RETURN and PARTNER_GUID. The RETURN parameter will return Y (yes) or N (no), if it returns Y then it means customer record is present in CRM system and PARTNER_GUID will contain the guid of the customer and no to pass the other fields and I need to pass PARTNE_GUID to the PARTNER_GUID (IDOC field). If RFC RETURN parameter returns N then it means customer entry is not exists in the CRM system and I need to create IDOC with complete data i.e., I need to pass the other fields to the IDOC.

In a nutshell, below is my requirement

My requirement is if RFC output parameter returns Y then I need to pass the value of PARTNER_GUID (RFC output parameter) to PARTNER_GUID (IDOC field) and no need pass the other fields value to IDOC.

If RFC RETURN parameter return N then I need to create rest of the fields customer_number, customer_name,address1,address2, email and phone.

At the source we are sending the following fields

Customer_number

Customer_name

Address1

Address2

Phone

Email

At target side the fields are

PARTNER_GUID

Customer_number

Customer_name

Address1

Address2

Phone

Email

Below is the RFC lookup that

emailCheck (string email, Container )

//write your code here

//write your code here

//write your code here

String ret = null;

JCO.Repository mRepository;

JCO.Client mConnection = JCO.createClient(

"100", // SAP client

"xyz", // userid

"xyz", // password

"EN", // language

"10.10.10.10", // host name

"02" ); // 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( "ZCRM_PARTNER_EMAIL_CHECK" );

function = ft.getFunction();

// Obtain parameter list for function

JCO.ParameterList input = function.getImportParameterList();

// Pass function parameters

input.setValue( email , "IV_EMAIL" );

mConnection.execute( function );

ret = function.getExportParameterList().getString( "RETURN" ) ;

ret2 = function.getExportParameterList().getString( "PARTNER_GUID" ) ;

mConnection.disconnect();

return ret;

Can anyone correct my UDF and my doubt is how we can achieve the above functionality. In UDF can it is possible to store the of the RFC lookup i.e., Y or N and check the same for every source before sending it to IDOC. instead of calling RFC lookup for each field.

Your help is highy appreciated

Faisal.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Faisal,

If you plan to implement this RFC lookup in PI/XI, I don't recommend using the JCO method, but instead using the official PI/XI RFC lookup APIs (https://help.sap.com/javadocs) !

If you wan't to cache results, why not designing a RFC lookup helper class, with a static cache that would be shared b/w calls (but you may have to implement a cache management mechanism if lots of data are to be stored, cleanup etc)

Rgds

Chris