
Configuring the Outbound File Adapter
Use
You need to configure the outbound file adapter to save XML messages from the
Integration Engine in files.To configure the adapter you must specify the following:
Prerequisites
You have:
Procedure
The configuration of the outbound file adapter comprises five functional subareas:
Specify the class name as follows:
classname=com.sap.aii.messaging.adapter.ModuleXMB2FILE
This specification is mandatory.
Specify the mode of the outbound file adapter. The following values are permitted:
The system saves the document sent from the Integration Engine as a file.
A text file is expected that contains an XML document that represents a table. This document can be converted to a text file that stores the contents of the document as a list, with elements separated by commas or with fixed column lengths. The expected XML format corresponds to the result of the conversion of the inbound JDBC or file adapter. You must make the necessary specifications for the conversion in step 5.
A special file format is generated here that represents a completely serialized Integration Engine message. This file format can be processed by the
inbound file adapter in the mode XMBSTREAM2FILE. This format can be used to temporarily save complete Integration Engine messages, including all Integration Engine-specific parameters that then no longer need to be specified in the inbound file adapter.The default value is
XMB2FILE.<port_no>
<service> describes the service part of the URL where the Integration Engine must send its messages.
These specifications are mandatory.

For example, if you have specified
![]()
The end point address must be extended as follows for the Integration Engine in Release 1.0:
http://<fileadapterhost>:1234/file/Receiver?action=execute&pipelineid=ReceiverIf the Integration Engine message is sent to a non-specified adapter service, the system displays the following error message:
No registered listener for <Service> found
The system displays the same message if the adapter is initialized, but has not been started (status
STOPPED or INITIALIZED).Specify whether a target directory (
targetDir) should be created (1) or not (0), if one does not already exist. The default value is 1 (create directory).The following specifications are mandatory:
Specify the target directory where incoming documents are to be saved. The system creates this directory automatically if you do not make any specifications for
file.createDir.Specify the file name where the system is to save the first incoming document.
Specify whether the system saves all inbound documents under the file name that you specified in
file.targetFilename. The following values are permitted:file.writeMode=overwrite
In mode
overwrite, the file is overwritten so that the system always only saves the last received document.file.writeMode=append
In
append mode the file is updated by appending the incoming documents.file.writeMode=addTimeStamp
In mode
addTimestamp the system generates a new file for each document. The file name comprises the name specified under file.targetFilename, in each case extended by a time stamp in the format yyyyMMdd-HHmmss-SSS. This corresponds to the time that the document was processed, from the year (yyyy) to the millisecond (SSS), which is inserted before the file name extension.This mode
guarantees that no data is overwritten. In this way, files that originate from the same adapter configuration can simply be sorted according to the date that they entered processingfile.writeMode=addCounter
In mode
addCounter the system generates a new file for each document. The file name comprises the name specified in file.targetFilename, extended by one counter that is added before the file name extension (for example, default002.file). The counter is constructed from the subsequent specifications.The mode
addCounter guarantees that no data is overwritten. If necessary, the system finds the next free counter from which it can construct a new file name.In mode
addCounter the exact format of the file name can be controlled using the following parameters; each parameter has a default setting.Specify one or more characters that you want to add before the numerator in the file name. The default value is an empty character sequence (that is, no
SeparatorString).Specify the first counter to be used. It must be a valid integer number, though leading zeros are permitted. The length of the
FormatString is used for all counters (including existing leading zeros) until overflow forces the format to be enlarged.The default value is
000.Enter a number that specifies the increment of the counter that successive counters are to be increased by. The default value is
1.Specify when a counter is to be added. The following values are permitted:
file.counterMode=afterFirst
Only add the counter after the file name specified under
file.targetFilename was used unaltered.file.counterMode=immediately
The counter should be added after the first incoming document.
The default value is
afterFirst.
If you do not set a parameter, the system generates the file names
<default.file>, <default000.file>, <default001.file>, <default002.file> from the specified default values for incoming documents.If instead of the default values, you set the following explicit values
file.targetFilename=test.dat
file.counterMode=immediately
file.counterSeparator=_
file.counterFormat=00005
file.counterStep=2
the system generates the file names test_00005.dat, test_00007.dat, test_00009.dat and so on.
This list is also continued once the adapter has been stopped and restarted, without overwriting existing files.
An operating system command specified here is executed after a file has been successfully processed. The default value is an empty character string (no command).
Specify the number of days that the management information for received messages with the service attribute Exactly Once (In Order) should be kept. This information is required to avoid messages being duplicated, if when handling an error the Integration Engine sends the same message to an adapter more than once. The default value is
60 days.![]()
If the value is set to 0 or to a negative value, all management information is deleted each time the adapter is initialized. This can be useful for test purposes but must not be used for production operation.
If a message is received with the service attribute Exactly Once, a temporary file with the name of the adapter configuration is generated first in the target directory. This file is then automatically renamed during the Exactly Once handling. It must not be renamed or edited manually in any way, or deleted since this can lead to the message being lost.
If you want to save files on an FTP server and not in the file system, you need to make the following additional specifications:
![]()
In the FTP client mode, the value
The host name or IP address of the FTP server. If this specification is available, it is assumed that you are accessing an FTP server. The specifications
file.targetDir and file.targetFileName refer to the FTP server.The port number of the FTP server. It is not obligatory that you specify the port number here. The default is the standard port for the FTP server (21).
A valid user name for the FTP server. It is not obligatory that you specify a user name. The default user is
anonymous with the password anonymous.Use this specification to define whether a new connection needs to be established each time a file is transferred to the FTP server (value
perFileTransfer), or whether a permanent connection should be used (value permanently). In this case, the connection is re-established automatically if it closed on the server side (for example, due to a timeout). The default value is permanently.The following arguments refer to the mode
To convert a table in XML format to pure text format, the document format must be the same as that which is generated by the inbound file adapter in mode
FILE2XMBWITHROWCONVERSION and the JDBC adapter. This means that the document looks as follows:<resultset>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
</resultset>
This is an example for 3 columns and 2 lines. The number of lines and columns is, of course, unlimited. Using the following specifications, the system constructs a text file from this XML document.
Specify whether the text file should have a header line with columns names. The following values are permitted:
0
– No header line1
– Header line with column names from the XML document2
– as for 1, followed by a blank line3
– Header line is saved as xml.headerLine in the configuration and is copied4
– as for 3, followed by a blank lineThis specification is mandatory.
Specify the header line that is generated in the text file if
xml.addHeaderLine has the value 3 or 4. This specification is mandatory.Specify a character string that contains a list of fixed column widths that are separated by commas and which determine the number and the length of columns generated in the text file.
If you do not make any specifications for
xml.fieldSeparator, the specification xml.fieldFixedLengths is mandatory.Specify how you want the system to respond when column widths in the actual document exceed those defined in
xml.fieldFixedLengths. The following values are permitted:xml.fixedLengthTooShortHandling=Error
Error
means that processing of the document is terminated.xml.fixedLengthTooShortHandling=Cut
Cut
means that a value is shortened to the maximum permitted length.xml.fixedLengthTooShortHandling=Ignore
Ignore
means that the system copies the value completely, regardless of it being too long. Subsequent columns are moved correspondingly.The default value is
Error.If you do not specify
xml.fieldFixedLengths, this specification is obsolete.If you specify a character string here, it is added as a separator to all columns except the last. You can also specify this string in addition to
xml.fieldFixedLengths.If you made no specification for
xml.fieldFixedLengths, this is the only specification to identify the individual columns in a row.If you made a specification for
xml.fieldFixedLengths, the length of the separator is not taken into account.![]()
You must specify at least either
xml.fieldFixedLengths or xml.fieldSeparator.If you have only specified
xml.fieldSeparator, the structures of the XML document can have differing numbers of elements that are added to each other separately in the text file by the value from xml.fieldSeparator . If you specify xml.fieldFixedLenghts this is not possible since the number of columns is defined when the column widths are given.If you enter a character string here, the system adds it to the last column as a closing character. You can also make this specification in addition to
xml.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).
If you specify a character string here, the system places it before the first column. You can also make this specification in addition to
xml.fieldFixedLengths.The default value is an empty character string (no separator before the first column).
![]()
Special Characters in the String for Separators:
In all strings for separators (
xml.fieldSeparator, xml.beginSeparator and xml.endSeparator), you can specify non-printable ASCII characters. These characters can be each be inserted individually in the string in the form ´0xHH´ (including the quotation mark), where HH represents the character coded as a hexadecimal value. A line break can be entered using the character ´nl´ (including the quotation marks); nl stands for new line here.![]()
Fixed Column Width of the Text Document
xml.absoluteRowWidth=<noOfColumns>
If the separators do not contain any line breaks, the text document is generated as a single line text. To restrict the width of the text, use this parameter.
<noOfColumns> represents the maximum number of columns in this case. This parameter also functions together with the specification of a line break for xml.endSeparator.This value requires
xml.addHeaderLine=0 to be specified.