Manually Creating the IRfcModule Object
Use
Creating the IRfcModule object manually means that you initially create an empty IRfcModule object and then you create and add its parameters in a separate step.
Manually creating the IRfcModule object involves more work, but it gives you more control over the creation of the parameters of the function module.
Another reason for creating the IRfcModule object manually is when you know that the RFC function does not have any parameters. In such a case, it is not necessary to create or add any parameters to the IRfcModule object. Using auto-create may result in an unnecessary connection to the R/3 system to get the metadata of the parameters of the function, when there is none.
Prerequisites
SessionManager and all the necessary connection properties must be set up.Procedure
For example, if the function module contains only simple parameters (individual fields), then you only need to obtain an ISimpleFactory. If the function module also contains a structure parameter, you need to also obtain an IStructureFactory.
You only need to obtain a single factory interface for all the parameters of the same type.
You have to perform these two steps for all of the import, export, and table parameters of the function.
Note that RFC function parameter are named parameters, meaning that the order of the parameters within the function is not important. Therefore it is not important which parameter you create or add first.
Note that the order of the fields in a structure or a table is important.
As an alternative to creating all the individual fields of a table or a structure, you can auto-create the table or the structure.
After completing this step (Step 4) you have defined the IRfcModule object and all of its metadata (that is, all of the metadata of the parameters of the RFC function modules). You can now access the metadata of the various parameters of the function module by using the various get methods of the IRfcModule object.
The following diagram summarizes the steps for manually creating an IRfcModule and its parameters. Inside the rectangular area are tasks that are performed automatically if you
use auto-create to create the IRfcModule.Example
The code in
Example: Calling an RFC Function with Parameters manually creates the IRfcModule object and creates and adds all the parameters to it.