sapcrmorder Data Hub Extension

The sapcrmorder Data Hub extension provides the integration content to connect a SAP Commerce Cloud installation with an SAP CRM system for order fulfillment.

It is responsible for creating IDocs and sending them to SAP CRM, to replicate SAP Commerce Cloud orders to SAP CRM and to forward order confirmations, delivery creation notifications, and goods issue notifications from SAP CRM back to SAP Commerce Cloud. Furthermore, the extension processes cancellation requests from SAP Commerce Cloud, and cancellation notifications from SAP CRM.

The sapcrmorder Data Hub extension acts as a parent extension for the following extensions: sapcrmorder-raw, sapcrmorder-canonical, and sapcrmorder-target. This split follows the Data Hub archetype structure. The sapcrmorder Data Hub extension was split into separate extensions to allow for greater flexibility and modularity.

Dependencies

The sapcrmorder Data Hub extension depends on the following Data Hub extensions:
  • sapcoreconfiguration
  • sapidocintegration
  • sapidocoutboundadapter
  • saporder

Overview

The following graphic gives an overview of the order-related integration between SAP Commerce Cloud and an SAP CRM system via Data Hub.

The orders created in SAP Commerce Cloud are sent as CSV files to Data Hub, which stores them as raw items. During composition, the raw items are converted into canonical orders and subordinate items. During publication, the canonical orders are converted into target items that correspond to IDoc segments. Using the IDoc outbound adapter, the corresponding target items are assembled in IDocs that are sent as XML over HTTP(S) to the SAP CRM system, which starts order fulfillment.

When the system replicates sales orders from SAP Commerce Cloud to SAP CRM, SAP CRM orders are created automatically. Once you create a delivery or post a goods issue, the SAP CRM system sends corresponding confirmations back as IDoc XML documents to Data Hub. Using the IDoc inbound adapter built into the sapidocintegration extension, the raw items for these notifications are extracted from the received XML documents. Again, they are converted to canonical notification items. The publication of these items to SAP Commerce Cloud creates ImpEx files, imported with standard core functionality.

The sapcrmorder Data Hub extension contains the raw, canonical, and target item definitions, the mapping and custom grouping, and composition handlers.

Contents of the sapcrmorder Data Hub Extension

The sapcrmorder Data Hub extension carries out the following tasks: order outbound processing, order cancel outbound processing, and order inbound processing. The following graphic shows the items related to order outbound processing, and how they correspond to each other.

The following graphic shows the items related to order cancel outbound processing, and how they correspond to each other.

The following graphic shows the items related to order inbound processing, and how they correspond to each other.

Raw Items

RawCrmHybrisOrder

This represents an order coming from SAP Commerce Cloud. It contains all subordinate information (order entries, payment, addresses, and so on) as well.

RawCrmOrderCancelRequest

This represents an order cancel record entry coming from SAP Commerce Cloud.

RawCrmORDERS

This represents an SAP CRM sales order, stored in a CRMXIF_ORDER_SAVE_M01 IDoc. The SAP CRM system sends the current status of an order for both creation and cancellation. Also the SAP CRM system sends the current status of a delivery for both creation of the outbound delivery and creation of the corresponding material document for goods issue. This has implications on the inbound processing as the payload, not the raw item type decides which canonical items to create.

Canonical Items

The canonical items in this context are designed to facilitate the mapping between the SAP Commerce Cloud domain model and the SAP CRM domain model. The structure of the canonical items has elements of both models: the overall item structure is close to the SAP Commerce Cloud domain model, but the structure of the price information is optimized for the SAP CRM conditions, which may also come from the SAP Commerce Cloud core system if synchronous pricing is active. There is no separation of B2B and B2C orders.

CanonicalCrmOrder

This represents an order header. In addition to the expected attributes (order ID, currency, and so on) the store name and the channel (B2B or B2C) are also stored. The store name is used during publication, to infer store-specific configuration properties (transaction type, sales area).

CanonicalCrmOrderItem

This represents one item or entry of an order. Like all subordinate objects of an order, the order ID is part of the (compound) key. The entry number is the same as in the SAP Commerce Cloud core system. It also contains the field isCancelRequest. This field determines whether the request is for order creation or cancelation.

Note that although the item level is modeled, the cancelation of single order items is not supported. The order item is modeled since the SAP CRM system requires the cancelation on item level. By specifying all items of the order to be canceled, it is not necessary to perform a lookup of the items assigned to an order in the target item mapping. The encoding of the rejection reason is based on the schema of SAP Commerce Cloud.

CanonicalCrmOrderPriceComponent

This represents a price component (such as price, discount, tax) of the order, either on item level or on header level. The entry numbers correspond to the entry numbers of CanonicalCrmOrderItem. Header price components have the entry number -1. The price component can be identified by the field conditionCode that corresponds to the SAP ERP condition type. The conditionCode values are the same as expected by SAP ERP:
  • With synchronous pricing, the result of the price calls to SAP CRM during checkout is mapped 1:1 to the CanonicalCrmOrderPriceComponents. No key mapping is needed

  • With pricing originating in SAP Commerce Cloud, a dedicated set of price components (item total price, shipping cost on header level, payment cost on header level) is sent. The mapping to the SAP CRM condition types takes place in SAP Commerce Cloud. By default, discounts are extracted from SAP CRM, so no key mapping is needed. For taxes, no general solution is offered.

CanonicalCrmCreditCardPaymentInfo

This represents the payment information for the order, focusing on the payment via payment service provider (PSP). The subscriptionId identifies the payer. With credit card payment via PSP, this is a tokenization of the credit card number. The requestId identifies the individual payment transaction.

CanonicalCrmPartnerRole

This represents a partner role for an order such as sold-to, bill-to, and so on. Each role may have a separate partner attached, and can occur at most once. The encoding of the role (field partnerRoleCode) is already in line with the SAP CRM scheme:
  • 00000001: sold-to
  • 00000003: bill-to
  • 00000002: ship-to
  • 00000015: contact person (B2B only)
  • 00000012: placed by (for ASM)

As an addition to the specification of a partner ID for a partner role, it is also possible to specify a simple address in the field documentAddressId. In the standard shipment, a partnerId is always provided, even for guest user scenarios. This is the store-specific SAP CRM reference customer specified in the SAP Base Store Configuration in Backoffice.

This also represents an order-internal address. The key field documentAddressId corresponds to the field with the same name of a CanonicalCrmPartnerRole.

CanonicalCrmOrderRequest

This represents a request to either create the order or cancel the order in the fulfillment system. The isCancelRequest field is true when it is an order cancel request else it remains NULL.

Only the orderId is needed to specify the request. Only full cancelation is supported in the standard shipment. See also CanonicalCrmOrderItem.

CanonicalCrmOrderCreationNotification

This represents a notification saying that the order has been created successfully in the fulfillment system. No further details are provided on header level.

CanonicalCrmOrderItemCreationNotification

This represents the item level of the notification for successful order creation. The field namedDeliveryDate holds an estimation of when this order item is about to be shipped. Note that only complete deliveries are currently supported.

CanonicalCrmDeliveryCreationNotification

This represents a notification that for the specified order, a delivery document has been created in the fulfillment system. As additional information, the ID of the warehouse is provided, since this is mandatory information for the consignment to be created on the SAP Commerce Cloud core side.

CanonicalCrmGoodsIssueNotification

This represents a notification saying that for the specified order, the goods issue has been posted. As additional information, the ID of the warehouse and the date of the goods issue are provided.

CanonicalCrmOrderCancelNotification

This represents a notification saying that the specified order was canceled in the fulfillment system. The cancelation request may come either from SAP Commerce Cloud or from the fulfillment system (SAP CRM). The encoding of the rejection reason is based on the schema of SAP Commerce Cloud.

CanonicalCrmBillingNotification

This represents a notification saying the invoice for the order has been generated and it contains the field billingDocumentNumber which is replicated to SAP Commerce Cloud and the invoice number gets updated in SAP Commerce Cloud, which can be seen in Backoffice.

Target System HybrisCore

This target system represents SAP Commerce Cloud that sends orders and order cancel requests, and also receives order-related confirmations, B2B customers, SAP CRM materials, and price information. The target items TargetCrmOrderCreationNotification, TargetCrmOrderItemCreationNotification, TargetCrmDeliveryCreationNotification, TargetCrmGoodsIssueNotification, TargetCrmBillingNotification, and TargetCrmOrderCancelNotification are event containers rather than ordinary data containers to be imported via ImpEx.

TargetCrmOrderCreationNotification

The primary purpose of this target item is not to upload information back into SAP Commerce Cloud. Instead, it is just the wrapper for the call of a specific translator (class DataHubOrderCreationTranslator), which triggers subsequent processing on the SAP Commerce Cloud core side (such as firing a business process event for the order fulfillment process; see sapdataexchange extension). This target item is mapped to the SAP Commerce Cloud order, but it does not change the order.

TargetCrmOrderItemCreationNotification

This target item represents a SAP Commerce Cloud OrderEntry, the named delivery date, which is filled from order confirmation.

TargetCrmDeliveryCreationNotification

The primary purpose of this target item is not to upload information back into SAP Commerce Cloud. In particular, it is also not used to directly create an order consignment, which is the SAP Commerce Cloud counterpart of an SAP CRM delivery. Like TargetCrmOrderCreationNotification, it primarily triggers specifically on the SAP Commerce Cloud side (class DataHubDeliveryTranslator with the warehouseId as parameter), which in turn creates the consignment and fires the corresponding business process event. With this approach, non-trivial logic for consignment creation and complex subsequent processing can be reused easily, instead of manually creating the required DB table entries within Data Hub.

TargetCrmGoodsIssueNotification

Same concept as the target item TargetCrmDeliveryCreationNotification. The translator is implemented in class DataHubGoodsIssueTranslator. Note that since the translator does not support a variable number of parameters, it is necessary to encode the parameters for the warehouse ID and the goods issue date into one parameter.

TargetCrmOrderCancelNotification

Same concept as the target item TargetCrmDeliveryCreationNotification. The translator is implemented in class DataHubOrderCancelTranslator. The rejection reason calculated via a custom Spring expression is used as a parameter for the translator. On the SAP Commerce Cloud side, the corresponding subsequent steps for cancel processing are triggered, depending on the status of the cancelation.

TargetCrmBillingNotification

The primary purpose of this target item is just to upload information regarding invoice generation. The invoice document, when generated in SAP CRM sends the invoice number (attribute name billingDocumentNumber in target item) which is triggered on the SAP Commerce Cloud core side (by DataHubInvoiceTranslator, with the Invoice Number) which in turn saves the Invoice Number in the respective order on the SAP Commerce Cloud side.

Target System SapCrmSystem

This target system represents the SAP CRM system that receives sales orders and order cancelation requests, as well as consumers created in SAP Commerce Cloud (see sapcrmcustomer extension).

CRMXIF_ORDER_SAVE_M01$...

All target items starting with the prefix CRMXIF_ORDER_SAVE_M01$ belong to the same IDoc type CRMXIF_ORDER_SAVE_M01. This IDoc is used to create a sales order on the SAP CRM side. In the following text, this prefix will be omitted in the section headings. All currency and unit codes are expected to be ISO codes.

All target items sharing this prefix have the field OBJECT_ID in common, which is used to determine the correct IDoc instance for a given target item instance. See exportCode element:

<exportCode>idockeyfield=OBJECT_ID</exportCode>

EDI_DC40

IDoc control header. In addition to the default mapping provided by the IDoc outbound adapter, only the message type is filled. Message type is expected in Java property sapcrmorder.ordermessagetype.

E101CRMXIF_BUSTRANS

Full name is CRMXIF_ORDER_SAVE_M01$E101CRMXIF_BUSTRANS. Root segment for the sales order. Contains the order ID, Object Task, Process Type and Object Type. All following segments are child segments of this. The prefix (CRMXIF_ORDER_SAVE_M01$) E101CRMXIF_BUSTRANS) will be omitted in the section headings of the child segments.

...$E101CRMXIF_PARTNER_XT

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_PARTNER_XT. Represents the partner header. Since it is a header whose child segment contains the information regarding different partner roles, it contains only the Order Id and the DATAX (whose value is X). Only those segments are taken into account for the inbound processing for which the DATAX flag is set (for example, E101CRMXIF_SALES_X-DATAX = 'X').

...$E101CRMXIF_PARTNER

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_PARTNER_XT$ E101CRMXIF_PARTNER. Contains all the information for different partners i.e. the partner functions, partner role codes (sold to party, ship to party, bill to party) etc. Represents the partner definition for a sales order. Since an order has several partners with different roles, the partner role (field PARTNER_FCT) is defined as a segment key.

…$E101CRMXIF_PARTNER_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_PARTNER_XT$E101CRMXIF_PARTNER$ E101CRMXIF_PARTNER_F. Child segment of E101CRMXIF_PARTNER. This segment contains fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E102CRMXIF_ADDRESS

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_PARTNER_XT$ E101CRMXIF_PARTNER$E102CRMXIF_ADDRESS. Corresponds to document address of the partner. Because of the to 0..1 relation between the partner and document address, no segment key has to be defined.

...$E104CRMXIF_ADDRESS

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_PARTNER_XT$ E101CRMXIF_PARTNER$E102CRMXIF_ADDRESS$E104CRMXIF_ADDRESS. Corresponds to the additional information for a document address. Because of the to 0..1 relation between document address and document address additional information, no segment key has to be defined.

...$E102CRMXIF_ADDRESS_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_PARTNER_XT$E101CRMXIF_PARTNER$ E102CRMXIF_ADDRESS$E104CRMXIF_ADDRESS$ E102CRMXIF_ADDRESS_F. Child segment of E102CRMXIF_ADDRESS. This segment contains fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

In this address replication, we do not replicate the sold to party address, and a check is done to verify that sold to party address fields are not replicated. In SAP CRM itself, it picks and shows the address from the master data for sold to party.

...$E101CRMXIF_ORGMAN_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_ORGMAN_X. Represents the segment for sales organization related information. It is the Header segment for sales organization related information, contains the order Id.

...$E101CRMXIF_ORGMAN

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_ORGMAN_X$E101CRMXIF_ORGMAN. This segment contains all the information related to the sales area such as Sales Organization, Distribution Channel, Division and Sales Org Responsible etc.

...$E101CRMXIF_SCHEDLIN_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_ORGMAN_X$E101CRMXIF_ORGMAN$E101CRMXIF_ORGMAN_F. Child segment of E101CRMXIF_ORGMAN. This segment contains fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E101CRMXIF_PRICING_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_PRICING_X. Represents the segment for pricing related information (currency only). It is the Header segment for pricing related information, contains the order ID.

...$E101CRMXIF_PRICING

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_PRICING_X$ E101CRMXIF_PRICING. This segment is used for passing the currency information. It just contains one field apart from order ID i.e. CURRENCY.

...$E101CRMXIF_PRICING_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_PRICING_X$ E101CRMXIF_PRICING$ E101CRMXIF_PRICING_F. Child segment of E101CRMXIF_PRICING. This segment contains fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E101CRMXIF_PAYPLAN_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_PAYPLAN_ X. Represents the segment for payment related information. It is the Header segment for payment related information, contains the order ID.

...$E101CRMXIF_PAYPLAN

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_ PAYPLAN _X$ E101CRMXIF_ PAYPLAN. Child Segment of E101CRMXIF_PAYPLAN_X, and it stores the payplan type.

...$E101CRMXIF_PAYPLAN_D

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_ PAYPLAN _X$ E101CRMXIF_ PAYPLAN$ E101CRMXIF_ PAYPLAN_D. Represents credit card payment information for the order. On the SAP CRM side, payment via payment service provider is treated as payment using a special credit card. Therefore, the credit card number is fed from the subscriptionID of the canonical item CanonicalCrmCreditCardPaymentInfo. Due to data model incompatibilities and length restrictions, the request ID of the payment transaction must be mapped to the authorization reference number (field AUTH_REF) in an encoded format. Using Base32 encoding (BigInteger.toString(32)), the numeric field with a length of 16 or 22 digits is converted to an alphanumeric string with a maximum length of 15 characters. Although currently not supported within the integration scenario, the data model of the IDoc allows several credit card payment transactions. Therefore, the field AUTH_REF is defined as a segment key.

...$E101CRMXIF_SHIPPING_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_SHIPPING_ X. Represents the segment for shipping information. It is the Header segment for shipping related information, contains the order ID.

...$E101CRMXIF_SHIPPING

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_SHIPPING_ X$ E101CRMXIF_SHIPPING. By shipping condition here we mean the delivery mode. This segment is used for passing delivery mode information.

...$E101CRMXIF_SHIPPING_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$ E101CRMXIF_SHIPPING_ X$ E101CRMXIF_SHIPPING$ E101CRMXIF_ SHIPPING_F. This segment contains fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E101CRMXIF_SALES_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$E101CRMXIF_SALES_X. Represents the segment for sales information at header level and it contains the order ID.

...$E101CRMXIF_SALES

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$E101CRMXIF_SALES_X$E101CRMXIF_SALES. This segment is used for passing requested delivery date for the order.

...$E101CRMXIF_SALES_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$E101CRMXIF_SALES_X$E101CRMXIF_SALES$E101CRMXIF_SALES_F. This segment contains fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’, otherwise their values will not be accepted in SAP CRM.

...$E101CRMXIF_BILLING_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$E101CRMXIF_BILLING_X. Represents the segment for business agreement related information at header level and it contains the order ID.

...$ E101CRMXIF_BILLING

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$E101CRMXIF_BILLING_X$E101CRMXIF_BILLING. This segment is used for passing business agreement ID (if any ID is sent from SAP Commerce Cloud, else blank) for the order.

