SAP Connector > Part V: Data Integration using BAPI/RFC functions > Mapping and mapping tasks using BAPI/RFC functions > Mappings with BAPI/RFC function example
  

Mappings with BAPI/RFC function example

You can use the bapi_salesorder_createfromdat1 BAPI function to create sales order details for a customer in your organization.
In this example to create a sales order, perform the following tasks:
Step1: Generate a BAPI/RFC mapplet in Data Integration for the bapi_salesorder_createfromdat1 BAPI function.
Log in to Data Integration and generate a BAPI/RFC mapplet that contains the metadata of the bapi_salesorder_createfromdat1 BAPI function.
Step: 2 Configure a mapping using the generated mapplet.
Perform the following steps to configure a mapping:
  1. 1. Specify source objects to enter the order header data from the ORDER_HEADER_IN structure, the partner data using the ORDER_PARTNERS table, and item data using the ORDER_ITEMS_IN table as input parameters.
  2. 2. Add the Mapplet transformation. Draw a link to connect the flat file Source transformation to the Mapplet transformation. Draw the following links:
  3. 3. Configure the mapplet transformation.
    1. a. Select the generated mapplet. Verify that you specify an SAP RFC/BAPI Interface connection for the mapplet.
    2. b. Map the incoming source fields with the BAPI parameter properties.
  4. 4. Configure a flat file object to which you can write the sales order details. Draw a link to connect the Table Output in the Mapplet transformation to the flat file Target transformation. Create multiple flat file target objects to write the sales order. Create the following target objects and map them to the associated output ports in the BAPI mapplet:

Step 1: Generating a BAPI/RFC mapplet in Data Integration for the BAPI_SALESORDER_CREATEFROMDAT1 BAPI function

Perform the following steps to generate a BAPI/RFC mapplet:
    1. To create a mapplet, click Data Integration > New > Mapplets > Mapplet - SAP and then click Create.
    To edit a mapplet, on the Explore page, navigate to the mapplet. In the row that contains the mapplet, click Actions and select Edit.
    The New SAP Mapplet page appears. The following image shows the New SAP Mapplet page:
    To create a BAPI/RFC mapplet, specify the mapplet name.
    2. Enter a unique name for the BAPI/RFC mapplet.
    3. Optionally, enter a description for the BAPI/RFC mapplet you want to generate.
    4. Select the transformation type as BAPI.
    5. Select the BAPI/RFC connection that you want to use.
    6. Select the scope of the transformation.
    In real time, select the transformation option as Transaction. For batch processing and validating in non-production environment, select ALL INPUT as the transformation scope.
    7. Enter the name of the BAPI/RFC function.
    Note: Verify that you enter the exact name of the BAPI/RFC function that you want to retrieve.
    8. Click Get Objects.
    You can view the import, export, and table parameter details of the BAPI/RFC function.
    9. Specify the direction for the tables to indicate if the table parameters in the BAPI are input, ouput, or both.
    10. Click OK.
    The mapplet for the specified BAPI/RFC function is created. You can create a mapping for the generated mapplet.

Step 2: Configuring a mapping with the bapi_salesorder_createfromdat1 mapplet

    1. To create a mapping, click Data Integration > New > Mappings. Select Mapping and click Create.
    2. Enter a name and description for the mapping, and click OK.
    3. To configure the flat file source, on the Transformation palette, click Source.
    4. In the Properties panel on the General tab, enter a name and description.
    5. Click the Source tab and configure the source details.
    1. a. Select a flat file connection.
    2. b. Select Single Object as the Source Type.
    3. c. Click Select to specify a flat file that contains the source fields.
    4. The following image shows the flat file source details:
      The configured source details are displayed.
    6. Add order header, order items, and order partners as flat file source objects for the mapping.
    7. To add a BAPI/RFC mapplet transformation, on the Transformation palette, click Mapplet.
    1. a. On the General tab, enter a name and description for the mapplet.
    2. b. Draw a link to connect the flat file Source transformation to the Mapplet transformation.
    3. c. On the Mapplet tab, click Select.
    4. The Select Mapplet dialog box appears.
    5. d. Select the bapi_salesorder_createfromdat1 mapplet and click OK.
    6. e. Click Connection to specify an SAP RFC/BAPI Interface connection.
    7. The following image shows the bapi_salesorder_createfromdat1 mapplet details:
      The details of the bapi_salesorder_createfromdat1 mapplet are displayed.
    8. f. To preview fields, configure the field rules, or rename fields, click Incoming Fields.
    9. g. Click Field Mapping and map the incoming source fields with the appropriate mapplet input fields.
    10. The following image shows the field mapping of the incoming source fields with the mapplet input fields:
      The Incoming Fields is mapped with the mapplet input fields to configure a mapping with the bapi_salesorder_createfromdat1 mapplet.
    8. To add a flat file target, on the Transformation palette, click Target.
    9. On the General tab, enter a name and description for the target.
    10. Click the Target tab and configure target details.
    1. a. Select a flat file connection for the target.
    2. b. Select Single Object as the Source Type.
    3. c. Click Select to specify the target object.
    4. The Target Object dialog box appears.
    5. d. Select the flat file object, and click OK.
    6. e. Optionally, you can choose to forward rejected rows in the Advanced Target options.
    7. f. Repeat the above steps to add all the flat file target objects.
    8. The following image shows the target transformation details:
      The configured target details for a flat file.
    11. Draw a link to connect the output ports in the Mapplet transformation to the flat file Target transformation.
    The following image shows the mapping configured for the bapi_salesorder_createfromdat1 mapplet:
    The configured mapping for the bapi_salesorder_createfromdat1 mapplet.
    12. Save and run the mapping.