RFC Programming in ABAP
™
2EDSEFCB.PLEH
Release 4.6B
RFC Programming in ABAP SAP AG
Copyright
© Copyright 2000 SAP AG. All rights reserved.
No part of this brochure may be reproduced or transmitted in any form or for any purpose without
the express permission of SAP AG. The information contained herein may be changed without
prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software
components of other software vendors.
Microsoft®, WINDOWS®, NT®, EXCEL®, Word® and SQL Server® are registered trademarks of
Microsoft Corporation.
IBM®, DB2®, OS/2®, DB2/6000®, Parallel Sysplex®, MVS/ESA®, RS/6000®, AIX®, S/390®,
AS/400®, OS/390®, and OS/400® are registered trademarks of IBM Corporation.
ORACLE® is a registered trademark of ORACLE Corporation, California, USA.
INFORMIX®-OnLine for SAP and Informix® Dynamic Server TM are registered trademarks of
Informix Software Incorporated.
UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of The Open Group.
HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide
Web Consortium, Laboratory for Computer Science NE43-358, Massachusetts Institute of
Technology, 545 Technology Square, Cambridge, MA 02139.
JAVA® is a registered trademark of Sun Microsystems, Inc. , 901 San Antonio Road, Palo Alto,
CA 94303 USA.
JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for
technology invented and implemented by Netscape.
SAP, SAP Logo, mySAP.com, mySAP.com Marketplace, mySAP.com Workplace, mySAP.com
Business Scenarios, mySAP.com Application Hosting, WebFlow, R/2, R/3, RIVA, ABAP, SAP
Business Workflow, SAP EarlyWatch, SAP ArchiveLink, BAPI, SAPPHIRE, Management
Cockpit, SEM, are trademarks or registered trademarks of SAP AG in Germany and in several
other countries all over the world. All other products mentioned are trademarks or registered
trademarks of their respective companies.
2 December 1999
SAP AG RFC Programming in ABAP
Icons
Icon Meaning
Caution
Example
Note
Recommendation
Syntax
Tip
December 1999 3
RFC Programming in ABAP SAP AG
Contents
RFC Programming in ABAP...............................................................................5
RFC Basics.....................................................................................................................................6
The RFC Interface..........................................................................................................................7
RFC in SAP Systems.....................................................................................................................8
Technical Requirements.............................................................................................................11
Calling Remote Function Modules in ABAP.............................................................................13
Introduction..................................................................................................................................14
Parameter Handling in Remote Calls.........................................................................................16
Calling Remote Functions Locally.............................................................................................17
Calling Remote Functions BACK...............................................................................................18
Using Transactional Remote Function Calls............................................................................19
Transactional Integrity of tRFCs...............................................................................................22
qRFC With Send Queue..............................................................................................................24
qRFC With Send Queue: Overview..........................................................................................26
Programming Serialization.......................................................................................................28
Using.........................................................................................................................................30
Transaction Sequence and Queue Assignment.......................................................................32
Tools.........................................................................................................................................35
Using Asynchronous Remote Function Calls..........................................................................38
Calling Requirements for Asynchronous RFCs........................................................................40
Receiving Results from an Asynchronous RFC.......................................................................41
Keeping the Remote Context...................................................................................................44
Parallel Processing with Asynchronous RFC...........................................................................45
Checking Authorizations for RFC..............................................................................................49
Using Pre-Defined Exceptions for RFC.....................................................................................50
Writing Remote Function Modules in ABAP.............................................................................51
Steps for Implementing Remote Function Modules................................................................52
Programming Guidelines............................................................................................................53
Debugging Remote Function Modules......................................................................................54
Maintaining Remote Destinations..............................................................................................55
Displaying, Maintaining and Testing Destinations..................................................................56
Entering Destination Parameters...............................................................................................58
Types of Destinations.................................................................................................................60
Maintaining Group Destinations................................................................................................63
Maintaining Trust Relationships Between R/3 Systems..........................................................64
4 December 1999
SAP AG RFC Programming in ABAP
RFC Programming in ABAP
RFC Programming in ABAP
December 1999 5
RFC Programming in ABAP SAP AG
RFC Basics
RFC Basics
This section gives a brief overview of the Remote Function Call (RFC) within an SAP System,
that is
• how the RFC Interface works
• the functionality that is provided by the RFC and
• it explains the technical requirements for RFC on R/2, R/3 and external systems on all
currently supported platforms.
The RFC Interface [Page 7]
RFC in SAP Systems [Page 8]
Technical Requirements [Page 11]
6 December 1999
SAP AG RFC Programming in ABAP
The RFC Interface
The RFC Interface
A remote function call is a call to a function module running in a system different from the caller's.
The remote function can also be called from within the same system (as a remote call), but
usually caller and callee will be in different systems.
In the SAP System, the ability to call remote functions is provided by the Remote Function Call
interface system (RFC). RFC allows for remote calls between two SAP Systems (R/3 or R/2), or
between an SAP System and a non-SAP System.
• A calling interface for ABAP programs
Any ABAP program can call a remote function using the CALL
FUNCTION...DESTINATION statement. The DESTINATION parameter tells the SAPSystem that the called function runs in a system other than the caller's. RFC
communication with the remote system happens as part of the CALL FUNCTION
statement.
RFC functions running in an SAP System must be actual function modules, and must be
registered in the SAP System as "remote".
When both caller and called program are ABAP programs, the RFC interface provides
both partners to the communication. The caller may be any ABAP program, while the
called program must be a function module registered as remote.
− The topic Calling Remote Function Modules in ABAP [Page 13] provides details on
calling function modules registered as remote.
− The topic Writing Remote Function Modules in ABAP [Page 51] provides information
on writing function modules that you want to call remotely.
• Calling interfaces for non-SAP programs
When either the caller or the called partner is a non-ABAP program, it must be
programmed to play the other partner in an RFC communication.
To help implement RFC partner programs in non-SAP Systems, SAP provides
− External Interfaces [Ext.]
RFC-based and GUI-based interfaces can be used by external programs to call
function modules in SAP R/2 or R/3 systems and execute them in these systems.
Vice versa, ABAP programs in R/2 or R/3 can use the functions provided by external
programs via these interfaces.
If you want to see some scenarios within a programming example, see the
corresponding unit in the Tutorial: Communication Interfaces [Ext.].
December 1999 7
...