cancel
Showing results for 
Search instead for 
Did you mean: 

RFC lookup

Former Member
0 Kudos

Hi all,

I want to do an RFC lookup in my message mapping where i need a counter in the receiver filename.

I will be creating the table in the same SAP box as the XI box.

Can sum1 guide me on the steps like:-

1) Do i need to import the RFC?

2)Do i need to create Business systems and Communication channels for that?

3)The udf to call the RFC.

I tried to look at other blogs and forums, but could not find a clear solution. I am working on PI7.0 SP 16.

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member193376
Active Contributor
0 Kudos

Hi

This is the UDF which you will rite. you can hardcode the login credentials or create a .properties file and call it from this UDF. Its recomended not to hardcode the Login credentials.

Use your 2 inputs in this UDF and export it.

import com.sap.mw.jco.*;

JCO.Client mConnection =

JCO.createClient("001", // SAP client

"<userid>", // userid

"****", // password

"EN", // language (null for the default language)

"<hostname>", // application server host name

"00"); // system number

try

{

// Connect to R/3

mConnection.connect();

//Creating repository

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

//Creating function template

IFunctionTemplate functionTemplate =

mRepository.getFunctionTemplate("THE_RFM_NAME");

//Getting JCO function

JCO.Function function = functionTemplate.getFunction();

//Setting import parameters

//Simple parameter

String myImportValue = "someValue";

function.getImportParameterList().setValue(myImportValue, "MY_IMPORT_VALUE");

//Executing Remote Function Module

mConnection.execute(function);

//Export parameters

//retrieving structure

JCO.Structure returnStructure = function.getExportParameterList().getStructure("RETURN_STRUCTURE");

}

catch (Exception ex)

{

ex.printStackTrace();

System.exit(0);

}

finally

{

//ensure that a connection is closed after the function module has been executed

mConnection.disconnect();

}

You can refer to my wiki

https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action&pageid=79888552

Thanks

SG

Saiyog

Former Member
0 Kudos

Hi Anupama,

I'm not sure I understand.

You want to use an RFC lookup to your file reciever in order to take a counter from that file name?

is that correct?

Can you ellaborate what is the exact purpose of this action?

Former Member
0 Kudos

Hi Nimrod,

what i want is, a counter to be added to the file name for all the files received for this particular interface.

The counter standard function can not be used as it will be refreshed each time the map is run.

So we need an RFC lookup so that a table can store the last counter number. The FM will check the last entry in table, increment by 1, and return the value.

Can u tell me how to call the FM, i've seen the code but i'm not sure about the udf. Exactly what i need and what i dont. I just need to call the FM. All the rest of work is being done in the FM itself.

Can u help me with the java udf.

i will pass 2 input parameters to the UDF which will identify the fields in the table and the incremented counter value will be returned by the FM to the udf and finally to the output file name.

Also do i need a Business system n Communication channel if the FM n table is in the same SAP BOX.

Thanks

Anu

GabrielSagaya
Active Contributor
0 Kudos

Hi

1) Do i need to import the RFC?

Yes You need to create the RFC in ECC and import RFC in PI.

2)Do i need to create Business systems and Communication channels for that?

Yes you need to create the Business System and RFC Communication Channel

Its mandatory to have a dummy RFC communication Channell for RFC lookup

3)The udf to call the RFC.

How to Lookup Data Via a RFC User Defined Function?

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

Mapping lookups u2013 RFC API

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

JCO Call is another Concept that doesnot require dummy Communication channel

former_member193376
Active Contributor
0 Kudos

Hi

Create your table, RFC in the pi box.

You need to make a JCO call for that, that call will be in your UDF

write a UDF and call that RFC which will in turn call your table.

For UDF help

http://www.apentia-forum.de/viewtopic.php?t=1962&sid=9ac1506bdb153c14edaf891300bfde25

your scenario will be normal, you dont have to create anything new in the ID.

Thanks

Saiyog

Former Member
0 Kudos

Thanks for replies,

Do i need to install JCO?

Thanks again

Former Member
0 Kudos

Can sumone help me with udf and FM please. Also my questions are not totally answered regarding the Communication channels and Business systems.

thanks

Former Member
Former Member
0 Kudos

thats for XSLT mappings right? Not GUI mapping

former_member181962
Active Contributor
Former Member
0 Kudos