You are on page 1of 11

What is RFC in SAP?

RFC is used to communicate between SAP systems and SAP to Non-SAP systems using TCP/IP protocol.
RFC means that the ABAP programmer does not have to write his or her ow n communication routines. For
an RFC call, the RFC interface Converts all parameter data to the format required in the remote system
calls the communication routines that are required to communicate with the remote system handles errors
that occur during the communication.
RFCs are defined in T-Code SM59. There are 4 types of RFCs
1. Asynchronous RFC
2. Synchronous RFC
3. Transactional RFC
4. Queue RFC
1. Async hronous RFC:
Like a post card. The sending system may or may not receive it. i.e. there is no acknow ledgement from
the receiving . The transmission is not reliable.
2. Sy nchronous RFC:
It is not like ARFC. It gets an acknowledgement from the target system. ( Like a register post).
If the receiving system is not available the process goes into RFC/ CPIC/ Sleep mode and waits until it is
wakened by the target system. Target system/ Receiving system may be busy i.e. all the resources are
used up. This is reliable but time consuming and expensive (Client Copy) the job should get finished.
3. Transactional RFC:
TRFC It is an advanced version of ARFC and SRFC. T he request goes to receiving system if it is not
handled a Transaction ID is generated by the source system. A program RSARFCSE is scheduled in the
background to run for every 60 seconds. Transaction SM58 is used for Transactional RFC. It is used to
document all the transactional IDs and ensure that they are received by the recipient system. This is
consistence and reliable.
4. Queued RFC:
It is an advanced version of TRF and ensures that the transaction is committed based on FIFO/ Queue. It
ensures transaction consistency of LUW and reliability of data transmission.
SMQ1 to monitor the outbound queues of a sending system refer SCOTT for FAX
SMQ2 Provides interface to monitor inbound queues.

What to check when RFC Connection fails?


Check the following:
1.Port Number

2.Hostname
3.RFC User / Password
4.RFC user authorizations

RFC Tables
For tRFC outbound the tables used are ARFCSSTATE and ARFCSSDATA.
For qRFC outbound the tables used are TRFCQOUT ARFC SSTATE and ARFCSSDATA.

RFC DES: Destination table for Remote Function Call


RFCATTRIB: Administration table for RFC destinations
RFC DOC: Description of Possible RFC Connections (->RFCDES)
RFCSY SACL: List of permitted trusted systems for the current system
RFCCHEC K: Table for asynchronous RFC administration
RFC TRUST: List of existing trusting systems
RFC GO: RFC stub generation - generation of user parameters
RFCCMC: CMC data for mail
RFCSTXTAB: RFC statistics administration
RFC2SOAPS: RFC After SOAP Stubs Directory
ARFCSSTATE: Description of ARFC Call Status (Send)
ARFCSDATA: ARFC Call Data (Callers)
TRFCQOUT: tRFC Queue Description (Outbound Queue)
ARFC RSTATE: Status of ARFC Calls on Receiver Side

What is BAPI?
BAPI (Business Application Programming Interface) is a set of interfaces to object-oriented
programming methods that enable a programmer to integrate third-party software into the
proprietary R/3 product from SAP. For specific business tasks such as uploading transactional data, BAPIs
are implemented and stored in the R/3 system as remote function call (RFC) modules.

What is the difference between SAP RFC & BAPI?


BAPI stands for Business Application Programming Interface.
It is a library of functions that are released to the public as an interface into an existing SAP system from
an external system.
RFC stands for Remote Function Call
RFC is the protocol used to call functions in an R/3 system by a caller external to R/3 or to call programs
external to R/3 from an R/3 system
Differe nce
RFC makes direct system calls
BAPI makes indirect call through objects(programs) to Non SAP systems.

How to create an RFC destination?


Go to SM59 transaction

Click on create icon in the above screen, which leads to below screen

Specify RFC Destination name and description and connection Type in the above screen

Please note respective connection type to be selected from dropdown based on the connection required.
Usually 3 is for ABAP system. (Pls find screenshot below)

In the below screen, please select load balancing radio button based on your system setup (i.e if there is
load balancing configured for your system, specify it as yes otherwise no)
Please provide Target host details like hostname or ipaddress and system number as below:

As shown below, Proceed to Logon & security tab and provide follow ing details :
Select trusted system as no, in case you would like to connect to a system w ith a user id and password.
If you dont want to get authenticated by credentials specify the system as trusted system which wont
prompt to enter user id/pw d credentials in the below screen.
Please provide Language details like EN (for English), Client details, User id and password for the system
you would like to create a connection.

Please leave default values in other tabs (i.e MDMP & Unicode, Special options, Administration) and then
click on Save to complete the RFC creation.

How to Test RFC connection?

If it functioning well it should show output similar to below screen :

If this is fine, come back to earlier screen and execute Unicode test by clicking the button. Output similar
to below screen, should be displayed if connection is OK

Also you need to perform authorization test to make sure user id / password credentials provided are
correct.
Please navigate as below and perform the test:

Navigate to Utilities -> Test -> Authorisation test and click the same to execute.

If the RFC configuration is fine, screen shot similar above will appear. Otherwise an erro r w ill be displayed
based on which you need to troubleshoot to fix the issue.

How to delete an RFC?


Go to SM59 and select the RFC that is to be deleted as shown below:

