How to improve the performance of SAP standard implementations using SAP PI AAE.


SAP PI Interview Questions and SAP PI Tutorials

SAP PI Interview Questions and SAP PI Tutorials

How to improve the performance of SAP standard implementations using SAP PI AAE.

Steps for content conversion module with J2EE JMS Adapter

1 Scenario

XI 3.0 SP9 provides a new function in the Adapter Framework. You can now use a conversion module in the various adapters, which enables you to convert XML files to flat structures and the other way around. This guide shows you example configuration files. It does not describe all possible parameters. For more information, see the online documentation.

2 Introduction

In the Adapter Framework, all adapters are developed as modules. These modules can be combined with other standard or user-defined modules. In the communication channel configuration, you can use the Module tab page to enter additional modules for each receiver or sender channel. In SP9, there is a standard module MessageTransformBean for specific conversion routines, particularly in the JMS adapter. You can use this module in sender and receiver communication channels. For sender channels, you can choose either a simple transformation to handle files in which all rows have the same structure, or a more complex transformation for files in which the rows can have different structures. For receiver channels, you can only use the simple transformation. All transformations can handle comma-separated-value (CSV) structures or structures with fixed field length. The options are very similar to the FCC adapter.

3 The Step-By-Step Solution

The first step for each configuration is to add the conversion module to the communication channel. Open the communication channel, select the Module tab page, and add the conversion module to the provided JMS adapter modules as follows:

Module Sequence in the Sender Channel

No. Module Name T Module Key
1 localejbs/SAP XI JMS Adapter/ConvertJMSMessageToBinary L ReceiveMsg
2 localejbs/SAP XI JMS Adapter/ConvertBinaryToXMBMessage L ConvertMsg
3 localejbs/AF_Modules/MessageTransformBean L Plain2XML
4 localejbs/CallSapAdapter L ForwardToMS

Module Sequence in the Receiver Channel

No. Module Name T Module Key
1 localejbs/AF_Modules/MessageTransformBean L XML2Plain
2 localejbs/SAP XI JMS Adapter/ConvertMessageToBinary L CallJMSService
3 localejbs/SAP XI JMS Adapter/SendBinarytoXIJMSService L Exit

 

The names of the module keys are only examples. You can choose any name. However, for the parameter configuration you must refer to the module key name you have assigned to the module MessageTransformBean. Make sure that you do not enter any spaces after parameter names or values in your configuration, especially after copying values to the configuration from text files. The field length for the parameter values is only 256 bytes; this may mean you have to use short names for the XML field names. (With SP12 there is no restriction any more)

 

3.1 Example of a Simple Conversion in a Sender Communication Channel

Let us assume that we have a very simple file structure containing three fields with three bytes each, and a sample file with two rows:

Example

AAABBBCCC111222333

This leads to the following entries in the module configuration of the module processor:

Module Key Parameter Name Parameter Value
Plain2XML Transform. Class com.sap.aii.messaging.adapter.Conversion
Plain2XML Transform.ContentType text/xml;charset=utf-8
Plain2XML xml.conversionType SimplePlain2XML
Plain2XML xml.processFieldNames fromConfiguration
Plain2XML xml.documentName MyDocument
Plain2XML xml.documentNamespace http://xi.com/test
Plain2XML xml.structureTitle MyTitle
Plain2XML xml.fieldNames field-name1,field-name2,field-name3
Plain2XML xml.fieldFixedLengths 3,3,3

 

The result of this conversion looks like this:

<ns:MyDocument xmlns:ns=”http://xi.com/test”>

<MyTitle>

<field-name1>AAA</field-name1>

<field-name2>BBB</field-name2>

<field-name3>CCC</field-name3>

</MyTitle>

<MyTitle>

<field-name1>111</field-name1>

<field-name2>222</field-name2>

<field-name3>333</field-name3>

</MyTitle>

</ns:MyDocument>

If you have a CSV file, you use the parameter xml.fieldSeparator (with parameter value”,”) instead of xml.fieldFixedLengths.

3.2 Structure Conversion in a Sender Communication Channel

The structure conversion can handle files containing rows with different structures. In each row there is a key field to identify the structure. The rows with identical key fields of course have identical structures.Let us assume that we have a sample file with four rows. Each row has a two-byte key field; the first row has a second field with ten bytes; the structure of the second and third rows is the same and comprises two additional fields with three bytes each; the last rowhas a second field with five bytes:

AA1234567890BBABCABCBBXYZXYZCC12345

The configuration for the conversion could look like this:

Module Configuration

Module Key Parameter Name Parameter Value

Plain2XML Transform.Class com.sap.aii.messaging.adapter.Conversion

Plain2XML Transform.ContentType text/xml;charset=utf-8

Plain2XML xml.conversionType StructPlain2XML

Plain2XML xml.processFieldNames fromConfiguration

Plain2XML xml.documentName MyDocument

Plain2XML xml.documentNamespace http://xi.com/test

Plain2XML xml.recordsetName MyRecordset

Plain2XML xml.recordsetStructure NameA,1,NameB,*,NameC,1

Plain2XML xml.keyFieldName MyKey

Plain2XML xml.keyFieldType CaseSensitiveString

Plain2XML xml.NameA.fieldNames MyKey,field-nameA

