Show TOC Start of Content Area

Function documentation StrictXml2PlainBean  Locate the document in its SAP Library structure

Use

You use this module to convert an XML document, which is in the main payload of the XI message to text format.

You can define whether a recordset type in the document is displayed as text with a fixed field width, or in a separate list with a user-defined separator.

Within an XML document, different recordset types can be displayed either separately or with a fixed field length (mixed display).

The structure of the document is checked based on the entries you make in the module. If any structures are found in document that do not correspond to your definition, a processing error is triggered at runtime.

Integration

      You can use the module in receiver adapters.

      You can use the module in the receiver File/FTP adapter in place of the message log Convert File Content. The module provides more conversion options and a check of the structure that is to be converted.

See: Converting File Content in the Receiver Adapter

Activities

Entries in the Processing Sequence

      Insert the module in front of the adapter module.

If the adapter comprises multiple modules, for information about the position of the module, see: Extending the Module Chain in the Module Processor

      Enter the module name AF_Modules/StrictXml2PlainBean.

      Select the module type Local Enterprise Bean.

The default module key is displayed.

Entries in the Module Configuration

Enter the parameter name and parameter values for the module key of the module.

XML Document Conversion Type

      Enter recordTypes as the parameter name.

Under Parameter Value, enter the complete, comma-separated list of all names of recordset types that occur in the document to be converted.

If you decide to use this method, you can define a different conversion type for each recordset type that occurs in the XML document.

For example, you could name the recordset types as follows: RecordType1,RecordType2,RecordType3.

      Enter singleRecordType as the parameter name.

Under Parameter Value, enter the name of a recordset type that is to be used to convert all elements that occur in the XML document.

If you decide to use this method, define the same conversion type for each recordset type that occurs in the XML document.

You must enter exactly one parameter only. Whichever parameter you choose, you automatically exclude the second parameter.

You define further parameters for each recordset type.

In the remainder of this documentation the parameters are specified by the prefix <RecordType>. In your configuration, replace this name with the name of the recordset type.

Conversion Type List with Separators

      <RecordType>.fieldSeparator

Enter the field separator that is written between the individual fields of a record.

This specification is mandatory.

Conversion Type List with Fixed Field Length

      <RecordType>.fieldLengths

Specify a character string that contains a list of fixed field lengths that are separated by commas and which determines the number and the length of fields generated in the text file.

Example

For example, you want to write a recordset with three elements that have field widths of five, ten, and fifteen characters. Enter:

<RecordType>.fieldLengths = 5,10,15

This specification is mandatory.

      <RecordType>.fieldLengthExceeded

Specify how you want to handle fields that exceed the configured field length. Permitted values for the parameter value are:

       error (default)

Interrupts processing of message with error

       cut

Cuts off superfluous characters

       ignore

Ignores the field length restriction

Further Entries

      <RecordType>.beginSeparator

Enter a string. The string is placed in front of the first field of a recordset.

      <RecordType>.endSeparator

Enter a string. The string is appended to the last field of a recordset as a concluding character. The default is \r\n.

      contentType

Enter the MIME type of the converted payload. The default value is text/plain.

      addHeaderLine

Only define this parameter if you have already defined singleRecordType.

Define whether a header line is to be added to the result of the conversion.

       none (default)

Does not insert a header line

       fromXML

The header line is generated from the element name of the first recordset of the XML document

       fromConfiguration

The header line is determined by the configuration parameter headerLine.

      headerLine

Only define this parameter if you have already set addHeaderLine=fromConfiguration.

The value that you define is placed in front of the result of the conversion as a header line.

      fixedLineWidth

Enter the maximum line length n (in characters) that can be written to the resulting document. The separator specified by lineSeparator is inserted in the resulting document every n characters.

      lineSeparator

Only define this parameter if you have already defined fixedLineWidth.

Specify the string that is written to the resulting document at the end of each line that is written with fixedLineWidth. The default is \r\n.

Use of Special Characters

You can use special characters in the following parameters: <RecordType>.fieldSeparator, <RecordType>.beginSeparator, <RecordType>.endSeparator, headerLine, and lineSeparator.

      Tabulator: \t

      Carriage Return (CR): \r

      Line Feed (LF): \n

      Arbitrary character: \x<code>

<code>indicates the hexadecimal character code of the character to be displayed.

Example

A document to be converted has exactly three levels. The recordset types are on the second level, while the actual data is on the third level.

 

<root>

    <RecordType1>

        <column-name1>column-value</column-name1>

        <column-name2>column-value</column-name2>

        <column-name3>column-value</column-name3>

    </RecordType1>

    <RecordType2>

        <data>column-value</data>

        <data2>column-value</data2>

        <data3>column-value</data3>

    </RecordType2>

</root>

For this document, you can define a configuration for the recordset types RecordType1 and RecordType2. Specify in addition: recordTypes=RecordType1,RecordType2

You then have the option of defining a different conversion for each recordset type.

If you use the parameter singleRecordType, both recordset types are converted in the same way.

 

 

 

End of Content Area