SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

13
1 ©2021 SAP SE. All rights reserved. SAP Cloud Integration – Integration Flow SAP IDoc to cXML - Outbound

Transcript of SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

Page 1: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

1©2021 SAP SE. All rights reserved.

SAP Cloud Integration –Integration Flow SAP IDoc to cXML -Outbound

Page 2: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

SAP Cloud Integration – Integration Flow Documentation Template

Table of Contents1. Introduction ................................................................................................................................3

2. Usage Policy and Copyright Statement: cXML and SAP SE ............................................................3

3. Integration Flow ..........................................................................................................................4

3.1. Basic Concepts ........................................................................................................................4

3.2. Sender Channel .......................................................................................................................4

3.3. Start Event ..............................................................................................................................4

3.4. Read SAP IDoc EDI_DC40 Parameters ......................................................................................5

Content Modifier ............................................................................................................................5

3.5. IDOC Pre-Processing ................................................................................................................6

XSLT Mapping .................................................................................................................................6

3.6. IDoc to cXML Mapping ............................................................................................................6

XSLT Mapping .................................................................................................................................6

3.7. cXML Extended Validation (optional) .......................................................................................6

XML Validator .................................................................................................................................6

3.8. cXML Qualifier Post-processing ...............................................................................................7

XSLT Mapping .................................................................................................................................7

3.9. Envelope Handling...................................................................................................................8

3.9.1. cXML protocol specification in a nutshell .....................................................................8

3.9.2. Tab “Message Header” (variable ExtractedMessage).................................................. 10

3.9.3. Tab “Exchange Property”: Defines cXML Header Elements and Attributes and theirvalues 10

3.9.4. Tab “Message Body”: Combine variable ExtractedMessage with header elements andattributes to the final cXML Message ........................................................................................ 13

3.10. End Event .......................................................................................................................... 13

3.11. Receiver Channel ............................................................................................................... 13

Page 3: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

3©2021 SAP SE. All rights reserved.

1. IntroductionThe SAP BTP includes the SAP Cloud Integration, which offers diverse approaches to connect your ITsystems with other cloud or on premise system landscapes. This makes cloud integration simple andreliable.It provides out-of-the-box connectivity across cloud and on-premise solutions. Since the SAP CloudIntegration is operated by SAP, you don't need to worry about basic activities. Additionally, SAP isoffering prepackaged integration content as reference templates, allowing customers to quickly realizenew business scenarios. This drastically reduces integration project lead times and lowers resourceconsumption significantly.This document gives an overview about the outbound IDOC to cXML template flow of SAP CloudIntegration in combination with SAP Integration Advisor (IA). It explains how exported runtimeartefacts from SAP IA can be imported into the flow and how the flow can be configured.

We assume the reader is an integration developer and is familiar with SAP Cloud Integration.

2. Usage Policy and Copyright Statement: cXML and SAP SEcXML Usage Policy Agreement

Licensor may publish new versions (including revisions) of the usage policy from time to time on thecXML site (www.cxml.org).

Copyright Statement for XML Schema Representation generated by SAP SE:

©2021 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may bereproduced or transmitted in any form or for any purpose without the express permission of SAP SEor an SAP affiliate company. SAP and other SAP products and services mentioned herein as well astheir respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliatecompany) in Germany and other countries. All other product and service names mentioned are thetrademarks of their respective companies. Please see http://www.sap.com/corporate-en/about/legal/copyright/index.html for additional trademark information and notices.

Page 4: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

4©2021 SAP SE. All rights reserved.

3. Integration FlowIntegration Flow

Name SAP IDoc to cXML - Outbound

Description SAP IDoc to cXML - Outbound Template

3.1. Basic ConceptsWith the SAP Integration Advisor one can create MIG (message implementation guidelines) and MAG(mapping guidelines). These can be exported as SAP Cloud Integration runtime artifacts (zip filecontaining *xslt and *xsd files). The flow templates contain steps serving as containers for theexported runtime artifacts (where the runtime artifacts can be imported into). E.g. the runtimeartifacts exported from the MIG and MAG of the SAP Integration Advisor can be used as follows:schemas (xsd) can be used in EDI Splitter, EDI to XML Converter, XML to EDI Converter, XML Validator(extended validation) ; stylesheet transformations (xslt files) in XSLT Mapping.

Furthermore, it is necessary to define and customize the communication adapters as well as therequired information of the interchange envelope and header structures (e.g. in the contentmodifier).

3.2. Sender ChannelSender channel is configured by the customer. In case of IDoc outbound scenario, an IDoc SOAPadapter should be used.

3.3. Start EventThe Start Message event is triggered by the sending system.

Page 5: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

5©2021 SAP SE. All rights reserved.

3.4. Read SAP IDoc EDI_DC40 ParametersContent Modifier

Content Modifier Description: From the source IDoc, EDI_DC40 parameters are extracted.

Message Header

Action Name Type Data Type Value Default

Create SAP_IDoc_EDIDC_TABNAM XPath java.lang.String //EDI_DC40/TABNAM

Create SAP_IDoc_EDIDC_MANDT XPath java.lang.String //EDI_DC40/MANDT

Create SAP_IDoc_EDIDC_DOCNUM XPath java.lang.String //EDI_DC40/DOCNUM

Create SAP_IDoc_EDIDC_DOCREL XPath java.lang.String //EDI_DC40/DOCREL

Create SAP_IDoc_EDIDC_STATUS XPath java.lang.String //EDI_DC40/STATUS

Create SAP_IDoc_EDIDC_DIRECT XPath java.lang.String //EDI_DC40/DIRECT

Create SAP_IDoc_EDIDC_OUTMOD XPath java.lang.String //EDI_DC40/OUTMOD

Create SAP_IDoc_EDIDC_EXPRSS XPath java.lang.String //EDI_DC40/EXPRSS

Create SAP_IDoc_EDIDC_TEST XPath java.lang.String //EDI_DC40/TEST

Create SAP_IDoc_EDIDC_IDOCTYP XPath java.lang.String //EDI_DC40/IDOCTYP

Create SAP_IDoc_EDIDC_CIMTYP XPath java.lang.String //EDI_DC40/CIMTYP

Create SAP_IDoc_EDIDC_MESTYP XPath java.lang.String //EDI_DC40/MESTYP

Create SAP_IDoc_EDIDC_MESCOD XPath java.lang.String //EDI_DC40/MESCOD

Create SAP_IDoc_EDIDC_MESFCT XPath java.lang.String //EDI_DC40/MESFCT

Create SAP_IDoc_EDIDC_STD XPath java.lang.String //EDI_DC40/STD

Create SAP_IDoc_EDIDC_STDVRS XPath java.lang.String //EDI_DC40/STDVRS

Create SAP_IDoc_EDIDC_STDMES XPath java.lang.String //EDI_DC40/STDMES

Create SAP_IDoc_EDIDC_SNDPOR XPath java.lang.String //EDI_DC40/SNDPOR

Create SAP_IDoc_EDIDC_SNDPRT XPath java.lang.String //EDI_DC40/SNDPRT

Create SAP_IDoc_EDIDC_SNDPFC XPath java.lang.String //EDI_DC40/SNDPFC

Create SAP_IDoc_EDIDC_SNDPRN XPath java.lang.String //EDI_DC40/SNDPRN

Create SAP_IDoc_EDIDC_SNDSAD XPath java.lang.String //EDI_DC40/SNDSAD

Create SAP_IDoc_EDIDC_SNDLAD XPath java.lang.String //EDI_DC40/SNDLAD

Create SAP_IDoc_EDIDC_RCVPOR XPath java.lang.String //EDI_DC40/RCVPOR

Create SAP_IDoc_EDIDC_RCVPRT XPath java.lang.String //EDI_DC40/RCVPRT

Create SAP_IDoc_EDIDC_RCVPFC XPath java.lang.String //EDI_DC40/RCVPFC

Create SAP_IDoc_EDIDC_RCVPRN XPath java.lang.String //EDI_DC40/RCVPRN

Create SAP_IDoc_EDIDC_RCVSAD XPath java.lang.String //EDI_DC40/RCVSAD

Create SAP_IDoc_EDIDC_RCVLAD XPath java.lang.String //EDI_DC40/RCVLAD

Create SAP_IDoc_EDIDC_CREDAT XPath java.lang.String //EDI_DC40/CREDAT

Page 6: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

6©2021 SAP SE. All rights reserved.

Create SAP_IDoc_EDIDC_CRETIM XPath java.lang.String //EDI_DC40/CRETIM

Create SAP_IDoc_EDIDC_REFINT XPath java.lang.String //EDI_DC40/REFINT

Create SAP_IDoc_EDIDC_REFGRP XPath java.lang.String //EDI_DC40/REFGRP

Create SAP_IDoc_EDIDC_REFMES XPath java.lang.String //EDI_DC40/REFMES

Create SAP_IDoc_EDIDC_ARCKEY XPath java.lang.String //EDI_DC40/ARCKEY

Create SAP_IDoc_EDIDC_SERIAL XPath java.lang.String //EDI_DC40/SERIAL

3.5. IDOC Pre-ProcessingXSLT Mapping

Mapping In this step, the IDoc is preprocessed via an XSLT mapping.

Name <SourceMIGName>__preproc.xsl

Resource Runtime artefact from SAP IA. Located in the MIG source folder within the exported zipfile.

Type XSLT Mapping

Output Format XML

3.6. IDoc to cXML MappingXSLT Mapping

Mapping Mapping step where the IDoc message is transformed into the cXML message viaXSLT.

Name <MAGName>.xsl

Resource Runtime artefact from SAP IA. Located at the root folder of the exported zip file.

Type XSLT Mapping

Output Format XML

3.7. cXML Extended Validation (optional)XML Validator

Mapping XML Validation step where the result of the XSLT mapping is validated againstthe cXML extended validation XSD. Supports XSD 1.1 version.

Name <TargetMIGName>__RD.xsd

Resource Runtime artefact from SAP IA. Located in the MIG target folder within the exported zip file.

Type XSLT Mapping

Output Format XML

If you don’t want to execute validation of the message, simply remove this flow step from yourintegration flow.

Page 7: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

7©2021 SAP SE. All rights reserved.

3.8. cXML Qualifier Post-processingXSLT Mapping

Mapping The qualifiers within the target cXML message are removed via an XSLT mapping.

Name <TargetMIGName>__postproc.xsl

Resource Runtime artefact from SAP IA. Located in the MIG target folder within the exported zipfile.

Type XSLT Mapping

Output Format XML

Page 8: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

8©2021 SAP SE. All rights reserved.

3.9. Envelope HandlingcXML requires an envelope/header around the actual messages (see 3.9.1. for details). This flow stepcreates this envelope and fills it with data. The flow step consists of three sub-steps:

- Storing the structure generated by the previous flow step (qualifier postprocessing) usingxpath in the header variable ExtractedMessage (see 3.9.2. for details)

- Define cXML header elements, attributes and their values in the tab “Exchange Property”(see 3.9.3. for details)

- Combine the header variable ExtractedMessage with cXML header elements and attributesto the final cXML Message (see 3.9.4. for details).

3.9.1. cXML protocol specification in a nutshellPlease note that the cXML Users Guide remains the definitive reference related to cXML. Thisparagraph gives only a concise description. Structure of a cXML document (contains a header and thetransaction information to be passed (Request, Message or Response)):

Page 9: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

9©2021 SAP SE. All rights reserved.

The header variable ExtractedMessage contains the transaction type message (Request or Message),reference is cXML reference guide, chapter 2 .

