Setting Up the Function Module Object 

Purpose

Before making an RFC function call you must prepare the IRfcModule object representing the RFC function module with all of the parameters of the RFC function.

Prerequisites

You must first obtain a SessionManager object, set up the necessary connection information and start a session before you can start working with RFC function modules.

Process Flow

  1. Obtain an IRfcModuleFactory by using the getRfcModuleFactory method of the SessionManager.
  2. The SessionManager supplies the necessary connection information to the IRfcModuleFactory for creating the IRfcModule object.

  3. Use the IRfcModuleFactory to create an IRfcModule object.
  4. There are two ways to create an IRfcModule object:

    Method

    Advantage/Disadvantage of Using

    Manually, using the createRfcModule method of IRfcModuleFactory

    If you create the IRfcModule object with createRfcModule, you have to explicitly create and add all of the parameters of the RFC function into the IRfcModule object. You have to do so for all of the import, export, and table parameters of the function.

    Using createRfcModule saves calls to R/3 for retrieving function metadata.

    Use createRfcModule, for example, if you know that the RFC function does not have any parameters.

    Automatically, using the autoCreateRfcModule method of IRfcModuleFactory

    If you use autoCreateRfcModule, the IRfcModule object is created together with all the necessary metadata of all the parameters of the RFC function module. You save the work required for creating and adding the parameters' metadata.

    However, using autoCreateRfcModule is less efficient, because it may result in multiple calls to the R/3 system for obtaining the metadata of the function module.

    See the relevant topics above for the details of how to create an IRfcModule object and all of its parameters.

  5. After creating the IRfcModule object with all of its parameters you need to set the value of import parameters of IRfcModule.

You only need to set the values of the parameters representing required import parameters of the RFC function. You may set any other import parameters.

Remember that table parameters may be both import and export parameters, and you may need to set their values as well.

If the RFC module has no parameters, you can call the function module immediately after creating the IRfcModule object.

The following diagram summarizes this process.

 

See Also

For the details of creating an IRfcModule that has parameters see one of the following topics:

For examples see the following topics: