You can read the company code ID from an event source, connect to the SAP system through a service call to the BAPI_COMPANYCODE_GETDETAIL function, and write the company code list to a relational data source.
In this example, you can configure a service call to access the BAPI_COMPANYCODE_GETDETAIL function, read the company code ID from a Salesforce source, and write the company address and details to an Oracle database.
Perform the following steps to read the company code ID from a Salesforce source and write the company address and details to an Oracle database:
1Create the connections in Application Integration.
2Create the variables in the process properties.
3Read from Salesforce and assign the variables in the process.
4Configure the BAPI service call in the process.
5Write the BAPI output parameters to Oracle tables.
6Run the process.
Step 1: Create the connections
Create multiple connections in Application Integration to connect to the native systems.
Create the following connections:
•Salesforce connection to read company code.
•SAP BAPI connection to access the BAPI_COMPANYCODE_GETDETAIL function in the SAP system.
•JDBC connection to Oracle to write the list of company codes to an Oracle database.
Step 2: Create the variables
Create variables in the process and assign the input and output fields.
For this example, create the following variables:
•A Salesforce input variable to read company code ID from Salesforce.
•A BAPI input variable to capture the BAPI_COMPANYCODE_GETDETAIL_Input parameter and read the company code from the Salesforce source.
•A BAPI output variable to capture the BAPI_COMPANYCODE_GETDETAIL_Output parameter and write the company code details to the Oracle tables.
The following image shows the multiple variables you need to create:
Step 3: Assign the variables
After you create the variables, assign the required input and output variables.
Assign the Saleforce input variable to read the company code ID from Salesforce. Configure the Assignment step to add the Salesforce input variable field.
The following image shows the assignment of the Salesforce input field:
Assign the BAPI input variable to read the company code IDs from the Salesforce input variable. Configure the Assignment step to add the BAPI input variable field. Select Formula as the source of the input field. You can enter a formula read all the input fields from the Salesforce input variable.
The following image shows the assignment of the BAPI input field:
Step 4: Configure the BAPI service call
Configure a Service call in the process to configure the input to the BAPI input parameter.
Configure the BAPI service call to use the SAP BAPI connection that accesses the Z_ALLDTYPES_ALLINPUTOUTPUT_INPUT function.
The following image shows the service call configuration:
Configure the input field in the service call to read from the Z_ALLDTYPES_ALLINPUTOUTPUT_INPUT input variable. In the Input tab, select Field as the value of the BAPI input parameter and select the Z_ALLDTYPES_ALLINPUTOUTPUT_INPUT input field.
The following image shows the configuration of the input field in the service call:
Step 5: Write the BAPI output parameters to Oracle tables
The BAPI_COMPANYCODE_GETDETAIL_Output parameter returns the COMPANYCODE_ADDRESS, COMPANYCODE_DETAIL, and Return parameters. You can write the output parameters to Oracle tables.
Perform the following steps to write the BAPI output to Oracle tables:
Configure parallel paths in the process.
Configure a Parallel Paths step in the process and add three paths to write each of the output parameters to individual Oracle tables.
Configure a Create object in the process.
For each path, configure a Create object. Perform the following steps to configure a Create object:
- Select an Oracle connection to specify the object type as an Oracle table.
- In the Input tab, map a field in the Oracle table with the associated field in the BAPI output parameter.
- Repeat the field mapping for all the output fields that you want to write to the Oracle table.
Step 6: Run the process
After you save the process, the new process appears in the Processes tab.
Click the Start tab in the Process Properties dialog box and enable the Allow anonymous access option.
Select the process in the Design Home page and copy the Service URL. Use the Service URL to run the process. The process runs and the Secure Agent writes the company address and details in the Oracle tables.
The following image displays the Service URL under the Process Properties tab: