on 04-30-2009 2:33 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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?
Mapping lookups u2013 RFC API
JCO Call is another Concept that doesnot require dummy Communication channel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
this contains the code....
Hi,
Did someone show you this link?
Regards,
ravi
Hello,
You can check the below pdf.
Thanks and Regards
Hemant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.