MS EXCEL as OLE Client 
Task
From within MS EXCEL, call a function module from the R/3 system and display the R/3 data on an EXCEL worksheet for local processing. EXCEL as OLE client requests data from the R/3 system. The R/3 system as OLE server provides it after a function module call.
The example application shall
- call the function module RFC_CUSTOMER_GET for displaying customer data.
- be programmed as macro under MS EXCEL in Visual Basic for Applications (VBA).
Overview: Unit Objectives
In this unit you will learn how to
- call a function module in the R/3 system via an MS EXCEL macro.
- log on to and off from the R/3 system using the Function Control.
- prepare import parameters for value transfer.
- call a function module using the Function Control.
- display the R/3 data, correctly formatted, on an EXCEL worksheet.
- assign program steps to the components in the R/3 architecture.
Prerequisites
You are authorized to log on to the R/3 target system.
Your frontend is equipped with MS EXCEL, into which a Visual Basic Editor is integrated.
You have some basic knowledge in Visual Basic for Applications.
You have some basic knowledge about object-oriented programming.
You have determined the interface definition of the function module you want to call.
See also:
Evaluating Function Modules Using SAP Assistant.
Basics
There are two different variants for using EXCEL as OLE client to call the R/3 system remotely. The programming steps differ only slightly.
- Using local OLE objects. In this case, an RFC server object is used as basic object:
CreateObject("RFC.ServerObject")
Using OCX Controls. You use the Function ActiveX Control to access the R/3 system. The Function Control in this case is defined as collective object for explicit functions:
CreateObject("SAP.Functions")
See also:
Accessing Function Modules Using Function OCX in VB
Since ActiveX Controls are DLLs, in connection with EXCEL as OLE client this variant offers a considerably better performance.
How to Continue
Architectureor
Exercise 1: Program Framework and Declarations