Plain2XML xml.NameA.fieldFixedLengths 2,10

Plain2XML xml.NameA.keyFieldValue AA

Plain2XML xml.NameB.fieldNames MyKey,field-nameB1,field-nameB2

Plain2XML xml.NameB.fieldFixedLengths 2,3,3

Plain2XML xml.NameB.keyFieldValue BB

Plain2XML xml.NameC.fieldNames MyKey,field-nameC

Plain2XML xml.NameC.fieldFixedLengths 2,5

Plain2XML xml.NameC.keyFieldValue CC

In xml.recordsetStructure, you add a name for each different structure followed by then number of occurrences or an asterisk for unbounded occurrences. For each structure name, you configure the structure separately in a separate namespace such as xml.NameA.fieldNames and so on. If your source file is a CSV file, replace each xml.XXX.fieldFixedLengths with xml.XXX.fieldSeparator.

The result of this conversion looks like this:

<ns:MyDocument xmlns:ns=”http://xi.com/test”>

<MyRecordset>

<NameA>

<MyKey>AA</MyKey>

<field-nameA>1234567890</field-nameA>

</NameA>

<NameB><MyKey>BB</MyKey>

<field-nameB1>ABC</field-nameB1>

<field-nameB2>ABC</field-nameB2>

</NameB>

<NameB>

<MyKey>BB</MyKey>

<field-nameB1>XYZ</field-nameB1>

<field-nameB2>XYZ</field-nameB2>

</NameB>

<NameC>

<MyKey>CC</MyKey>

<field-nameC>12345</field-nameC>

</NameC>

</MyRecordset>

</ns:MyDocument>

3.3 Simple Conversion in a Receiver Communication Channel

For a receiver channel, only the simple conversion is available. The XML structure of thesource file has to follow the same structure as the result of the SimplePlain2XMLconversion:

<resultset>

<row>

<column-name1>ABC</column-name1>

<column-name2>12345</column-name2>

<column-name3>My Text</column-name3>

</row>

SAP PI Interview Questions and SAP PI Tutorials

SAP PI Interview Questions and SAP PI Tutorials

<row>

<column-name1>XYZ</column-name1>

<column-name2>67890</column-name2>

<column-name3>This Text is too long</column-name3>

</row>

</resultset>

Module Configuration

ModuleKeyParameter Name Parameter Value

XML2Plain Transform.Class com.sap.aii.messaging.adapter.Conversion

XML2Plain Transform.ContentType text/plain;charset=utf-8

XML2Plain xml.conversionType SimpleXML2Plain

XML2Plain xml.addHeaderLine 0

XML2Plain xml.fieldFixedLengths 3,5,10

XML2Plain xml.fixedLengthTooShortHandling Cut

The result of this conversion looks like this:

ABC12345My Text

XYZ67890This Text

If you want to create a CSV file, use parameter xml.fieldSeparator instead ofxml.fieldFixedLengths.Note: The names of the tags are examples. You can choose any name you like. As the tags are not identified by name, you have to assure that no tag is missing.

3.4 Structure Conversion in a Receiver Communication Channel

In a receiver communication channel, we want to map an XML file to a complex plain filewith different lines. The XML structure of the source file has to follow the same structureas the result of the SimplePlain2XML conversion:

<resultset>

<row>

<NameA>

<field-nameA1>1234567890</field-nameA1>

<field-nameA2>XYZ</field-nameA2>

</NameA>
</row>

<row><NameB>

<field-nameB1>ABC</field-nameB1>

<field-nameB2>DEF</field-nameB2>

<field-nameB3>GHI</field-nameB3>

</NameB>
</row>

<row><NameB>

<field-nameB1>OPQ</field-nameB1>

<field-nameB2>RST</field-nameB2>

<field-nameB3>UVW</field-nameB3>

</NameB>
</row>

<row>

<NameC>

<field-nameC>12345</field-nameC>

</NameC>
</row>
</resultset>

Module Configuration

Module Key Parameter Name Parameter Value
XML2Plain Transform.Class com.sap.aii.messaging.adapter.Conversion
XML2Plain Transform.ContentType text/plain;charset=utf-8
XML2Plain xml.conversionType StructXML2Plain
XML2Plain xml.addHeaderLine 0
XML2Plain xml.recordsetStructure NameA,NameB,NameC
XML2Plain xml.NameA.fieldFixedLengths 3,3
XML2Plain xml.NameA.fixedLengthTooShortHandling Cut
XML2Plain xml.NameB.fieldFixedLengths 3,3,3
XML2Plain xml.NameC.fieldFixedLengths 5

The result of this conversion looks like this:

123ABCABCDEFGHIOPQRSTUVW12345

If you want to create a CSV file, use parameter xml.NameA.fieldSeparator instead of xml.fieldFixedLengths.

The tag names NameA, NameB, and NameC are just examples; you can choose any names for the tags, but you must make sure that the structure is identical.

NOTE: You can also use the .endSeparator parameter to control the line termination behavior similar to the function by the same name in the FCC adapter.

==

 

SAP PI Interview Questions and SAP PI Tutorials

SAP PI Interview Questions and SAP PI Tutorials

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter
PDF Printer    Send article as PDF   
This entry was posted in Step by Step Guides and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>