Start of Content Area

Procedure documentation Converting XML in the Receiver File/FTP Adapter to Text Format  Locate the document in its SAP Library structure

Use

You can convert a table in XML format to pure text format.

Prerequisites

      In the receiver file/FTP adapter, you have selected File Content Conversion as the Message Protocol.

      The expected XML structure contains the structure as nodes filled with any number of elements without additional subnodes.

      The expected document structure usually looks like this:

<root>...

  <nameA>

        <value1>value</value1>

        <value2>value</value2>

        <value3>value</value3>

  </nameA>

  <nameB>

        <value4>value</value4>

  </nameB>

...

</root>...

Procedure

...

       1.      You can use any element names you like.

       2.      There can be any number of different substructures under the root element, which can be mapped to different CSV structures.

Defining File Structure Parameters

       3.      Under Recordset Structure, enter the substructures using the pattern NameA,NameB,....

If you want to convert all substructures using the same parameters, you only have to specify one structure. The entries are automatically applied to all substructures.

If you specify more than one structure, the list must contain all the structures occurring in the document. The list must be complete, otherwise a processing error will be triggered at runtime.

Defining Parameters for Recordset Structures

       4.      Set the parameters for all the specified recordset structures NameA, NameB,... in the following table:

       NameA.addHeaderLine

Specify whether the text file will have a header line with column names. The following values are permitted:

       0 – No header line

       1 – Header line with column names from the XML document

       2 – As for 1, followed by a blank line

       3 – Header line is stored as NameA.headerLine in the configuration and is applied

       4 – As for 3, followed by a blank line

This specification is only permitted if exactly one structure is defined.

       NameA.headerLine

Specify the header line that is generated in the text file if NameA.addHeaderLine has the value 3 or 4. This entry is mandatory in this case.

       NameA.fieldFixedLengths

Specify a character string containing a list of fixed column widths that are separated by commas and determine the number and the length of columns generated in the text file.

If you do not make any entries for NameA.fieldSeparator, the entry NameA.fieldFixedLengths is mandatory.

       NameA.fixedLengthTooShortHandling

Specify how you want the system to respond when column widths in the actual document exceed those defined in NameA.fieldFixedLengths. The following values are permitted:

       Error

Document processing is cancelled.

       Cut

The value is cut to the maximum permitted length.

       Ignore

The value is accepted even though its length exceeds the permitted value. Subsequent columns are moved accordingly.

       NameA.fieldSeparator

Enter a string. It is added as a separator in all columns apart from the last. You can specify this string in addition to NameA.fieldFixedLengths.

If you made no entry for NameA.fieldFixedLengths, this is the only entry to identify the individual columns in a row.

If you made an entry for NameA.fieldFixedLengths, the length of the separator is not added to this length.

Note

You must make an entry for at least NameA.fieldFixedLengths or NameA.fieldSeparator.

If you have only specified NameA.fieldSeparator, the structures of the XML document can have differing numbers of elements that are added one after the other in the text file, each separated by the value from NameA.fieldSeparator. If you specify NameA.fieldFixedLengths this is not possible since the number of columns is defined when the column widths are given.

       NameA.endSeparator

If you enter a character string here, the system adds it to the last column as a closing character.

You can make this entry in addition to NameA.fieldFixedLengths. To include a line break following the closing character, you must explicitly define it by attaching ´nl´ (including the quotation marks) to the string.

The default value is a line break (no explicit separator after the last column; instead the structures are arranged line-by-line).

       NameA.beginSeparator

If you specify a character string here, the system places it before the first column. You can make this entry in addition to NameA.fieldFixedLengths.

The default value is an empty character string (no separator before the first column).

Defining Special Characters in Strings for Separators

       5.      You can specify non-printable ASCII characters in all strings for separators (NameA.fieldSeparator, NameA.beginSeparator, and NameA.endSeparator).

       Insert these characters individually in the strings in the form ´0xHH´ (including quotation marks). HH represents the character encoded as a hexadecimal value.

       Add a line break using the character ´nl´ (including the quotation marks); nl stands for new line.

       The special character ´0´ is not a separator character.

Defining a Fixed Column Width of the Text Document

       6.      If the separators do not contain any line breaks, the text document is generated as a single line text. If you want to restrict the text width, use the parameter NameA.absoluteRowWidth=<noOfColumns>. <noOfColumns> specifies the maximum number of columns.

You can set this parameter together with the specification of a line break for xml.endSeparator.

This value requires NameA.addHeaderLine=0 to be specified.

 

 

 

 

 

 

End of Content Area