The objective of this simple document is to show how to make an RFC call in another client of the R/3 system. Let´s start with a quick review of some concepts by taking a look at the classic figure below. Since the repository is client independent and most part of the tables are client dependent, we´ll be calling an RFC in another client to get data from its database.
Client Creation and Copy
The first step is to create another client. If you do not already have one, start a creation of it through transaction SCC4 according to the print below:
Fulfill the data below. You´ll need to create a logical system in using the customizing or transaction SALE.
After that, make a copy of your main client to your client target through transaction SCCL. You will need to change system default parameter login/no_automatic_user_sapstar to 0 in order to logon with SAP* in your new client.
We could use any table for this turorial. We´ll be using the table below. If it is a table in customer namespace remember to create it before making the copy of the client, so that you´ll have it in both clients. The main client in this tutorial will be 001 and the target client will be 100.
The print below show that in client 001 we do not have any records for table ZJTM001:
But in client 100 which is the RFC target system we have data fulfilled:
Before creating the FM let´s create the RFC destination in client 001 in transaction SM59. I am using Netweaver trial so I just addressed my localhost and checked the remote connection for client 100.
Remember to address the user in the target:
Checking the connection:
Create in your package in client 001 a function group and a FM as remote:
Create the import and export parameters with the “pass by value” since all parameters are passed by reference:
In this tutorial we have the following code to retrieve the data:
Create the following report in client 001 and activate it:
parameters: matric TYPE zjmt001–matricula,
func TYPE zjmt001–funcionario,
dest TYPE rfcdes–rfcdest DEFAULT ‘logsys100’.
DATA: zjmt001t TYPE zjmt001_t,
wa type zjmt001,
“sysid LIKE sy-sysid,
CALL FUNCTION ‘Z_RFC_CLIENT_ZJMT001’
matricula = matric
funcionario = func
zjmt001t = zjmt001t
” sys = sysid
invalid_data = 1
communication_failure = 2 message mess
SYSTEM_FAILURE = 3 MESSAGE mess.
” WRITE: / text-004, “sys-id COLOR 5.
loop at zjmt001t into wa.
WRITE: wa–matricula, wa–funcionario,
WRITE: ‘COM FAILURE’.
WRITE: / mess.
WRITE: / mess.
Run the report and fill the requested data:
There you go!