You can use the data provision code pattern Call RFC to save time and effort when you implement a data provider class on the OData Channel. This code pattern is based on the generation tool, Backend Operation Proxy (BOP). To implement the code patterns, you must install the component IW_BEP on your system.
If you want to use the code pattern to execute a Remote Function Call (RFC) from within a data provider class, ensure the following prerequisites are met:
Types used on the RFC interface must have a local type representation
RFC must be invoked
To generate BOP proceed as follows:
Start ABAP Workbench in transaction SE80.
Display the program, for example, ZHS_TEST in the tree view and choose Edit to switch to editing mode. After you have switched to editing mode, the push button in the application tool bar is active.
Place your cursor at the position in the source code where you want the RFC to be called.
Choose the Pattern push button. The Ins. statement dialog box displays.
Select the Other Pattern radio button and enter the technical name of the OData Channel pattern in the corresponding input field, for example/IWBEP/FM_MGW_PATN or use the Input help available for this field to select the technical name.
In the ODC Code Pattern Selection Screen dialog box select the Generate Backend Operation Proxy radio button under Data Provision.
The OData Channel : Generate RFC BOP NG screen displays.
Do the following in the OData Channel : Generate RFC BOP NG screen:
In the RFC Destination field, enter the system alias (system ID and client) in which the RFC is located. You can also use the Input help that is available for this field.
In the RFC Name field, enter the technical name of the RFC, for example, BAPI_FLIGHT_GETLIST. Input help is available for this field, but it can be very performance intensive.
In the BOP Interface Name field, enter the name of the Interface which will be generated when we generate the BOP (when we run the pgm). This interface will contain the types declarations for the parameters of the RFC.
Enter the package name to which the object belongs to in the Target Package field
Enter a valid Transport number.
Now you have two options:
Click to generate the BOP without any customizations.
Select the Customize RFC Call Parameters check box to customize the BOP generation.
The row(s) for the mandatory parameters in the RFC will be non-editable.
On selecting to customize the rfc call parameters, the RFC Call Parameters window displays.
Click the tabs Importing, Exporting, Changing and Tables to navigate between them. The selected tab will be highlighted.
Select/Unselect the parameters to be displayed in the RFC call using the check boxes.
Once done with the selections; click or press F8 to generate the BOP.
A message window displays if the BOP Interface Name already exists. Click Yes to overwrite, and No to stop the generation process and change the BOP Interface name.
On successful BOP generation the code gets generated in the ABAP Editor. Also the message RFC BOP Generated displays in the status bar.
The Call RFC code pattern generates the source code, which is inserted directly into the data provider class.
For more information about data provision code patterns for the ABAP Workbench design time, see Data Provision Code Patterns.