240511845-xslt-mapping.pdf

10

Click here to load reader

Upload: robertofaccini64

Post on 02-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 1/10

XSLT Mapping

By Vijay Kumar Thirumareddi, YASH PI Competency Core Team, Yash Technologies

This document gives you clear understanding of XSLT Mapping, which shall convert source structure tospecific target structure.

Below are different ways of achieving this conversion in XI,

1. Message Mapping (Graphical Mapping using Mapping Editor in XI )  

2. Java Mapping 

3.

 ABAP Mapping 

4. XSLT Mapping 

The rest of the document gives you pre-requisites and steps that are necessary for making use of XSLTMapping. 

Pre-requisites 

  XSL  – Extensible Stylesheet Language 

  XSLT  – XSL Transformations, the purpose of this is for transformation of XML documentsinto other formats like XML, XHTML and etc. Here is the link to get corresponding tutorialhttp://www.w3schools.com/xsl/default.asp.  

  XPATH  – XSLT uses XPATH to find information in an XML document. XPATH is used to

navigate through elements and attributes in XML documents. Here is the link for samehttp://www.w3schools.com/xpath/default.asp.  

Steps required for developing XSLT Mapping 

  Create a source data type and a target data type  

  Create Message types for the source and target data types. 

  Create Message Interfaces (Service Interfaces) includes Inbound Message interface andOutbound Message interface. 

  XSLT Mapping does not require creation of Message mapping, so don’t create any Messagemapping. 

  Create an .XSL file which converts source data type into target data type.  

  Zip that .xsl file and import it into Integration Repository under Imported Archives. 

  In Interface Mapping (Operation Mapping) choose mapping program as XSL and specify this zipprogram. (Through search help you will get XSL Mapping programs that you imported underImported Archives, select your corresponding XSL Program)  

  Test this mapping program by navigating to Test tab. 

By having look at above steps you can easily find out that this mapping is no where different from othermapping programs, here the challenging lies in creating an XSLT file. If you spend couple of minutes instudying XPATH tutorial you would be in ideal position to create an XSL Transformation (.xsl extension).

If you still find difficulties in generating XSL Transformation, then you can make use of a tool “AltovaMapForce” which will create XSL file for you.

Steps for creating XSL file using this tool:

1. Open the Alto MapForce, import the source .xml and .xsd file in it  

2. Similarly import the target .xml and .xsd in MapForce.  

3. These two data files should match with source and target data types in Integration Repository.  

4. Complete the graphical mapping using extensive list of XSLT functions available there.  

5. Save the mapping file.  

6. Click the XSLT tab. You will have the entire xslt logic there.  

7. Copy that content and save it as .xsl file.  

Page 2: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 2/10

8. Zip above .xsl file and import the same into IR under Imported Archives. 

Scenario demonstrating usage of XSLT Mapping  

Take a business scenario where in business (Source System) sends an outbound delivery to theirLogistics partner for transporting the same. But here the source business is running on SAP R/3 andcorresponding Logistics partner is not on SAP, hence the interpretation of data/communication isdifferent. Because source system sends delivery information in an IDoc (which will be handled bymessage control for delivery (VL01N/02N) and the target Logistics partner is not aware of these IDocstructures, so in order to provide a communication between these two we need some interfacemechanism which takes IDoc structure and converts it into the format understandable by the target

Logistics provider and vice versa.

Here the target system expects the xml files in CIDX format, so XI system takes IDoc as an input andconverts it to an XML file adhering to CIDX naming standards.

Important steps to make this scenario:

  Import needed IDoc structure into IR, in our scenario import IDoc DESADV.DELVRY03  

  Import corresponding XSD structure under External Definitions in IR. Here thecorresponding CIDX message is Load Tender Motor . 

  Import ZIP file corresponding to XSLT under Imported Archives in IR, which can transformsource message to target structure. 

Objects needed to be developed in IR  

Inbound Message Interface: Create Inbound Message Interface resembling target CIDX message.  

Page 3: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 3/10

 

Import XSL ZIP file

Page 4: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 4/10

 

Provide path to corresponding zip file,

Save it

Page 5: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 5/10

 

Interface Mapping: Provide source interface as DESADV.DELVRY03 and Target interface asMI_IB_LoadTenderMotor

Now specify Mapping Program specific to XSL Type,

Page 6: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 6/10

 

Choose corresponding Archive program from the search help provided under “Name”. 

Save it. 

Now activate all the objects that are developed in IR.  

Page 7: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 7/10

Objects that need to be developed in ID 

Business System: Create a business system-pointing source SAP R/3 system. 

Business Service: Create a business service corresponding to target file system and don’t forget toassign outbound and inbound interfaces.

Communication Channel: Create a communication channel of type File Adapter under Businessservice (w.r.t target system) to send a file to FTP server of target system. Define the target FTPserver details as shown in the following screen:

Sender Agreement: No need as Source system is sending IDOC which is native to XI (but need toperform necessary steps through transactions IDX1 and IDX2).

Receiver Determination: Configure Receivers for corresponding Sender Service and OutboundInterface combination.

Interface Determination: Specify corresponding Inbound Interface and Interface Mapping forcombination of Sender Service and Outbound Interface w.r.t specified Receiver in ReceiverDetermination.

Receiver Agreement: Create this corresponding to Receiver Business service and inbound interfacecombination and specify communication channel, which places file on the target system’s FTP server.  

Altova MapForce to create XSLT 

Page 8: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 8/10

Open Altova MapForce tool, before this activity, have XSD’s of both Source and Target structures onlocal machine. 

Create a new Mapping file

3. Now import XSD’s of both Source and Target messages (which are Outbound and InboundMessages in XI). 

To do this go to Menu Item, Insert-> XML Schema/File  

Give path to Source message XSD (in this scenario xsd is corresponding to IDoc typeDESADV.DELVRY03), after specifying the xsd it will look like as shown below

Page 9: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 9/10

 

In the same way repeat necessary steps for Target structure (in this scenario xsd is corresponding

Load Tender Motor CIDX message) 

Now make use of functions that are available on left side and complete required mapping,

Page 10: 240511845-Xslt-Mapping.pdf

8/10/2019 240511845-Xslt-Mapping.pdf

http://slidepdf.com/reader/full/240511845-xslt-mappingpdf 10/10