on 08-22-2016 8:03 AM
HI All,
I have a requirement that need to pick CSV file from the source(NFS location) and pass to ECC through Proxy.
1) I need a content conversion for reading the CSV file. for looking the .csv file as below.
the file looking as below
and also if I open the file looks like below
and also if open the file with notepad++ looks like below
need to pick this file from NFS location.
2) also I need to exclude the first line which is a header, having the names of the fields and consume from second line onwards.
3) and also the file name to be read and pass to the ECC in a separate field in the target like BR_CSVXXXX
Thanks for your help in advance.
Hi Vinay,
Use the following FCC for creating the xml out of csv
The data type you need to create is this for input source xml
inbound xsd will be
you can use an udf in mapping as shown below. All fields are mapped one to one direct mapping.
the udf
public String fileName(String var1, Container container) throws StreamTransformationException{
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
return conf.get(key);
}
tick ASMA and filename in sender communication channel.
The input csv file
output xml
<?xml version="1.0" encoding="UTF-8"?>
-<ns0:MT_TGT xmlns:ns0="urn:Demo/SCN">-<Header><Details><BANKID>"abc"</BANKID><BANKNAME>xyz</BANKNAME><ACCTID>123</ACCTID><ACCNUMBER>456</ACCNUMBER><ACCTNAME>abc</ACCTNAME><CURRENCY>45</CURRENCY><PROCESSDATE>8112015</PROCESSDATE><VALUEDATE>8122015</VALUEDATE><TRANSACTIONDATE>234</TRANSACTIONDATE><ITEMTYPE>78.67</ITEMTYPE><AMOUNT>hi</AMOUNT><DESC>br</DESC><BRTN>cr</BRTN><BRCR>cr</BRCR></Details>-<Details><BANKID>abc</BANKID><BANKNAME>"xyz"</BANKNAME><ACCTID>123</ACCTID><ACCNUMBER>456</ACCNUMBER><ACCTNAME>abc</ACCTNAME><CURRENCY>45</CURRENCY><PROCESSDATE>8112015</PROCESSDATE><VALUEDATE>8122015</VALUEDATE><TRANSACTIONDATE>234</TRANSACTIONDATE><ITEMTYPE>78.67</ITEMTYPE><AMOUNT>hi</AMOUNT><DESC>br</DESC><BRTN>cr</BRTN><BRCR>cr</BRCR></Details><Filename>t1.csv</Filename></Header></ns0:MT_TGT>
you can remove double quotes in mapping using standard text function replaceString(inputstring,"/"",""); you can see this blog for more details
Message Mapping Replace String - Wiki - SCN Wiki
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinay!
1. Use File Content Conversion to build XML structure from your source .CSV file.
Converting Text Format in the Sender File/FTP Adapter to XML - Advanced Adapter Engine - SAP Library
2. Use FCC "Document offset" property to skip first line in your .CSV file.
3. Use ASMA parameter "File name" in sender file adapter to store file name to Dynamic Configuration and use UDF in message mapping to get file from DC and put to payload.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
string filename=conf.get(key);
return filename;
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.