And click on delete icon

Click yes to confirm deletion, which deletes the RFC.

How to export and import RFC information


This can be used to take backup of RFC destinations before system copy and can be restore d once system
copy is over.
1. Login to SAP Server with sidadm user
2. create a file with rfcexp.dat with below mentioned data
export
client =771
file="F:\rfcexp.ctl"
Select * from rfcattrib
Select * from rfcdes
Select * from rfcdoc
Select * from RFCSY SACL
select * RSECACHK
select * RSECACT B
3. Run command R3trans -w rfcexp.log F:\rfcexp.dat

4. Export should be over with RC=0


5. For import create file rfcimp.dat with following content
import
file="F:\rfcexp.ctl"
6. Run Command R3trans -w rfcimp.log rfcimp.dat
RFCs should be imported

How to reset status of queue in qRFC?


Answer:
T-Code : SMQ1 ---> qRFC monitor ---> reactivate queue
Additional Info:
Check SM13 for "Waiting for Updates" for root cause analysis on queue status

Establishing a Connection Between AS ABAP and AS Java


The AS ABAP uses the SAML service of the AS Java to perform the SAML protocol execution with the
source site. Therefore the AS ABAP needs a connection to an AS Java with a running SAML service to
perform SAML authentication.
Normally the AS Java used is the one installed on the same instance as the AS ABAP. However, it is
possible to use any other AS Java with a proper release version. To check whether the AS Java has a
suitable release version:
Configure the connection between the AS ABAP and the AS JAVA
Activate SAML for a resource on the AS ABAP as described in Activating SAML for Resources in the AS
ABAP
In the SAML configuration dialog box in transaction SICF, choose Test Connection.
If the AS Java does not have a suitable release version, you get a corresponding error message.
Pre requisites
The SAML service of the AS Java is running.
Procedure
Configuration on the AS Java
1. In the JCo RFC Provider of the AS Java, check whether there is already a configured connection to
the AS ABAP that has a corresponding entry in the maintenance of RFC destinations in the AS
ABAP.
2. If there is no such connection yet, create a new connection with the following values:
Field Name
RFC

Value

destination
Program ID

We recommend that you use: SAML_SERVICE_<SID>where <SID> is the


system ID of the AS ABAP to which you are connecting.

Gateway host

Enter a host name on which a gateway process of the AS ABAP runs (this can
be any application server of the AS ABAP).

Gateway

Enter the port of the gateway or the alias (usuallysapgw <nn> where <nn> is

service

the instance number of the AS ABAP).

Number of

This number determines how many SAML authentications can be executed in

processes

parallel and thus depends on the expected rate of SAML authentications per
second. For getting started, use 1.

Re pository
Application

Application server of the AS ABAP

server host
System

System number of the AS ABAP

number
Client

Client of the AS ABAP

Language
User

The user must have appropriate authorizations to access the repository.

Password
In the RFC destination section and the Repository section, configure a connection to the same AS ABAP.
3. Choose Set.
The connection should appear in the list on the left side with a running symbol. If not, check the log
files to find the cause of the error.
Configuration in the AS ABAP
1. Start the Configuration of RFC Connections (transaction SM59).
2. Check whether the RFC destination SAPJ2EE is already pre-configured and points to the local AS
Java using connection data that matches the data you have found or entered in the JCo RFC
Provider of the AS Java.
3. If this is not the case:
a. Create a new RFC destination of type T.
b. On the Technical Settings tab page, choose Registered Server Program as Activation Type.
c. Enter the same Program ID, Gateway Host, and Gateway Service as you entered in the
connection on the AS Java.
d. Save your data.
e. Choose Connection Test to check whether the connection between the AS ABAP and the AS
Java is correctly established.
Result
You have an RFC destination in the AS ABAP that can be used to communicate with the AS Java.
What is the function module to c heck RFC Connection?

Call the Function module "RFC_PING" and check the SY-SUBRC EQ 0.


If you want some sample code, check the where used list for this FM
and also the function module "LDAP_CHECKIN_RFCDEST"
What is the RFC API?
The SAP system provides the RFC API (Remote Function Call Application Programming Interface) that you
install on non-SAP systems to help you implement RFC partner programs. The RFC API is a set of Clanguage routines that perform certain communications tasks for you.
The RFC API supports the follow ing external systems:
Microsoft Windows platforms (Windows 2000 and Windows XP)
HP-UIX
Sun Solaris
Alfa OSF
IBM AIX
OS 390
OS 400
These platforms use the RFC functionality between an SAP system and a C program. It is of no
significance whether the remote function is provided in an SAP system or in a C program.
For each supported platform, there is an RFC SDK including the RFC library specific for each of these
platforms, SAP RFC header files and some sample RFC programs.

The RFC API is always require d


Both methods for implementing RFC programs use the RFC API:
RFC programs generated by the RFC Interface Generator use API routines to call an SAP function
module. In addition, the application you write (that calls the RFC stub program) must also use API
routines to establish a connection with the SAP system, prepare table parameter structures, and so
on.
User-created programs (if you write your ow n) must likewise use API routines. Your program must
perform all the same communication tasks as an automatically-generated stub and its caller.
For information about the RFC API components you need for your RFC projects, see Contents of the RFC
SDK.

You might also like