SAP Connector Guide > Part VI: Data Integration Using IDocs > Mapping and Mapping Configuration Tasks Using IDocs > Inbound Mapping to Write IDocs To SAP Example
  

Inbound Mapping to Write IDocs To SAP Example

You can create material master (MATMAS) in SAP using MATMAS IDoc type.
In this example to write MATMAS IDoc to SAP, perform the following steps:
Step 1: Import MATMAS metadata using the SAP Metadata utility.
Perform the following steps to import the MATMAS IDoc:
  1. 1. Launch the SAP Metadata utility and specify the SAP connection properties to connect to the SAP system.
  2. 2. Verify that you select the IDoc option and then connect to the SAP system.
  3. The Next button is enabled only after you establish a connection to the SAP system.
  4. 3. Enter the MATMAS as the message type and MATMAS03 as the IDoc type to fetch the IDoc segments and fields for MATMAS.
  5. 4. To write IDocs, select the Prepare transformation.
  6. 5. Retain the default output directory for the generated mapplet.
Step 2: Import the generated mapplet to Informatica Cloud.
Login to Informatica Cloud and import the MATMAS mapplet XML file from the output directory.
Step 3: Configure a mapping using the generated mapplet.
Perform the following steps to configure a mapping:
  1. 1. Configure multiple flat file sources to provide data to the mapplet input fields.
  2. 2. Add the Mapplet transformation. Draw a link to connect the Source transformation to the Mapplet transformation.
  3. 3. Configure the Mapplet transformation. Select the generated mapplet from the output directory.
  4. 4. Configure an SAP object to write the material master details and a flat file object to write the error details. Draw a link to connect the IDoc_Prepare_Output_Group_For_MATMAS03 to the IDocWriter object. Draw another link to connect the IDoc_Prepare_Error_Output_Group_For_MATMAS03 to the Error_Output flat file object.

Step 1: Importing MATMAS IDoc Metadata

    1. Navigate to the SAP Metadata utility installation directory and double-click the SAPUtil.bat file.
    The Import SAP IDOC/BAPI/RFC wizard appears.
    2. Select the SAP system to which you want to connect.
    All systems specified in the sapnwrfc.ini file appear in the drop-down list.
    3. Enter the SAP user name.
    4. Enter the password associated with the SAP user.
    5. Enter the client number.
    6. Enter the language code.
    7. Select IDoc and click Connect.
    The SAP Metadata utility establishes a connection to the SAP system.
    8. Click Next.
    The Step 2: Select SAP IDoc Prepare Transformation page appears.
    9. Enter the message type as MATMAS and the IDoc type as MATMAS03, and click Fetch.
    You can view the segment and field details of the IDoc.
    10. Select the Prepare transformation and the scope of the transformation as All Input.
    11. Select the segments you want to include in the mapplet.
    You can click Select All Segments to include all segments in the IDoc. You can click Deselect All Segments to remove all selected segments except required segments from the IDoc.
    12. To add other fields into the Control Record input group of a mapplet, perform the following steps:
    1. a. Click Control Page. Add more control records if you have more than one logical system.
    2. b. Select the checkbox for the field that you want to add, and then click Partner Profile > New .
    3. c. Enter the key and value for the partner profile. The key is the field name, and the value is the partner type.
    4. d. Optionally, to add a control record field to the mapplet, from the Control Record page, select the checkbox for the field you want to add. This will enable you to map the selected control record fields when you configure a mapping, integration template, or Mapping Configuration task.
    13. Retain the default directory for the output files and click OK.
    14. Click Finish.
The MATMAS03_Prepare_Mapping.xml mapplet for the MATMAS IDoc is created in the <SAP Metadata Utility installation directory>/generatedMappings directory.

Step 2: Importing the MATMAS03_Prepare_Mapping Mapplet to Informatica Cloud

    1. Select Configure > Mapplets.
    The Mapplets page appears.
    2. Click New.
    The New Mapplet page appears.
    3. Enter an unique name for the IDoc mapplet.
    4. Optionally, enter a description for the IDoc mapplet you want to import.
    5. Select the mapplet type as Active.
    6. Click Upload to navigate to the XML file you generated using the SAP Metadata utility.
    The Upload Metadata XML File dialog box appears.
    7. Click Choose File.
    8. Navigate to the <SAP Metadata Utility installation directory>/generatedMappings directory, select the MATMAS03_Prepare_Mapping.xml file, and click Open.
    9. Click OK.
    You can view the imported mapplet in the Mapplets page.

Step 3: Configuring an Inbound Mapping with the MATMAS IDoc

    1. To create a mapping, click Design > Mappings, and then click New Mapping.
    The New Mapping dialog box appears.
    2. Enter a name and description for the mapping, and click OK.
    3. To configure a 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 select an flat file connection.
    6. Add separate flat file sources for the control_input group and segments in the MATMAS IDoc.
    7. To add an IDoc Mapplet transformation, on the Transformation palette, click Mapplet.
    8. On the General tab, enter a name and description for the mapplet.
    9. On the Mapplet tab, click Select.
    The Select Mapplet dialog box appears.
    10. Specify an IDoc mapplet that you imported using the Prepare transformation and click OK.
    11. Draw a link to connect the Source transformations to the Mapplet transformation. For example, connect the Control_Input source object to the Control_Input_Group for the MATMAS IDoc.
    12. To preview the incoming fields, click Incoming Fields.
    The following image shows the incoming fields:
    Incoming fields for the IDoc Prepare mapplet
    13. Click Field Mappings to map the incoming fields with the mapplet input fields.
    The following image shows the field mapping in the mapplet:
    Field mapping in the mapplet
    14. To add a Target transformation for writing to SAP, on the Transformation palette, click Target.
    1. a. On the General tab, enter a name and description.
    2. b. Click the Target tab and configure SAP target details.
    15. To add a flat file Target transformation for the error output, on the Transformation palette, click Target.
    1. a. On the General tab, enter a name and description.
    2. b. Click the Target tab and configure flat file target details.
    16. Draw a link to connect the IDoc_Prepare_Output_Group_For_MATMAS03 to the IDocWriter object. Draw another link to connect the IDoc_Prepare_Error_Output_Group_For_MATMAS03 to the Error_Output flat file object.
    The following image shows the mapping for the inbound mapping for the MATMAS IDoc:
    The mapping for the inbound mapping for the MATMAS IDoc:
    17. Save and run the mapping.