...$ E101CRMXIF_BILLING _F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS$E101CRMXIF_BILLING_X$E101CRMXIF_BILLING$E101CRMXIF_BILLING_F. This segment contains fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’, otherwise their values will not be accepted in SAP CRM.

..$E101CRMXIF_BUSTRANS_ITEM

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_BUSTRANS_ITEM. Represents a sales order item. Note that both the internal and external item numbers are set: Both item numbers are set to the SAP Commerce Cloud order entry number plus 1, since the SAP CRM order does not support item numbers starting with 0. Note that since there is a to-n cardinality from the sales order root segment to the sales order item segment, the item number (field ITM_NUMBER) is defined as the segment key:
<attribute>
    <name>ITEM_NUMBER</name>
    <localizable>false</localizable>
    <collection>false</collection>
    <transformationExpression>convertOrderEntryNumber(entryNumber,orderId)</transformationExpression>
    <exportCode>keyfield=true</exportCode> <!-- Key -->
    <mandatoryInHeader>true</mandatoryInHeader>
</attribute>

Represents the schedule line for a sales order item. The quantities are set on schedule line level. The same mapping of the order item number is carried out as for the order item. Only one schedule line is created per sales order item. For the sales order item, the field ITEM_NUMBER is defined as a segment key. This needs to be adjusted if several schedule lines are created per item.

...$E101CRMXIF_PRCD_COND_XT

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_PRCD_COND_XT. Represents the pricing condition segment. Header segment for pricing conditions, contains the order ID and Item number.

...$E101CRMXIF_BT_PRCD_COND

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_PRCD_COND_XT$ E101CRMXIF_BT_PRCD_COND. Represents the sales condition for the order. The same mapping of the order item number is carried out as for the order item. Note that for header conditions indicated by the value -1 for the entryNumber attribute of the canonical item, this leads to the correct value 0 for an SAP ERP header condition record. Additionally, specific to SAP CRM, the attribute condition count is filled only for header conditions, not for item conditions. The segment key is defined as COND_TYPE.

...$E101CRMXIF_BT_PRCD_COND_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_PRCD_COND_XT$ E101CRMXIF_BT_PRCD_COND$ E101CRMXIF_BT_PRCD_COND_F. Child segment of E101CRMXIF_BT_PRCD_COND. This segment contains the fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E101CRMXIF_PRODUCT_I_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_PRODUCT_I_X. Represents the segment for product related information. Header segment for product related information, contains the order ID and Item number.

...$E101CRMXIF_PRODUCT_I

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_PRODUCT_I_X $E101CRMXIF_PRODUCT_I. Represents the segment contain product information, specifically the product unit and product unit iso. Since, this segment is at item level so no segment key required for this segment.

...$E101CRMXIF_SCHEDLIN_I_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_I_X. Corresponds to schedule lines information at item level. This is the header segment for schedule lines at item level. Contains the order ID and Item number

...$E101CRMXIF_SCHEDLIN_I

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_I_X$E101CRMXIF_SCHEDLIN_I. Main segment containing schedule line information at item level. This segment is used for storing the quantity of the particular item ordered. No segment key required as it is used for storing just the quantity at item level.

...$E101CRMXIF_SCHEDLIN_I_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_I_X$E101CRMXIF_SCHEDLIN_I$E101CRMXIF_SCHEDLIN_I_F. Child segment of E101CRMXIF_SCHEDLIN_I. This segment contains the fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E101CRMXIF_SCHEDLIN_ XT

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_XT. Also corresponds to schedule lines information at item level. This is the header segment for schedule lines at item level. Contains the order ID and Item number. This segment is used for storing the schedule line numbers, as an item with multiple quantity can be assigned multiple schedule lines having their respective schedule line numbers.

...$E101CRMXIF_SCHEDLIN

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_XT $E101CRMXIF_SCHEDLIN. Main segment containing schedule line information at item level. As it is used for storing the different schedule lines, the schedule line number is made the segment key.

...$E101CRMXIF_SCHEDLIN_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_XT $E101CRMXIF_SCHEDLIN$E101CRMXIF_SCHEDLIN_F. Child segment of E101CRMXIF_SCHEDLIN. This segment contains the fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E101CRMXIF_SCHEDLIN_ XT

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_XT. Also corresponds to schedule lines information at item level. This is the header segment for schedule lines at item level. Contains the order ID and Item number. This segment is used for storing the schedule line numbers, as an item with multiple quantity can be assigned multiple schedule lines having their respective schedule line numbers.

...$E101CRMXIF_SCHEDLIN

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_XT $E101CRMXIF_SCHEDLIN. Main segment containing schedule line information at item level. As it is used for storing the different schedule lines, the schedule line number is made the segment key.

...$E101CRMXIF_SCHEDLIN_F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E101CRMXIF_SCHEDLIN_XT $E101CRMXIF_SCHEDLIN$E101CRMXIF_SCHEDLIN_F. Child segment of E101CRMXIF_SCHEDLIN. This segment contains the fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

...$E102CRMXIF_SALES_X

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E102CRMXIF_SALES_X. Corresponds to header segment for sales related information at item level. Contains the order ID and Item number.

...$E102CRMXIF_SALES

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E102CRMXIF_SALES_X$E102CRMXIF_SALES. Main segment containing sales information at item level. The only use of this segment is for passing rejection reason. The rejection reason is determined by a custom Spring expression.

...$E102CRMXIF_ SALES _F

Full name is CRMXIF_ORDER_SAVE_M01$ E101CRMXIF_BUSTRANS $ E101CRMXIF_BUSTRANS_ITEM$E102CRMXIF_SALES_X$E102CRMXIF_SALES$E102CRMXIF_SALES_F. Child segment of E102CRMXIF_SALES. This segment contains the fields with flag values. All the fields which are present in its parent segment should be marked with the flag value ‘X’ otherwise their values will not be accepted in SAP CRM.

Provided Spring Beans

Name

Alias

Description

sapcrmDefaultCRMXIFOrderSaveM01ClassProvider

sapCRMXIFOrderSaveM01ClassProvider

IDoc class provider for IDoc type CRMXIF_ORDER_SAVE_M01

sapCrmDefaultShippingConditionMethodResolver

sapCrmShippingConditionMethodResolver

Method resolver for custom SpEL expression "sapCrmShippingCondition()"

sapCrmDefaultShippingConditionLookup

sapCrmShippingConditionLookup

Method executor for custom SpEL expression "sapCrmShippingCondition()"

sapcrmDefaultCCardValidToConverterMethodResolver sapcrmDefaultCCardValidToConverterMethodResolver

sapcrmCCardValidToConverterMethodResolver

Method resolver for custom SpEL expression "convertValidToDate()"

sapcrmDefaultValidToDateConverter

sapcrmValidToDateConverter

Method executor for custom SpEL expression "convertValidToDate()"

sapcrmDefaultJavaToAbapDateConverterMethodResolver

sapcrmJavaToAbapDateConverterMethodResolver

Method resolver for custom SpEL expression "abapDate()"

sapDefaultJavaToAbapDateConverter

sapJavaToAbapDateConverter

Method resolver for custom SpEL expression "abapDate()"

sapcrmDefaultOrderEntryConverterMethodResolver

sapcrmOrderEntryConverterMethodResolver

Method resolver for custom SpEL expression "convertCrmOrderEntryNumber(entryNumber)" - not used any more!

sapcrmDefaultOrderEntryForOrderConverterMethodResolver

sapcrmOrderEntryForOrderConverterMethodResolver

Method resolver for custom SpEL expression "convertCrmOrderEntryNumber(entryNumber, orderId)"

sapDefaultOrderEntryNumberConverter

sapOrderEntryNumberConverter

Method resolver for custom SpEL expression "convertCrmOrderEntryNumber(entryNumber, orderId)"

sapcrmDefaultAbstractGroupingHandler

sapcrmAbstractGroupingHandler

Abstract parent bean for order-related grouping handlers

sapDefaultCrmFilterGroupingHandlerOrderNotification

sapCrmFilterGroupingHandlerOrderNotification

Decide canonical creation for the order creation notification, delivery notification, good issue notification, invoice notification Idoc

sapcrmRawHybrisOrderCanonicalOrderItemKeys

Grouping handler that filters out canonical items with incomplete keys - applicable for Canonical Order item entries

sapcrmRawHybrisOrderCanonicalPartnerRoleKeys

Grouping handler that filters out canonical items with incomplete keys - applicable for Canonical Partner entries

sapcrmRawHybrisOrderCanonicalPartnerRoleKeys

Grouping handler that filters out canonical items with incomplete keys - applicable for Canonical Partner entries

sapcrmRawHybrisOrderCanonicalOrderPriceComponentKeys

Grouping handler that filters out canonical items with incomplete keys - applicable for Canonical Order Price entries

