Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Paulo_Vantini
Participant

Introduction


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.


Tables


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:



RFC destination


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:

Function Module


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:

Report


Create the following report in client 001 and activate it:

REPORT  Z_RFC_CLIENT_100.

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,
mess
(80).

START
-OF-SELECTION.

CALL FUNCTION 'Z_RFC_CLIENT_ZJMT001'
DESTINATION dest
EXPORTING
matricula
= matric
funcionario
= func
IMPORTING
zjmt001t
= zjmt001t
" sys      = sysid
EXCEPTIONS
invalid_data
= 1
communication_failure
= 2 message mess
SYSTEM_FAILURE
= 3 MESSAGE mess.

CASE sy-subrc.

WHEN 0.
"  WRITE: / text-004, "sys-id COLOR 5.
SKIP.

loop at zjmt001t into wa.
WRITE: wa-matricula, wa-funcionario,
wa
-cargo, wa-hierarquia.
ENDLOOP.

WHEN 1.
WRITE: 'COM FAILURE'.

WHEN 2.
WRITE: / mess.

WHEN 3.
WRITE: / mess.

ENDCASE.

DEMO


Run the report and fill the requested data:

There you go!