on 04-03-2008 3:14 PM
Hi Experts,
I have a problem with the Receiver File Adapter. I want to use Content Conversion to generate a plain file.
Input to receiver file adapter:
<?xml version="1.0" encoding="utf-8" ?>
<PlainFile>
<filename>filename.txt</filename>
<line>Line 1</line>
<line>Line 2</line>
...
</PlainFile>
Wanted result: a file filename.txt with this content:
Line 1
Line 2
...
FCC settings:
RecordSet Structure: line, filename
line.fieldSeparator:'nl'
filename.fieldFixedLengths:0
filename.fixedLengthTooShortHandling:Cut
Problem is: the adapter throws error "Message processing failed in XML parser: 'Conversion configuration error: Unknown structure 'PlainFile' found in document'"
If I use:
RecordSet Structure: PlainFile, line, filename
and add:
PlainFile.fieldSeparator:'nl'
... the lines are printed, but also the unwanted filename. The XML input results from an 1:n mapping, therefore I want to set different filenames by variable substitution from the payload.
Many thanks for your help,
Ralf
Finally found it: an additional hierarchy in the xml file is needed for the sake of the FCC logic.
<?xml version="1.0" encoding="utf-8" ?>
<PlainFile>
<settings>
<filename>filename.txt</filename>
</settings>
<content>
<line>Line 1</line>
<line>Line 2</line>
...
</content>
</PlainFile>
FCC settings:
RecordSet Structure: settings, content
content.fieldSeparator:'nl'
settings.fieldFixedLengths:0
settings.fixedLengthTooShortHandling:Cut
settings.endSeparator:'0'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Since you want to the filename to be sent in the payload, check out the below Variable Substitution Method. This information is available in help.sap.com.
Advanced Tab Page
Variable Substitution (Target Directory/File Name Scheme)
If you set the Enable indicator, you can enter variables for the Target Directory and File Name Scheme. Enter the names of the variables and references in the table.
● Enter each variable that you reference in the Target Directory and File Name Scheme fields without the surrounding percentage sign under Name of Variables in the table.
The variables can refer to attributes of the message header or elements of the message payload.
○ If the variables are to refer to an attribute of the message header, add the prefix message: to the name of the variable under Reference. You can specify the following attributes of the message header:
sender_party, sender_service, receiver_party, receiver_service, interface_name, interface_namespace,
message_id (message ID with hyphens, for example 9fbe1ff1-9a0d-11d9-8665-cbf10a126331)
message_id_hex (message ID in hexadecimal format, for example 9fbe1ff19a0d11d98665cbf10a126331)
For example, if you want to specify the interface name from the message header in the target directory or in the file name scheme, enter message:interface_name as the reference.
Note
If one of the message attributes contains characters that are not permitted in a file name, for example \, /, :, *, ?, ", <, >, |, then these characters are replaced by an underscore ("_").
○ If the variable refers to an element in XML schema, add the prefix payload: to the information under Reference. The reference then comprises a pseudo path description in the form of a comma-separated list with the schema namea,na,nameb,nb,....
namea,nameb,... corresponds to the element name and na,nb,... corresponds to the occurrence of the element name at the respective level in the document.
The description begins at the root of the document and ends at the respective element.
Example
To reference the element that is in bold in the example, the following expression is used: payload:root,1,e1,1,e2,2
The parser searches for the first occurrence of the root element at the first level. It then searches for the first occurrence of e1 at the second level and for the second occurrence of e2 at the third level. The content of the last element (Example Value) is set as the value for a specified variable.
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<dummy>
<e1>
<e2>Data_1</e2>
<f/>
<g attr="abc">text</g>
<e2>Data_2</e2>
</e1>
</dummy>
<e1>
<e2>illegal/value</e2>
<f/>
<g attr="abc">text</g>
<e2 attr="fghij">Example Value</e2>
</e1>
</root>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ralf,
use:
RecordSet Structure: PlainFile, line, filename
and add:
PlainFile.fieldSeparator:'nl'
line.fieldSeparator:'nl'
filename.fieldFixedLengths:0
filename.fixedLengthTooShortHandling:Cut
This will solve your FCC issue.
Regards,
Rajeev Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.