sapcrmRawHybrisOrderCanonicalCreditCardPaymentInfoKeys

Grouping handler that filters out canonical items with incomplete keys - applicable for Canonical Credit Card Payment Info entries

sapRawCrmORDERSCanonicalCrmDeliveryCreationNotification

Grouping handler that filters out canonical items with incomplete keys - applicable for CanonicalCrmDeliveryCreation Notification entries

sapRawCrmORDERSCanonicalCrmGoodsIssueNotification

Grouping handler that filters out canonical items with incomplete keys - applicable for CanonicalCrmGoodIssueNotification entries

sapRawCrmORDERSCanonicalCrmBillingNotification

Grouping handler that filters out canonical items with incomplete keys - applicable for CanonicalCrmBillingNotification entries

sapcrmDefaultAbstractOrderCompositionHandler

sapcrmAbstractOrderCompositionHandler

Abstract parent bean for order-related composition handlers

sapDefaultCompositionHandlerOrderItemNotification

sapcrmCompositionHandlerOrderItemNotification

Composition handler to determine and set the entry number and the latest delivery date

sapdefaultCrmCompositionHandlerOrderCancelNotification

sapCrmCompositionHandlerOrderCancelNotification

Composition handler to determine and set the rejection reason

defaultSapCrmOrderItemNumberConverter

sapcrmOrderItemNumberConverterNotification

Converter from CRM to SAP Commerce Cloud core order entry/item number. Same class instance for both Spring bean aliases

sapcrmorderORDERSMappingService

sapcrmOrderItemNumberConverterUpdation

Set default values for sapcrmorder and interchange the partner information from one raw in the row which has warehouse information.

Grouping Handlers

The following custom grouping handlers have been introduced by the sapcrmorder Data Hub extension:

  • sapCrmFilterGroupingHandlerOrderNotification: Grouping handler for RawCrmORDERS instances. The purpose of this grouping handler is to determine the notifications coming from SAP CRM. Since the IDoc type is same for all scenarios, which is (CRMXIF_OREDR_SAVE_M01) to decide whether the notification is of order creation, order cancellation, delivery, goods issue or billing. So, on the basis of the field values of the IDoc, this grouping handler determines which scenario should be executed, that is, it stops the creation of irrelevant Canonical Items and allows only the valid Canonical Item to be created and sent forward for publication.
  • sapDefaultCrmShippingCostFilterGroupingHandler: Grouping handler for RawCrmHybrisOrder instances. The purpose of this handler is to remove the segments corresponding to pricing condition types for which the value is 0 i.e. if shipping cost, pricing conditions etc., are coming with condition value as 0, then their corresponding segments will be removed from the IDoc.

All custom grouping handlers have the execution order value 100, ensuring that the built-in grouping handlers of Data Hub are executed first.

Composition Handlers

The inbound flow requires the following custom composition handler:
  • DefaultCompositionHandlerOrderItemNotification: Composition handler for RawCrmORDERS instances.
    1. Maps the SAP ERP order item number from the notification IDoc to the canonical order entry number, that is, the number is decreased by 1.
    2. Extracts the latest (!) delivery date of the schedule line for an order item, and copies it up to the order item level of the canonical item CanonicalCrmOrderItemCreationNotification. Note that partial deliveries are not supported.

Custom Spring Expressions for Publication

crmAbapDate

Converts a Java date stored as a String into the ABAP date format. The format pattern of the Java date representation can be freely defined by injecting into the corresponding Spring bean. By default, the pattern "yyyy-MM-dd HH:mm:ss" is used.

Corresponding Spring bean for the method executor: sapcrmJavaToAbapDateConverter.

convertCrmOrderEntryNumber

Converts a SAP Commerce Cloud order entry into an SAP ERP order item number. The entry number is increased by 1, since SAP ERP order items may not start with 0 as in SAP Commerce Cloud. Note that two syntaxes are offered: convertOrderEntryNumber(entryNumber) and convertOrderEntryNumber(entryNumber, orderId). The syntax with one parameter is not used any more and only exists for compatibility reasons. The parameter orderId has been added to support more sophisticated conversion implemented in the sapproductconfiguration Data Hub extension.

Corresponding Spring bean for the method executor: sapcrmOrderEntryNumberConverter

sapCrmShippingCondition

Converts the SAP Commerce Cloud delivery mode code into the corresponding SAP shipping condition. This is done via the following lookup: Store name of order (expression parameter) --> Read configuration key from canonical item SAPBaseStoreConfigurationMapping (pool name: expression parameter) --> Read canonical item DeliveryModeMapping via composite key deliveryMode (expression parameter) + store configuration Key --> Return attribute sapCrmShippingCondition.

