After creating the Function control, you have to tell it about its connection to the R/3 System. Then, you can start adding Function objects and calling RFCs. The Function control base-class is the Functions collection object. You add and remove functions by using the Add and Remove methods.
Once a function has been added, you can assign parameter values and call it. The Call method of the Function object returns a Boolean value that tells you whether the call executed with no problems. Use the Exception property of the Function object to get more information on any errors. If you have problems calling RFCs, consult the LogFileName and LogLevel properties of the Function control’s base-class (the Functions collection object). These properties provide more information for trouble-shooting.
The following code creates the Function object, sets a connection, sets parameters, and calls the function.
‘ Create the component.
Dim functions As Object
Set functions = CreateObject (
" SAP.Functions " )‘ Set the connection.
Set functions.Connection = conn
‘ Add (retrieve) function from R/3.
func = Functions.Add (
" RFC_CUSTOMER_GET " )‘ Set a parameter.
func.Exports (
" NAME1 " ) = " ACME Steel "‘ Call the function.
If Func.Call <> True then
MsgBox
" Call Failed. Exception " + func.exceptionEnd If
For more information, see: