View source | View content page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Show collection (0 pages)
Collections help

Search

Projects:SAP ECC Integration/How to Define Mappings Between Openbravo and SAP ECC Entities

Contents

Introduction

Entity mappings are defined in the Entity Mapping window that is available for system admin role. The header tab of that window defines the mapping between entities, and the integration direction of the mapping. Property mappings of a given entity are defined in the Property Mapping Instance subtab.


Not all property mappings can be defined in the Entity Mapping window, some of them will have to be implemented programmatically.

Using the Application Dictionary

The Entity Mapping Window

The entity mapping window is where the mappings between Openbravo and SAP entities are defined. The header tab defines the relations between SAP entities and Openbravo's, along with the direction of the integration, and the Property Mapping Instance subtab allows to define the mappings for some properties.


EntityMapping.png

Entity Mapping Header Tab

Each record in this tab represents the mapping between the Openbravo and SAP entities. It contains the following fields:

Property Mapping Instance subtab

In this subtab is where the mapping for each property is defined. It contains the following fields:

What property to select depends on the type of the property in Openbravo (DirectPropertyMapping if it is a String, BooleanDirectPropertyMapping if it is a boolean, etc).

And the property class to define a 1:N property is:

Programatically

Sometimes it is not possible to define the property mappings from the Entity Mapping window. For instance, the XML structure of the iDocs is quite complex, and only the properties from the main segment (i.e. the E1WPA01 segment of the WP_PLU iDoc) can be modeled in the Entity Mapping window.


Mappings for those properties that cannot be defined form the Entity Mapping window can be implemented by subclassing the JavaPropertyMappingHandler class. In that subclass, developers can define which SAP ECC fields will be mapped (by overwriting the getPropertySorting method), and can define the implementation of the mappings by overwriting the setPropertyInBaseOBObject method.

The class header

The user must create a subclass of JavaPropertyMappingHandler. Its header must:

For instance, the header for a JavaPropertyMappingHandler to define the property mappings of the Product entity would look like this:

JavaPropertyMappingHandlerHeader.png

How to specify the properties that will be mapped programatically

The getPropertySorting method must be overwritten to specify which properties will be mapped by the JavaPropertyMappingHandler. The properties that must be included for SAP ECC are:

For instance, to map two properties from the iDoc header segment and the properties of four subsegments for the WP_PLU iDoc, the following implementation could be used:

PropertySorting.png

How to define the mapping implementation of imported entities

To define the mappings of entities that will be imported into Openbravo, the setPropertyInBaseOBObject method must be overwritten. The method has three parameters:

For instance, an snippet of an implementation to define the import mappings of a product could look like this:

SetPropertyInBaseOBObject.png

When the property belongs to the segment header (i.e. FILIALE), the value included in the SynchronizableBusinessObject (called itemValue in the snipped showed above) will contain the value itself. For instance, the setOrganization method would look like this:

SetOrganization.png

If the property is included in a segment (i.e. the E1WPA02 segment contains information about the product category), the value included in the SynchronizableBusinessObject will be a list of SynchronizableBusinessObject, and each of those SynchronizableBusinessObjects will contain the properties included in that segment in the iDoc being imported. For instance, the setProductCategory method would look like this:

SetProductCategory.png

In that specific case the segment is included only once, so there is no need to iterate over the list of SynchronizableBusinessObjects.

Notice how an Exception is thrown if a condition is not met. When this happens, an entry for this record will be kept in the EDL Request table in ERROR status, so that it can be reprocessed later.

How to define the mapping implementation of exported entities

To define the mappings of entities that will be imported into Openbravo, the setPropertyInBaseOBObject method must be overwritten. The method has two parameters:

The method must return the value to be exported to SAP ECC for the given record being exported and the given mapped property name.

GetValueOfProperty.png

If the property being mapped is a segment (i.e. E1WPP03 in the example above), then the method must return a list of SynchronizableBusinessObject. For instance, an implementation for the getBusinessPartnerContactData could be:

GetContactData.png

Notice how the returned list contains one SynchronizableBusinessObject per business partner location.

Like in setPropertyInBaseOBObject, it is possible to throw an exception to cancel the synchronization of the record. It will create an error entry in the EDL Request window, which can be reprocessed if needed.

Retrieved from "http://wiki.openbravo.com/wiki/Projects:SAP_ECC_Integration/How_to_Define_Mappings_Between_Openbravo_and_SAP_ECC_Entities"

This page has been accessed 227 times. This page was last modified on 15 January 2019, at 09:52. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.