You can generate SAP BAPI/RFC mapplets in Data Integration.
The BAPI/RFC mapplet includes a BAPI/RFC transformation. The BAPI/RFC transformation makes BAPI/RFC calls in SAP. BAPI/RFC calls include requests to the SAP system, such as creating, changing, or deleting data in SAP applications. To perform these tasks, BAPI/RFC functions use function parameter values.
Configuring SAP BAPI Connector as a Business Service
You can configure SAP BAPI Connector as a business service within a mapping or a mapping task for SAP BAPI data integration.
BAPI/RFC functions use function parameter values to perform tasks. A BAPI/RFC mapplet includes input and output groups based on the BAPI/RFC transformation.
Function Parameters
BAPI/RFC functions can have the following parameters:
Function Parameter
Description
Scalar input parameters.
Scalar input values. Some BAPI functions require scalar input values to perform tasks such as changing data.
Scalar output parameters.
Scalar output values that a BAPI function returns after performing a task.
Table parameters.
SAP structures with more than one row. Table parameters can be input, output, or both. Input table parameters pass table input values to a BAPI/RFC function. For example, some BAPI/RFC functions require table inputs to change data.
Input and Output Groups
The BAPI/RFC transformation can contain the following groups:
Group Name
Description
Scalar input
Input group for scalar parameters. Contains a field for each scalar input parameter. The group name is SCALAR_INPUT and the field names are SI_<FieldName>.
Table input
One group for each table parameter. The fields represent import structures. The group name is TABLE_INPUT_<structure name> and field names are TI_<StructureName>_<FieldName>.
Scalar output
Output group for scalar parameters. Contains a field for each scalar output parameter. The group name is SCALAR_OUTPUT and field names are SO_<FieldName>.
Table output
One group for each table parameter. The fields represent output structures. The group name is TABLE_OUTPUT_<structure name> and field names are TO_<StructureName>_<FieldName>.
Error output
Passes data from data conversion errors and invalid BAPI/RFC calls. Map the error output field to a target to see error messages about data conversion and BAPI/RFC calls.
BAPI/RFC parameter properties
When you generate a BAPI/RFC mapplet, you can view the parameter properties and return structures.
You can also change the direction of the BAPI/RFC table parameters. The direction of the table parameters determine which groups in the transformation are input groups and which are output groups.
If the BAPI return structure is custom, you can edit the return structure properties that you selected during import for reusable BAPI/RFC transformations. Otherwise, you can view the BAPI/RFC return structure parameters.
The following table describes the BAPI/RFC function parameter properties:
Parameter
Description
Name
Name of the export, import, and table parameters and columns.
Associated Type
Definition of the parameter in SAP.
Short Description
Short description of the export, import, and table parameters and columns.
Optional
Indicates if the Secure Agent should pass a value to the parameter when it calls the BAPI.
Direction
Indicates if the parameter requires input or provides output. Values are: Input, Output, Both, or None.
Datatype
Object data type.
Precision
Object precision.
Scale
Object scale.
Default
Default value of the parameter in SAP, if any. SAP uses the default value when the Secure Agent does not pass a value to SAP.
The following table describes the parameter properties in the Return Structure tab:
Return Structure Parameter
Description
Return Structure
Return parameter name to determine the status of function calls. Value is RETURN if the BAPI contains a default return structure. If the BAPI does not contain a default return structure, select any table output parameter or scalar output parameter of type STRUCTURE. Default is None.
Status Field
Required if you select a value for the return structure. Select a field from the structure for status. If you select None for the return structure, this parameter is blank.
Text Field
Required if you select a value for the return structure. Select a field from the structure for status messages. If you select None for the return structure, this parameter is blank.
Status Indicator For Warning
Enter an indicator message for warning. If you select None for the return structure, the value is W. Default is W.
Status Indicator for Error
Enter an indicator message for error. If you select None for the return structure, the value is E. Default is E.
Status Indicator for Abort
Enter an indicator message for abort. If you select None for the return structure, the value is A. Default is A.
BAPI/RFC functions with nested structures
You can import metadata for a BAPI/RFC functions with nested structures.
A BAPI/RFC transformation includes multiple groups. When a BAPI function contains a nested structure, ports for the input and output groups in a BAPI/RFC transformation use the following naming convention:
<group_name>_<parameter_name>_<field name>
For example:
SCALAR_INPUT_PARAM1_FIELD1
If there are multiple input or output structures, the BAPI/RFC transformation includes each structure parameter name in the port names. For example, BAPI Z_TST2 has the parameter INPUT1, which is of the type ZTYPE1. ZTYPE1 has several components such as FIELD1 and FIELD2. FIELD2 is a component of the type structure. It contains field F1. The naming convention in the BAPI/RFC transformation for FIELD 1 is:
SCALAR_INPUT_INPUT1_FIELD1
The naming convention in the BAPI/RFC transformation for the field F1 is:
SCALAR_INPUT_INPUT1_FIELD2_F1
System variables
SAP uses system variables to set default values for some BAPI import parameters. The variables provide information, such as current date and time for the operating system on which SAP runs. System variables start with “SY-”. For example, SY-DATLO represents the local date of the SAP system.
The Secure Agent provides values for some system variables to define default input values for BAPI/RFC parameters. The Secure Agent uses the values as default input values for some ports of BAPI/RFC transformations. The Secure Agent uses the default values when there is no input for a port or when the port is not connected to an upstream transformation or source.
You can use the following system variables:
System Variable Name
Description
SY-LANGU
Log in language from the SAP application connection properties.
SY-MODNO
RFC handle value.
SY-MANDT
Value taken from the SAP application connection properties.
SY-DATUM
Local date on the Security Agent machine processing the data.
SY-UZEIT
Local time on the Security Agent machine processing the data.
SY-UNAME
Logon user ID from the SAP application connection properties.
SY-HOST
SAP host name from the SAP application connection properties.
Integration ID in BAPI/RFC mapplet
The Integration ID field is a key field in the BAPI mapplet. Each BAPI/RFC mapplet includes an Integration ID input field and output field.
When you run a mapping with a BAPI/RFC mapplet, the Secure Agent makes a BAPI/RFC call to SAP to process the data. By default, the BAPI/RFC mapplet commits every 1000 rows when you run a mapping.
The BAPI/RFC call is based on the input data of the Integration ID ports. The Secure Agent makes one call to SAP for each Integration ID. Pass a value to the Integration ID ports in the scalar input group and all mandatory table input groups of the BAPI/RFC mapplet.
Note: You must map the Integration ID input field even when a BAPI or RFC does not require other input fields.
If the BAPI/RFC call fails or if there is a data conversion error, SAP passes the data for the integration ID in comma-separated format to an error output group. If the mapping contains a target instance that is connected to the error output group, the Secure Agent writes the data to the target.
Target object for BAPI/RFC error output
To receive input data from a BAPI/RFC function call or data conversion errors from SAP, you can map a target transformation to a BAPI/RFC mapplet.
Create a target transformation with a column of the String data type and precision of 65535. Connect the column in the target object to the Error Output Group in the BAPI/RFC mapplet. The Secure Agent writes the error output data up to 65,535 characters to the target in comma-delimited format. If the error output data is longer than 65,535 characters, the Secure Agent truncates the data.
Rules and guidelines for BAPI/RFC mapplets in mappings
When you configure a mapping with a BAPI/RFC mapplet, use the following rules and guidelines:
•Pass a value to the Integration ID ports in the scalar input group and all mandatory table input groups of the BAPI/RFC transformation.
•Add a target object if you want to receive BAPI/RFC function call errors from the BAPI error group.
Use the following guidelines when passing data to BAPI/RFC function input parameters:
•When the function input parameter data type is INT1 or NUMC, provide positive values for the function input.
•When the source input data for a BAPI/RFC function is of the integer data type, do not use string data in the source transformation. Otherwise, the mapping fails.
•If the input data for a BAPI/RFC function mapping contains a higher scale than the SAP metadata specification, the Secure Agent rounds the data to comply with the SAP metadata. When you run a mapping in high precision mode, the mapping can fail due to overflow if the round-off data cascades to the precision digits. For example, the data type and precision for a BAPI/RFC function parameter is DEC (6,5). The input data that you pass to the function parameter is 9.99999. When the Secure Agent processes the input data, it rounds the input data to 10, which is not compatible with the SAP metadata. The mapping fails.