.csv file Vs .txt file Content conversion sender file channel
Hi Experts,
I have a file with filename say input.csv.I want to do content conversion for these .CSV file.Is it same like we have to do for .txt file say input.txt.
when i open my .csv file in notepad, i get multiple rows with each field separated by ';'.what are the content conversion parameters we have to define for .csv file and can we mention input.csv as the file name as a source file name.
Thanks
Deepak
Hi,
Use the following parameters for Sender file channel in case of reading .csv file
Recordset Structure.fieldSeparator -
Recordset Structure.endSeparator -
'nl'
Recordset Structure.fieldNames -
provide field names separated with ,
Regards
Seshagiri
Similar Messages
-
File Content Conversion - Sender File Adapter - Record Delimeter ~
The inbound file has file has ~ as record delimeter. I am using the FCC at sender file adapter to covert this file into XML. Somehow, the file adapter is not able to interpret "~" as my record delimeter even thoough I specified "record.endSeparator = ~" in FCC.
Would someone help me with a solution?Raju,
You can also try to use the '0x7E' as endSeperator condition.
I am not sure if the HTML tag will work but this should do the trick. This should be the HEX corresponding entry
char description hex char code html
" ~ " "Tilde" "0x7e" "~" &!tilde; (without !)
greets.
in adition to this see SAP help
http://help.sap.com/saphelp_nwpi71/helpdata/en/44/655453b48a4ddfe10000000a1553f7/frameset.htm
Special Characters in Strings for Separators
In all strings for separators (NameA.fieldSeparator, NameA.beginSeparator, NameA.endSeparator), you can specify non-printable ASCII characters. These characters can each be inserted individually in the strings in the form ´0xHH´ (including the quotation marks), where HH represents the character encoded as a hexadecimal value.
Please also ensure that the "recordSet Structure" also need to be configured Correctly
for example:
Header,1,Detail,*
Header.fieldSeperator --> %parameter%
Detail.fieldSeperator --> %parameter%
Detail.endSeparator --> '0x7e'
Greets -
File content conversion sender adapter
Hi Friends,
I am doing File to IDoc scenario.
I am using File Content Conversion for File Adapter.
My structure look like this
MT_File
HEADER1 1..1
--header1
-- header2
HEADER2 1..1
--header3
DETAILS 1..unbounded
--details1
--details2
--details3
TRAILER1 1..1
-- trailer1
TRAILER2 1..1
-- trailer2
----trailer3
In File Content conversion parameeters..
Document Name :MT_File
Document Namespace :urn:test:FileFcctoIdoc
RecordSet name :
RecordsetStructure :HEADER1,1,HEADER2,1,DETAILS,*,TRAILER1,1,TRAILER2,1
RecordSet Structure: Ascending
RecordSet Per message : *
Key Field Name :header1,header3,details1,trailer1,trailer3
ignoreRecordsetName : true
HEADER1.fieldNames :header1,header2
HEADER1.keyFieldValue : H1
HEADER1.fieldFixedLengths :5,10
HEADER1.endSeparator :'nl'
HEADER2.fieldNames :header3
HEADER2.keyFieldValue : *D
HEADER2.fieldFixedLengths :5
HEADER2.endSeparator :'nl'
DETAILS.fieldNames :details1,details2,details3
DETAILS.keyFieldValue : 3
DETAILS.fieldFixedLengths :5,5,5
DETAILS.endSeparator :'nl'
TRAILER1.fieldNames :trailer1
TRAILER1.keyFieldValue : *S
TRAILER1.fieldFixedLengths :5
TRAILER1.endSeparator :'nl'
TRAILER2.fieldNames :trailer2,trailer3
TRAILER2.keyFieldValue :SE TRAILER2.fieldFixedLengths :5,5
TRAILER2.endSeparator :'nl'
File is :
H1hh1hhhhhhhhh2
*Ddd*
Xddd1dddd2dddd3
Xddd4dddd5dddd6
Xddd7dddd8dddd9
*Sss*
SEKss2
in RWB, Channel CC_FILE_Sender_FccDemo: Empty document found. Proceed without sending message
I think the problem is in FCC paramters..
Could please have a look and correct me
Regards
RamRam,
The problem which i can see is your key field values in your test file. Remember you should have the key field value in each new line at the same place.
For example you have given your text file as shown below...
File Given By You is :
>H1hh1hhhhhhhhh2
>*Ddd *
>Xddd1dddd2dddd3
>Xddd4dddd5dddd6
>Xddd7dddd8dddd9
>*Sss *
>SEKss2
Compair the above file with the below one..
>H1hh1hhhhhhhhh2
>*Ddd *
>Xddd1dddd2dddd3
>Xddd4dddd5dddd3
>Xddd7dddd8dddd3
> *Sss *
>SEKss2
If you notice, for details I have given key field value 3 in each line & at same place.
One more thing just use the KeyFieldName only one ( just follow the same blog which I have given, to understand how to use the KeyFieldName )
e.g.
Document Name :MT_File
Document Namespace :urn:test:FileFcctoIdoc
RecordSet name :
RecordsetStructure :HEADER1,1,HEADER2,1,DETAILS,*,TRAILER1,1,TRAILER2,1
RecordSet Structure: Ascending
RecordSet Per message : *
Key Field Name : KF
Regards,
Sarvesh -
Blogs for File content conversion in File Adapter
hi all,
Can some one give me the links for File Content Conversion for File to File Scenario. please.
Thanks in advance.Hi
For Sender
/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
/people/sap.user72/blog/2005/01/06/how-to-process-csv-data-with-xi-file-adapter
/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
SAP Help for sender
http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
For Receiver:
/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
SAP Help for receiver
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm -
File content conversion:move files to a new directory
hi all,
I have a file content conversion sender and receiver scenario.Now my doubt is: XI is running on sap27 server.Input file is being created by an ABAP program in r/3 and file being put in sap29 server.
In source directory if i am giving the sap29 path it is not working.Is there any way that i can write a OS command to move files from 29 to 27 before message processing ??
Any other option available??
thanks,
Nisheetahi,
Yes the basis people have shared the folder and they have mapped the sap29 folder into sap27 using I:\ drive
But the files are not getting picked....am i giving the source directory wrong??
I am giving I:\Folder_Name
suggestions needed
thanks,
Nisheeta -
Problem with reciver file adapter in the content conversion.
I have starnge situation where the fileds in the file created after the content conversion are center aligned.
Can someone let me know how to make it right aligned?
For eg, i have a field with Char(6) in the file it looks as follows:
1.23 -> | 1.23 |
10.23 -> |10.23 |
100.23-> |100.23|
I want it to be like this :
1.23 -> | 1.23|
10.23 -> | 10.23|
100.23-> |100.23|
Please let me know ASAP as its a critical issue for the customer.
Warm Regards,
Nilesh KumarHi Nilesh,
if You are using file content conversion on Sender Adapter, then do you java mapping between your two interfaces(sender and receiver)
use java.text methods for formatting the values according to your requirement.
first check the java API 1.4.2....
with in that check java.text.* methods
Also there will be lot of examples availble on internet on this. Check online.
Also check this link this will definitely solve issue
[http://www.iro.umontreal.ca/~vaucher/Java/tutorials/Formatting.html]
Sample code on this link
double x = 1.0 / 7;
for (int n = 1; n<5; n++)
System.out.println( "1/7 : " + format( x, n, -6)
+ format( x, n, 10));
Thanks
Gujjeti
Edited by: Praveen Gujjeti on Apr 16, 2008 6:16 AM -
Content Conversion in File Receiver Adapter
Hi,
I am doing a Content Conversion in File Receiver Adapter.
Input to the Adapter is:
<ns1:FileResponse_MT xmlns:ns1="http://www.bpmtest.com/bpm">
<OrderID>123</OrderID>
<Quantity>98</Quantity>
<Price>76.23</Price>
</ns1:FileResponse_MT>
Desired output is: <b>OrderID# Quantity# Price (123#98#76.23)</b>
I tried to accomplish this with different settings in Recordset Structure and Conversion Parameters but could not achieve it, every time an empty file is produced.
Would appreciate any help on this.
Best Regards,Hi,
Enclose your structure with a parent element like this.
<ns1:FileResponse_MT xmlns:ns1="http://www.bpmtest.com/bpm">
<parent>
<OrderID>123</OrderID>
<Quantity>98</Quantity>
<Price>76.23</Price>
</parent>
</ns1:FileResponse_MT>
Then give the parameters, it will work.
parent.fieldSeparator = '#'
parent.endSeparator = 'nl'
Regards,
P.Venkat -
Query regarding file content conversion using file adapter
Hi All
I have a question regarding file content conversion in file adapter.
I have a file coming in the following format.
AA,111,222,333
BB,444,555,666
CC,777,888,999
My incoming message structure has a hierarchy. The CC record is a structure part of BB record. BB record is a structure part of AA record. It is like this:
AA,111,222,333
<<BB,444,555,666>>
<<<<CC,777,888,999>>>>
After file content conversion, in the resulted xml, i am getting a flat hierarchy instead of nested hierarchy.
Is it possible to get a nested hierarchy as a result of file content conversion?
Please let me know
Thanks
ChandraHi Udo
According to your suggestion, I am trying to use mapping.
I am getting a flat file and i am reading it.
This is my source structure:
AA,11,22,33
BB,44,55,66
CC,77,88,99
This is my required targer structure:
AA,11,22,33
<<BB,44,55,66>>
<<<<CC,77,88,99>>>>
To explain this, BB record can have multiple records of CC records.
AA records can have multiple records of BB record.
I am using removecontext node function.
CC (Source) (removecontext)-> CC (target structure)
But here, when i rightclick on source CC field in the mapping editor, i cannot see any other context except root node. So, how can i proceed here??
Many Thanks
Chandra -
How to create a file and store its contents into another file?
Hi,
I'm having some trouble trying to create a code where I have to to create a file and store its contents into another file?
I read the API, but I'm not certain how this file thing works.
Here's my code so far:
public static void main(String[] args) throws Exception
File file = new File("tasks.txt");
if (file.exists())
System.out.println("File already exists");
System.exit(0);
Scanner scan = new Scanner(System.in);
Scanner scan2 = new Scanner(System.in);
//Scans the input line by line
scan.useDelimiter("\\n");
//Scans the input by tabs
scan2.useDelimiter("\\t");
PrintWriter outputs = new PrintWriter("newtasks.txt");
outputs.print("ok");
outputs.println(3);
outputs.close();
}I managed to change my text into uppercase, but how do I store the uppercase content into another file.
-So this is what I did so far, I took a text file and modified its strings to uppercase.
-Now I need to put those modified strings into another text file, is there a way where I can do that with my current code?
-I already tried printwriter, but it doesn't seem to work
public static void main(String[] args)throws IOException
//Task[] oneHundredTasks = new Task[100];
String uppercase;
String combine;
Scanner scan = null;
FileInputStream in = null;
FileOutputStream out = null;
PrintWriter output = null;
try
scan = new Scanner(new BufferedReader(new FileReader("tasks.txt")));
scan.useDelimiter("\\n");
scan.useDelimiter("\\t");
while (scan.hasNext())
if(!scan.hasNext())
scan.next();
combine = scan.next();
uppercase = combine.toUpperCase();
System.out.println(uppercase);
finally
if (scan != null)
scan.close();
//The program will try the input and output files
try
in = new FileInputStream("tasks.txt");
out = new FileOutputStream("newtasks.txt");
int c;
//The number "-1" is used to indicate that it has reached the end of the stream.
while ((c = in.read()) != -1)
out.write(c);
finally
if (in != null)
in.close();
if (out != null)
out.close();
} -
Content Conversion in receiver channel
Hi all,
I have a proxy to FTP scenario with no mapping involved.Over proxy communication PI is receiving the data, I am creating the CSV file using content conversion in receiver channel and placing the file at FTP.
The file name is coming in one of the field of the input xml,I am using variable substitution and setting the file name from that particular field value.But as I don't want that node and file name element in my output file content, please guide me what parameters can I set in my content conversion to remove the FileNode from o/p csv file.
The sample input xml is
<MT>
<Record>
<Field1>1</Filed1>
<Field2>2</Filed2>
</Record>
<Record>
<Field1>3</Filed1>
<Field2>4</Filed2>
</Record>
<FileNode>
<FileName>InutFile</FileName>
</FileNode>
</MT>
I want output xml to be like
1,2
3,4
I have followed this blog /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12 to cut the FileNode, but it gives an error in cc parameters.
In my actual i/p payload,the Record is 0..unbounded and there are 50 sub elements inside Record element.
Please provide your inputs.
Thanks,
RuchiHi Ruchi,
Change your structure like this.
MT>
<Record>
<Field1>1</Filed1>
<Field2>2</Filed2>
</Record>
<Record>
<Field1>3</Filed1>
<Field2>4</Filed2>
</Record>
<FileNode>
<FileName>InutFile</FileName>
</FileNode>
</MT>
Dont put the filenode under Record.
Also Add the below parameters.
FileNode.fieldSeparator '0'
FileNode.endSeparator '0'
FileNode.fieldFixedLengths 0
FileNode.fixedLengthTooShortHandling Cut
FileNode.fieldNames FileName
Now use the same parameter mentioned in the blog .Your problem will be resolved. -
Strange Problem with File Content Conversion (Sender)
Hi,
I have a strange problem. I have a sender file adapter with content conversion (csv -> xml). The adapter produces the following error during the processing...
- 2006-02-06 16:34:00 CET: Error: Conversion of part of file content of 'OE_Extractor_47_ISW112_SC-Ireland.csv' to XML format failed around position 1202: IOException: Stream closed
After the 4th or 5th try the adapter processes the file correctly.
Why does it works after several tries and not at the first time? (The file is not changed during the adapter is trying to convert it)
Thanks
ThomasI found the problem, something was wrong with the ftp server
-
File Content Conversion : Sender Channel
Hi
I am trying to do content conversion in the Sender Channel from a flat file to a XML.
My Target XML(message structure) looks like
<H1>
<H2>
<D>Detail Record</D>
<L1>line</L1>
<L1>line</L1>
</H2>
<H2>
<D>Detail Record</D>
<L1>line</L1>
<L1>line</L1>
</H2>
</H1>
Here the element <H2> is only needed to group <D> and the following <L1> elements of each new occurrence of <D>.
Now my problem is that the element <H2> is not getting created.
and the message after content conversion is looking as follows
<H1>
<D>Detail Record</D>
<L1>line</L1>
<L1>line</L1>
<D>Detail Record</D>
<L1>line</L1>
<L1>line</L1>
</H1>
What should I do to get the desired result.@Yes Bhavesh you are right.
Hi Jai,
I am trying the other way round.i.e from flat file to a XML message.As I said I was trying to do it for Sender Channel where is the after content conversion I want a XML file.The example is a what I framed out of my actual problem.
if flat file is as follows ,
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DetailRecord1
Line1
Line2
Line3
DetailRecord2
Line4
Line5
then the XML must look like
<H1>
<H2>
<D>DetailRecord1</D>
<L1>Line1</L1>
<L1>Line2</L1>
<L1>Line3</L1>
</H2>
<H2>
<D>DetailRecord2</D>
<L1>Line4</L1>
<L1>Line5</L1>
</H2>
</H1>
I identify the different types records in the flat file
as follows,
Record starting with "Detail" is considered as <D> element
Record starting with "Line" is considered as <L> element.
Hope I did clarify. -
File content conversion - sender adapter for Header and detail records
Hi Experts,
I am receiving a field of fixed length content format.(Header)The first line of the file will follow the structure X having some fields and (DetailRecord)subsequent lines in the file will follow structure Y having somes fields.There is no record identifier for Header and Detail records.In one file first line is Header records and remaining subsequent line is DetailRecord.What are the parameters we have to set for sender file content conversion parameters as i donot have any key field and key field value.And in one file we have only one header records ( first line) and n number of detail records from 2nd line onwards.
Thanks
DeepakHi
Refer the below fourm link,
Flat file whitout id
Regards
Ramg. -
File Content Conversion Sender. Enclosured info
Hi experts,
I have to read a plain file like this:
x
x
x
x
x
<START-OF-FILE>
a;b;c;d;
a;b;c;d;
a;b;c;d;
<END-OF-FILE>
x
x
x
x
x
Where 'x' means unuseful and unformatted lines, and 'a','b','c','d' are the fields to be parsed to xml.
I wonder whether there is a way, using FCC in the file sender adapter, to gather only the lines enclosured between '<START-OF-FILE>' and '<END-OF-FILE>'. There is no key field I can use.
Many thanks in advance,
PacoHi Francisco,
I think u need to write a UDF to achieve the requirement.
And, I think there is a possibility to do it using content conversion.
Use set NameA.fieldFixedLengths for the unused data in the file.
use NameA.fieldContentFormatting - Enter trim to remove all the leading and subsequent blanks for a value found. This is the default.
If there is any field length restriction use NameA.fieldFixedLengths.
NameA.fieldSeparator & NameA.endSeparator shoulf be used.
NameA.additionalLastFields
If the inbound structure has more fields than specified in the configuration then the XML outbound structure is created as follows:
○ ignore
Outbound structure only contains the fields in the inbound structure
○ error
Conversion is terminated due to the incomplete inbound structure. An error message is displayed.
The default value is ignore. If you have defined the NameA.fieldFixedLengths parameter, the default value is error.
I hope this info will help you.
Refer the below link:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
Regards, -
File Content Conversion: Sender Problem
Hi,
I'm getting a very typical error in my Sender Communciation channel.
Channel CC_FILE_SENDER_2: Empty document found. Proceed without sending message
I've gone through a few threads and I know that the problem is with the Key Field and using * in the Recordset Structure but I cannot solve it. If I use * in the Recordset structure it fails,when I use a specific number it works. Any ideas
Here is my Communication Channel details
Document Name: MT_SENDER
Document namespace: http:\\sender
Recordset Structure: FileHeaderRecord1,1,FileHeaderRecord2,1,FileHeaderRecord3,1,FileDetailRecord,*,FileTrailerRecord1,1
Recordset Sequence: Ascending
Key Field Name: RType
And the configuration:
FileHeaderRecord1.fieldNames: RType,Filler,Code,Filler2
FileHeaderRecord1.fieldFixedLengths: 10,31,6,69
FileHeaderRecord1.keyFieldValue: V
FileHeaderRecord2.fieldNames: RType,Filler
FileHeaderRecord2.fieldFixedLengths: 3,113
FileHeaderRecord2.keyFieldValue: HDR1
FileHeaderRecord2.fieldNames: RType,Filler,Date,File,Filler2,Num,Filler3
FileHeaderRecord3.fieldFixedLengths: 3,2,5,6,21,3,76
FileHeaderRecord3.keyFieldValue: UH1
FileDetailRecord.fieldNames: RType,Filler,TCode,Filler1,Amount,Filler2,ZGC,Filler3,Date,Filler4
FileDetailRecord.fieldFixedLengths: 14,1,2,18,11,18,9,28,5,10
FileDetailRecord.keyFieldValue: 9
FileTrailerRecord1.fieldNames: RType,Filler,TCode,Filler1,Date
FileTrailerRecord1.fieldFixedLengths: 14,1,2,12,5
FileTrailerRecord1.keyFieldValue: UT1
ignoreRecordsetName: true
This is a copy of my file....
VPR456SCL1 852086
HDR1 SED456RD 345344500428 F 04 094520428 BS 09452
UHL1 09452ESBCL1 00000000 004
85208681123787085 000000000000500FREW RTYU POSWS123704375 09452
85208681123787085 000000000000600FREW RTYU POSWS123705307 09452
85208681123787085 000000000000600FREW RTYU POSWS123705671 09452Hi,
problem is in your keyfield value,
FileHeaderRecord1.fieldNames: RType,Filler,Code,Filler2
FileHeaderRecord1.fieldFixedLengths: 10,31,6,69
FileHeaderRecord1.keyFieldValue: V
keyfield name is RType and it is given a fixedlength of 10 characters, but your keyfieldvalue is "V
" which is not 10 char long that is the reason your adapter is failing to pick it.
same for all the other recordsets, the fieldvalue shd match the fixed length given.
Eg:- give keyfieldvalue like this "V ". it will work.
Maybe you are looking for
-
Help: the header and footer in the dreamweaver are doubled
http://coolsite04.businesscatalyst.com/ this is my site how can i fix it. i'm using the basic template
-
TS2776 How can I transfer e-mail contacts from one IPad to another?
How can I transfer e-mail contacts from one IPad to another?
-
Upon computer start up I receive message: procedure entry point split3_wal_checkpoint could not be located in the cynamic link library SQLite3.dll. Apple Sync Notifier.exe Entry Point not found. Anyone have solution?
-
Hi Experts, What is early watch report? Who creates it and what is its purpose? Thanks. SM
-
Roblem with the Spot Healing Brush Tool in CS5
I have a problem with the Spot Healing Brush Tool in CS5. When opening a number of files to work on them the Spot Healing Brush works initially fine and without any problems. After a few files the Spot Healing Brush doesn't work any longer, even I di