<Header></Header><${property.cXMLTransaction} deploymentMode="${property.deploymentMode}">${header.ExtractedMessage}</${property.cXMLTransaction></cXML>

Where ${property.cXMLTransaction}=Request or Message .

Page 10: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

10©2021 SAP SE. All rights reserved.

3.9.2. Tab “Message Header” (variable ExtractedMessage)The goal of this sub-step is to extract the cXML message (as produced by the previous flow stepqualifier post-processing -using xpath) and temporarily store it in the header variableExtractedMessage. In the sub-step 3.9.4. it will be used to create the final cXML message.

To achieve this, please set the correct value for the XPath variable in the following format:

/* (message independent xpath, preferred method)

or //<TargetMessageTypeName> (message dependent xpath)

An example value is provided here:

Content Modifier

Message Header (example)

Action Name Type Data Type Value Default

Create ExtractedMessage XPath org.w3c.dom.NodeList /* Example for messagedependent xpath:

//InvoiceDetailRequest

3.9.3. Tab “Exchange Property”: Defines cXML Header Elements and Attributes andtheir values

The goal of this sub-step is to define all the cXML header elements and attributes you wish to useand assign a value to them. Note that all required elements and attributes as well as some frequentlyused optional ones are predefined for you as part of the template. If you need additional ones,please add them to the tab “Exchange Property”.

Moreover, you need to assign appropriate values to all the cXML header elements and attributes youwish to use. Some of them have already suggested values assigned to them – verify if they suit yourrequirements.

Following table lists the variables from tab “Exchange Property”.

Content Modifier

Exchange Property (example)

Action Name Type DataType

Value Remark

Create cXMLtimestampSec Expression ${date:now:ss}

Create cXMLtimestampMin Expression ${date:now:mm}

Create cXMLtimestampHour Expression ${date:now:HH}

Create cXMLtimestampDay Expression ${date:now:dd}

Create cXMLtimestampMonth Expression ${date:now:MM}

Create cXMLtimestampYear Expression ${date:now:yyyy}

Create OriginalDocument Constant

Create OriginalDocumentpayloadID Constant

Page 11: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

11©2021 SAP SE. All rights reserved.

Create NodeCredentialMac Constant

Create NodeCredentialMaccreationDate Constant

Create NodeCredentialMacalgorithm Constant

Create NodeCredentialMacexpirationDate Constant

Create NodeCredentialMactype Constant

Create NodeCredentialDigitalSignature Constant

Create NodeCredentialSharedSecret Constant

Create NodeCredentialIdentity Constant

Create NodeCredentialdomain Constant

Create Nodetype Constant

Create cXMLpayloadID Header SAP_IDoc_EDIDC_REFMES

According tothe cXMLReferenceGuide, 2.1.6.

Create cXMLTransaction Constant Request or Message

Create FromCredentialdomain Constant ‘NetworkID’

Create FromCredentialIdentity Header SAP_IDoc_EDIDC_SNDPRN

Example withmessagedependentxpath:

//InvoicePartner/Contact[@role='from']/@addressID

Create FromCredentialSharedSecret Constant

Create FromCredentialDigitalSignature Constant

Create FromCredentialMactype Constant

Create FromCredentialMacexpirationDate Constant

Create FromCredentialMacalgorithm Constant

Create FromCredentialMaccreationDate Constant

Create FromCredentialMac Constant

Create ToCredentialdomain Constant

Create ToCredentialIdentity Header SAP_IDoc_EDIDC_RCVPRN Example withmessagedependentxpath:

//InvoicePartner/Contact[@role='billTo']/@addressID

Create ToCredentialSharedSecret Constant

Create ToCredentialDigitalSignature Constant

Page 12: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

12©2021 SAP SE. All rights reserved.

Create ToCredentialMactype Constant

Create ToCredentialMacexpirationDate Constant

Create ToCredentialMacalgorithm Constant

Create ToCredentialMaccreationDate Constant

Create ToCredentialMac Constant

Create SenderCredentialdomain Constant

Create SenderCredentialIdentity Constant SAP_IDoc_EDIDC_SNDPRN

Create SenderCredentialSharedSecret Constant

Create SenderCredentialDigitalSignature Constant

Create SenderCredentialMactype Constant

Create SenderCredentialMacexpirationDate Constant

Create SenderCredentialMacalgorithm Constant

Create SenderCredentialMaccreationDate Constant

Create SenderCredentialMac Constant

Create SenderUserAgent Constant

Create deploymentMode Constant ‘production’

Page 13: SAP Cloud Integration – Integration Flow SAP IDoc to cXML ...

EDI Integration Templates for SAP Integration Advisor

13©2021 SAP SE. All rights reserved.

3.9.4. Tab “Message Body”: Combine variable ExtractedMessage with headerelements and attributes to the final cXML Message

The goal of this sub-step is to combine the variable ExtractedMessage together with the cXMLheader elements and attributes. Note that currently all required elements and attributes (and onlythem!) are part of the Message Body declaration. If you need additional elements or attributes, youneed to add them at the corresponding place of the cXML Header.

This sub-step combines the variables defined in the 2 previous sub.steps(${header.ExtractedMessage} and the variables needed from the tab “Exchange Property”) in the tab“Message Body” to generate the final cXML message.

Note that currently only the required elements and attributes are part of the declaration in the“Message Body”. If you need additional elements or attributes, you need to add them at thecorresponding place in the cXML Header in the tab “Message Body”.

For cXML, please use the tab “Message Body” below:

<cXML payloadID="${property.cXMLpayloadID}" timestamp="${property.cXMLtimestampYear}-${property.cXMLtimestampMonth}-${property.cXMLtimestampDay}T${property.cXMLtimestampHour}:${property.cXMLtimestampMin}:${property.cXMLtimestampSec}"><Header><From><Credential domain="${property.FromCredentialdomain}"><Identity>${property.FromCredentialIdentity}</Identity></Credential></From><To><Credential domain="${property.ToCredentialdomain}"><Identity>${property.ToCredentialIdentity}</Identity></Credential></To><Sender><Credential domain="${property.SenderCredentialdomain}"><Identity>${property.SenderCredentialIdentity}</Identity><SharedSecret>${property.SenderCredentialSharedSecret}</SharedSecret></Credential><UserAgent>${property.SenderUserAgent}</UserAgent></Sender></Header><${property.cXMLTransaction} deploymentMode="${property.deploymentMode}">${header.ExtractedMessage}</${property.cXMLTransaction}></cXML>

The message body above lists only the attributes and nodes marked as required. Possibly you need to add attributes and nodes which aremarked unrequired in the cXML documentation (cXML reference guide).

3.10. End EventThe End Message event should be connected with the receiving system.

3.11. Receiver ChannelReceiver channel is configured by the customer.