Skip to Content

Introduction

In this weblog I will focus on the possibilities of SAP XML Document Object Model (DOM) processing at the ABAP stack. My objective is to explain how you can use it in abap mapping. For this I split this weblog into three parts. This document is the last-in-the-series. The first part focused on the conversion of an ABAP table into an XML file and the second part focused on the conversion from a XML file (back) to an ABAP table.

In the document ‘How to … Use ABAP Mapping in XI 3.0’ you can find a simple example XML to XML ABAP mapping. Also in this document you will find the requirements for using ABAP mapping within XI.

This last part focuses on the use of XML DOM and ABAP mapping to convert a flat file structure (for example edifact file or legacy files) using the plain HTTP sender adapter into an XML file. The advantage for having this HTTP connection between two systems instead of using the file adapter with a FTP connection is having a simple synchronous push connection in stead of having a complex asynchronous polling connection.

The Flow

Posting the flat file

The source system will post the flat file to XI using the HTTP plain adapter. Before posting, the used webpage will wrap the flat file into an XML file just by adding a root element. This root element is necessary, because the Plain HTTP adapter of XI accepts only XML.
image

The XI pipeline

XI will map the flat file by an ABAP Class mapping using XML DOM into a full XML file. To do this we use the knowledge of the previous two parts of this weblog.
image

Writing the XML file

XI will send the converted file by a FTP adapter to the target system.
image

The Implementation

For the implementation of this scenario, we have to implement the following steps:

  1. Check the Exchange profile for using ABAP mappings
  2. Create a ABAP Mapping class into the SAP XI client
  3. Create a new product and depended software component in the SLD
  4. Customizing the Integration repository
    1. Importing the software component into the integration repository
    2. Creating the datatype, messagetype en message interface of the outbound message (source flat file)
    3. Creating the datatype, messagetype en message interface of the outbound message (target XML file)
    4. Creating the mapping interface using the abap mapping class
  5. Customizing the Integration Directory
    1. Creating a configuration scenario.
    2. Creating a business service for the target system
    3. Creating a receiver determination
    4. Creating a interface determination
Remark: the plain HTTP adapter posts directly on the XI pipeline, so do not need a Business Service for the sender side.

Step 1 – Integration Repository Profile

Check the exchange Integration Repository profile setting for using ABAP Class mapping. See How to … Use ABAPMapping in XI 3.0.
Setting:

com.sap.aii.repository.mapping.additionaltypes=R3_ABAP|Abap-class;R3_XSLT|XSL (ABAP Engine)

Step 2 – ABAP Mapping Class
  1. Login into XI client using the SAP Gui Logon
  2. Start transaction SE24
  3. Fill Object type: ZCL_XI_FLAT_TO_XML
  4. Push button Create
  5. … Popup screen
  6. Fill Description: XI mapping Flat file to XML
  7. Push button Save
  8. Push button Local object
  9. Click on tab Interfaces
  10. Add interface: IF_MAPPING
  11. Click on tab Methods
  12. Double-click on method: IF_MAPPING~EXECUTE and implements the mapping using XML DOM (see sample code in complete example)

image

 

Step 3 – System Landscape Directory
  1. Go to the Software Catalog
  2. Create a new Product
    Vendor: nl4b.com
    Name: NL4B DEMO FLAT STRUCTURE
    Version: 1.0
  3. Add a Software Component
    Vendor: nl4b.com
    Name: NL4B_DEMO_FLAT_STRUCT
    Version: 1.0
Step 4 – Integration Repository

Below you see a picture of the result after executing the actions described in the following paragraphs

image

Step 4.1 – Import the Software Component Version
  1. Tools -> Transfer From System Landscape Directory -> Import Software Component Version…
  2. Select:
    NL4B_DEMO_FLAT_STRUCT, 1.0 of nl4b.com
  3. Press Import
  4. Add namespace:
    urn:com.nl4b.demo.FlatStructure

Step 4.2 – Outbound message – Flat file

  1. Create DataType
    Name: dtFlatStructure
    Category: Simple type
    Type: xsd:string

    image

    Comment: add no sub elements!
     
  2. Create Message Type
    Name: mtFlatStructure
    Used Data Type: dtFlatStructure

    image
     

  3. Create Message Interface
    Name: mioaFlatStructure
    Category: Outbound
    Mode: Asynchronous
    Output Message: mtFlatStructure

    image
     

Step 4.3 – Inbound message – XML File

  1. Create DataType Level

    Level
    Structure
    Category
    Type
    Occurence
    1
    dtXmlStructure
    Complex Type
    2
    module
    Element
    1..unbounded
    3
    abbreviation
    Element
    xsd:string
    1
    3
    description
    Element
    xsd:string
    1

    image
     

  2. Create Message Type
    Name           : mtXmlStructure
    Used Data Type : dtXmlStructure
    image
     
  3. Create Message Interface
    Name           : miiaXmlStructure
    Category       : Inbound
    Mode           : Asynchronous
    Output Message : mtXmlStructure

    image

 

Step 4.4 – Mapping Objects

  1. Create Interface Mapping
    Name             : imFlat_To_Xml
    Source Interface : mioaFlatStructure
    Target Interface : miiaXmlStructure
    Mapping Type     : Abap-class
    Mapping Name     : ZCL_XI_FLAT_TO_XML
    image

Follow this link for the next steps
 

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

    1. R. Eijpe Post author
      You can find the sample code in part IIIB
      Follow the link ‘Follow this link for the next steps’ at the bottom of the page or /people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping

      with regards,

      Robert Eijpe

      (0) 
    1. R. Eijpe Post author
      You can find the sample code in part IIIB
      Follow the link ‘Follow this link for the next steps’ at the bottom of the page or /people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping

      with regards,

      Robert Eijpe

      (0) 
    1. R. Eijpe Post author
      You can find the sample code in part IIIB
      Follow the link ‘Follow this link for the next steps’ at the bottom of the page or /people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping

      with regards,

      Robert Eijpe

      (0) 

Leave a Reply