Corresponding Spring bean for the method executor: sapCrmShippingConditionLookup

convertValidToDate

Converts the combination of a year and month to the last day of the month. Needed to set the validity date of a credit card within the payment segment.

Corresponding Spring bean for the method executor: sapcrmValidToDateConverter

Configuration of the sapcrmorder Data Hub Extension

The configuration of the sapcrmorder Data Hub extension is carried out in Data Hub WEB-INF/classes directory in the local.properties file. In addition to the Java properties of the sapidocoutboundadapter Data Hub extension, the following properties are relevant:

Name

Description

Default Value

Comment

sapcrmorder.ordermessagetype

IDoc message type for sales order creation in SAP CRM

CRMXIF_ORDER_SAVE_M

Filled in IDoc control header

saporder.inboundfeed

Feed for order-related inbound messages, that is, messages to be imported into SAP Commerce Cloud

SAPORDER_INBOUND_FEED

Injected as a bean property

saporder.outboundpool

Pool for order-related outbound messages, that is, messages to be sent to SAP ERP

SAPORDER_OUTBOUND_POOL

Injected as a bean property. Needed by sapproductconfiguration Data Hub extension.

sapcoreconfiguration.pool

Data Hub pool that holds the SAP-specific configuration

Needed to look up details such as sales area. Proposed value: SAPCONFIGURATION_POOL

sapcoreconfiguration.autocompose. pools

Comma-separated list of Data Hub pools for which automatic composition should take place

When using the default feeds and pools, the list should contain the following entries: SAPORDER_OUTBOUND_POOL,SAPORDER_INBOUND_POOL, ...

sapcoreconfiguration.autopublish. targetsystemsbypools

Comma-separated list of pool - target system combinations for which automatic publication should take place

When using the default feeds and pools, the list should contain the following entries: SAPORDER_OUTBOUND_POOL.SapErpSystem,SAPORDER_INBOUND_POOL.HybrisCore, ..., ...

targetsystem.hybriscore.url

URL for SAP Commerce Cloud

Used for impex upload, for example http://localhost:9001/datahubadapter

targetsystem.hybriscore.username

User name for SAP Commerce Cloud

Use admin user and associated password

targetsystem.hybriscore.password

Password for SAP Commerce Cloud

Use admin user and associated password

targetsystem.saperp.url

URL for IDoc xml service of SAP ERP

Only used as fallback if HTTP Destination could not be found, for example https://<erpsystem>:<port>/sap/bc/idoc_xml?sap-client=<client>

targetsystem.saperp.username

User name for IDoc xml service of SAP ERP

Only used as fallback if HTTP Destination could not be found.

targetsystem.saperp.password

Password for IDoc xml service of SAP ERP

Only used as fallback if HTTP Destination could not be found.

targetsystem.saperp.receivername

Receiver partner name of SAP ERP

Only used as fallback if SAP Global Configuration could not be found. Filled in IDoc control header.

An example local.poperties file that supports the order transfer can be found in

Feeds and Pools

The sapcrmorder Data Hub extension comes with the following feeds and pools. They are created automatically if they do not exist, during server startup.

ID

Feed Name

Pool Name

Description

9305

SAPORDER_INBOUND_FEED

SAPORDER_INBOUND_POOL

Feed for SAP order replication from SAP CRM to SAP Commerce Cloud core

9306

SAPORDER_OUTBOUND_FEED

SAPORDER_OUTBOUND_POOL

Feed for SAP order replication from SAP Commerce Cloud to SAP CRM

10305

TEST_SAPORDER_INBOUND_FEED

TEST_SAPORDER_INBOUND_POOL

Feed for testing of SAP order replication from SAP CRM to SAP Commerce Cloud

10306

TEST_SAPORDER_OUTBOUND_FEED

TEST_SAPORDER_OUTBOUND_POOL

Feed for testing of SAP order replication from SAP Commerce Cloud core to SAP CRM

The inbound feeds are used in instances of the class IDocMappingService for parsing IDoc XMLs that come from the SAP CRM system:
  • sapcrmorderORDERSMappingService

The outbound feeds are relevant for raw items received from SAP Commerce Cloud. The outbound feed to be used for uploading order-related raw items is specified within the SAP Commerce Cloud extension sapcrmorderchange using the Java property saporderexchange.orderoutbound.datahub.feed (see sapcrmorderexchange extension).