on 05-23-2011 11:30 AM
Hi Experts,
My outbound interface structure is like below:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:File_Input xmlns:ns0="http:/training/POC">
<NUM1>1</NUM1>
<NUM2>2</NUM2>
</ns0:File_Input>
My inbound interface is like below:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:File_Output xmlns:ns0="http:/training/POC">
<Filename></Filename>
<Output>
<TOTAL>3</TOTAL>
</Output>
</ns0:File_Output>
This is FILE to FILE scenario.
The input (sender or outbound) file is XML. Output file is also XML but I want it to be:
<ns0:File_Output xmlns:ns0="http:/training/POC">
<Output>
<TOTAL>3</TOTAL>
</Output>
</ns0:File_Output>
I don't want the node <Filename> in the output XML file even though the inbound interface structure contains the node <Filename>. The output file name is dynamic and hence I am using the node <Filename>. I am populating this node in message mapping.
I tried File content conversion but it is not generating the file. I gave the following conversion values.
What am I doing wrong?
File_Output.fieldSeparator = nl
Output.fieldSeparator = nl
TOTAL.fieldSeparator = nl
Please help!
Thanks
Gopal
The output file name is dynamic and hence I am using the node <Filename>.
instead of this use dynamic configuration to avoid such issues - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think that the error is in paramaters value:
File_Output.fieldSeparator = 'nl'
Output.fieldSeparator = 'nl'
TOTAL.fieldSeparator = 'nl'
You need to include quotes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi spantaleoni ,
quotes are not required.
Actually file is getting generated but it is plain text. I wanted XML file.
The output file getting generated contains only one line:
input_20110523T104117Z.xmlnl3
Here is the " input_20110523T104117Z.xml" is the file name that I am populating dynamically.
The value "3" in the end is the value of node TOTAL.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:File_Output xmlns:ns0="http://training/POC">
<Filename>input_20110523T104117Z.xml</Filename>
<Output><TOTAL>3</TOTAL>
</Output></ns0:File_Output>
I want XML output file as below:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:File_Output xmlns:ns0="http://training/POC">
<Output><TOTAL>3</TOTAL>
</Output></ns0:File_Output>
What am I doing wrong? Can't we use content conversion to get XML file?
Please help!
Thanks
gopal
Edited by: gopalkrishna baliga on May 23, 2011 12:50 PM
Hello Mr,
For quote: NameA.endSeparator
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 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).
This is from sap help:
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
hi Gopal,
First thing, as Spantaleoni has said, you can not avoid the quotes.
It has been clear in your case itself. That's the reason that you have nl input_20110523T104117Z.xmlnl3 in between your filename "input_20110523T104117Z.xml" and total value "3". Had you put quotes, 3 would have come in the next line itself and there would not be nl explicitly.
As for your actual issue, if it is an xml that you want at the receiver end, why are you using content conversion? As Shabarish has mentioned in his blog, dynamic configuration is always better than variable substition.
You can set the filename dynamically in a udf which is mapped to a mandatory field at the target side.
Write the below code in a udf and map it to a mandatory node at the target end , like "Output" node in your case.
-
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(u201Chttp://sap.com/xi/XI/System/Fileu201D,u201CFileNameu201D);
String MyFileName = a + "_" + b +".xml";
conf.put(key, myFileName);
return "";
-
Regards,
Ninu
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.