Read .csv file to XI and convert to IDOC
Hi XI Gurus,
We have a requirement at work where we need to import .csv files to XI ehich then XI converts it to xml and posts an IDOC to SAP. I have tried creating this in XI with File Adapter with File Content Conversion.
I gave all the things required for File Content Conversion but still my .csv file is not being picked up and read by XI. Iam not sure why this is happening but can anayone please help me with this.
Also please do let me know if anyone has a tutorial related to this scenario.
Thanks,
Mayuresh.
Hi All,
I tried checking the error via Run Time Workbench (RWB) and going to Communication Channel Monitoring. It shows that there are some errors in the Communication Channel but when i go inside it does not open an error window for me containing the error details.
Just wanted to explain my file structure and the settings i have done in the 'File Content Conversion' of the 'File Adapter' so that you guys can tell me where i am wrong:
Message Type: VENDOR_MT
VENDOR_MT
VendorNumber
LastName
SearchTerm
Currency
Address
Street
City
Zip
Country
I am using IDOC receiver at the other end (CREMAS.CREMAS03).
CSV File Structure: (Sample)
34567, Reed, Jon, AUD, Smith Street, Melbourne, 3066, AU
The settings that i have used in the File Adapter (Content Conversion tab) are:
RecordSet Structure: VendorNumber, LastName, SearchTerm, Currency, Street, City, Zip, Country
RecordSet Sequence: Ascending
ignoreRecordSetName: true
Vendor_MT.fieldNames: VendorNumber, LastName, SearchTerm, Currency
Vendor_MT.keyFieldValue: 01
Vendor_MT.fieldSeperator: ','
Vendor_MT.endSeperator: nl
Address.fieldNames: Street, City, Zip, Country
Address.keyFieldValue: 02
Address.fieldSeperator: ','
Address.endSeperator: nl
Please do let me know if the communicatioon channel settings i have made are correct. Also let me know if i am missing some major setting.
Thanks,
Mayuresh.
Similar Messages
-
Reading Flat File in Inbound and Converting it to a Idoc
Hi
We are stuck with a situation where in we get a ASN file from Mainframe to XI . XI just reroutes it to SAP and puts the file on Application server. Now R/3 has to read that ASN File and has to split it according to the Invoices and create Idocs for PO's as per the invoice Numbers. (We have a program which splits the incoming file into different Files depending on the Invoices)
Now My doubt here is how can i get a Idoc triggered after the File has been read and split in the R/3.
I checked Transaction WE16 , Prog. RSEINB00 but couldnt get a understanding .
Please suggest.
regards
Vikas ChaudharyHi Shiva,
Thanks for a response .
But as per my Functional Consultant ; PI's Role should be limited only to reroute the file and store it on Application Server .
R/3 Picks up that file and then splits it based on the Invoice Number; and again stores it in the application server.
Then R/3 Should Pick it up again one by one and convert to Idocs .
ASN to be splitted into Diff. Invoices . Once Splitted. Each Invoice Creates a PO . Once a PO is created Goods Reciept should be done. And after the Goods Reciept is done Service Entry Sheet needs to be created too.
A Query Again : I donn think this can be done via One Message Type. I am also lookin out for using one msg. type for creating a PO and other activities can be done by extending a existing msg. type.
Regards
Vikas Chaudhary -
Using Lightroom 4 w/ Windows 7. Recently started shooting w/ Sony camera that shoots .arw files. Lightroom cannot read the files. Loaded Adobe converter program onto the computer and this program cannot read the files either. Any suggestions?
Thnx again for the reply. The version of Lightroom I have is 4.0 (working w/Windows 7) This computer and all media files are kept off-line After doing more research, I downloaded DNG Converter 7.1This loaded into a .zip folder, which I am planning to install into the off-line computer andrun. Where does this folder go?
And will this set up work with my version of Lightroom?
What a pain. Makes me wanna go back to shooting .nef files for all stills
Thnx -
Question about reading csv file into internal table
Some one (thanks those nice guys!) in this forum have suggested me to use FM KCD_CSV_FILE_TO_INTERN_CONVERT to read csv file into internal table. However, it can be used to read a local file only.
I would like to ask how can I read a CSV file into internal table from files in application server?
I can't simply use SPLIT as there may be comma in the content. e.g.
"abc","aaa,ab",10,"bbc"
My expected output:
abc
aaa,ab
10
bbb
Thanks again for your help.Hi Gundam,
Try this code. I have made a custom parser to read the details in the record and split them accordingly. I have also tested them with your provided test cases and it work fine.
OPEN DATASET dsn FOR input IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET dsn INTO record.
PERFORM parser USING record.
ENDDO.
*DATA str(32) VALUE '"abc",10,"aaa,ab","bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"bbc"'.
*DATA str(32) VALUE '"a,bc","aaaab",10,"bbc"'.
*DATA str(32) VALUE '"abc","aaa,ab",10,"b,bc"'.
*DATA str(32) VALUE '"abc","aaaab",10,"bbc"'.
FORM parser USING str.
DATA field(12).
DATA field1(12).
DATA field2(12).
DATA field3(12).
DATA field4(12).
DATA cnt TYPE i.
DATA len TYPE i.
DATA temp TYPE i.
DATA start TYPE i.
DATA quote TYPE i.
DATA rec_cnt TYPE i.
len = strlen( str ).
cnt = 0.
temp = 0.
rec_cnt = 0.
DO.
* Start at the beginning
IF start EQ 0.
"string just ENDED start new one.
start = 1.
quote = 0.
CLEAR field.
ENDIF.
IF str+cnt(1) EQ '"'. "Check for qoutes
"CHECK IF quotes is already set
IF quote = 1.
"Already quotes set
"Start new field
start = 0.
quote = 0.
CONCATENATE field '"' INTO field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
CONDENSE field.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
* WRITE field.
ELSE.
"This is the start of quotes
quote = 1.
ENDIF.
ENDIF.
IF str+cnt(1) EQ ','. "Check end of field
IF quote EQ 0. "This is not inside quote end of field
start = 0.
quote = 0.
CONDENSE field.
* WRITE field.
IF field IS NOT INITIAL.
rec_cnt = rec_cnt + 1.
IF rec_cnt EQ 1.
field1 = field.
ELSEIF rec_cnt EQ 2.
field2 = field.
ELSEIF rec_cnt EQ 3.
field3 = field.
ELSEIF rec_cnt EQ 4.
field4 = field.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CONCATENATE field str+cnt(1) INTO field.
cnt = cnt + 1.
IF cnt GE len.
EXIT.
ENDIF.
ENDDO.
WRITE: field1, field2, field3, field4.
ENDFORM.
Regards,
Wenceslaus. -
Use servlet read .csv file by ie, but why two more " ?
Hi , friends
following is the key method in my servlet used to read .csv file to ie , but , after I read file to client side , I found that in the both sides of every line " was added, so the csv file can have only one column (many columns was merged into one column), that was not what i want, who guys can find some idea? thanks for your enthusiasm!
void serveRemoteFile(String sFileName, String sContentType, HttpServletRequest req, HttpServletResponse res, StringBuffer sbLog, Runtime rt){
FileInputStream in = null;
ServletOutputStream out = null;
byte bBuf[] = null;
int nLen;
if (isBlank(sContentType) || isBlank(sFileName))
return;
res.setStatus(res.SC_OK);
res.setContentType(sContentType);
res.setHeader("Content-Disposition", "inline;filename= temp.csv");
try {
in = new FileInputStream(sFileName);
out = res.getOutputStream();
bBuf = new byte[1024];
while ( (nLen = in.read(bBuf,0,1024)) != -1) {
out.write(bBuf, 0, nLen);
out.flush();
out.close();
}catch (FileNotFoundException e){
errorPage(req,res,sbLog);
}catch (IOException e){
errorPage(req,res,sbLog);Excel uses a weird CSV file format. You can find more information about it and a Java library to read data from it here:
http://ostermiller.org/utils/ExcelCSV.html -
Hi,
In one of my application, I need to read CSV file as a database and read the columns from the CSV file. Can I get any drivers which accepts CSV file as a datasource and I can query on that datasource?
I know this will work in Windows.. But I am working on UNIX and need drivers to be installed on Unix.
Does any one knows how to do it or if they can provide any links, That is of very helpful for me..
Please help me in resolving this problem..Hi
You need to use a JDBC driver of Type 3 to do your task.
Swaraj -
Read from file, compare string and return a part
Hello, is there a reasonable good way to read text file containing information, and if string comparison is successfull, return a nother part of the string.
What i have done so far:
set file_name to (path to desktop as text) & "filename.txt"
set F to open for access tiedosto with write permission
set file_information to (read F)
close access F
(i will be moving this to Application Support/Appname/ when i figure it out).
The data in the file is in following format
12234567890Name1
98765432123Name2
92347928347Name3
What im stuck now is:
I need to compare each line the 10 numbers with search string, if match is found, the name part should be returned.
Any idea's?You already read in the text file, so you need to put the data thru a repeat loop:
repeat with name_part in paragraphs of file_information
-- ((character 1 thru 10 of name_part) as string) is the first 10 digits of name part
if ((character 1 thru 10 of name_part) as string) is search_string then return name_part
end -
File Adapter - Reading 2 files from sender and one file to receiver
All - I am looking for a best solution for reading two files from sender and generating one file to the receiver.
Here is the scenario
Sender file s - A is a master file. B is a detail file; B will have a one to many records for each record of File A.. that is the relation ship between 2 files.. I am looking for a better solution to
Example
Input:
File A will have a record like "summary1 ABC 1234"
File B will have a record like "Detailfor Summary1 CDF 8679"
Output:
File C shall have a record "consolidatedofSummary&Detail ABC 1234 8679"
1) read records of master row and detail row from these 2 files
2) do the mapping to the receiver output format which it is creating for records with some harcoded values and based on the values from master and detail rows of sender file
if I can accomblish reading sender files and do the mapping to the receiver , assume that mapping to the receiver format would not be cumbersome.
please help me...
ThanksHi Gopal,
Ur approach to the interface is perfect.... Go ahead.
For selecting multiple files in source use Advanced Selection for files.. and specify the directory paths and also the file name shema...
This will fetch the 2 files into the integration engine... then u map the 2 source files to one target file(2:1 mapping).
Specify accordingly the receiver side FCC and test it end to end...
If u face any prblm post here... some1 will help u out..
Babu -
How can we a validate a CSV file in SSIS and log the error details in another CSV File by using Sript Task.
Please see:
http://www.bidn.com/blogs/DevinKnight/ssis/76/does-file-exist-check-in-ssis
http://social.msdn.microsoft.com/Forums/en-US/01ce7e4b-5a33-454b-8056-d48341da5eb2/vb-script-to-write-variables-to-text-file -
Read a Word/Excel doc and convert to PDF
Can any one suggest a way or source to read a word/excel document and convert it to an PDF.. using Java
Thanks,
SatyaParse the Excel document with the Apache POI API and generate a PDF document with the Apache FOP API.
-
SQL server 2014 and VS 2013 - Dataflow task, read CSV file and insert data to SQL table
Hello everyone,
I was assigned a work item wherein, I've a dataflow task on For Each Loop container at control flow of SSIS package. This For Each Loop container reads the CSV files from the specified location one by one, and populates a variable with current
file name. Note, the tables where I would like to push the data from each CSV file are also having the same names as CSV file names.
On the dataflow task, I've Flat File component as a source, this component uses the above variable to read the data of a particular file. Now, here my question comes, how can I move the data to destination, SQL table, using the same variable name?
I've tried to setup the OLE DB destination component dynamically but it executes well only for first time. It does not change the mappings as per the columns of the second CSV file. There're around 50 CSV files, each has different set off columns
in it. These files needs to be migrated to SQL tables using the optimum way.
Does anybody know which is the best way to setup the Dataflow task for this requirement?
Also, I cannot use Bulk insert task here as we would like to keep a log of corrupted rows.
Any help would be much appreciated. It's very urgent.
Thanks, <b>Ankit Shah</b> <hr> Inkey Solutions, India. <hr> Microsoft Certified Business Management Solutions Professionals <hr> http://ankit.inkeysolutions.comThe standard Data Flow Task supports only static metadata defined during design time. I would recommend you check the commercial COZYROC
Data Flow Task Plus. It is an extension of the standard Data Flow Task and it supports dynamic metadata at runtime. You can process all your input CSV files using a single Data Flow Task
Plus. No programming skills are required.
SSIS Tasks Components Scripts Services | http://www.cozyroc.com/ -
Hi.
I have a .csv file on my filesystem.
Could you post few code to read it from filesystem and parse every rows in it?
Thanks a lot.External tables are far easier to use... e.g.
I have a file on my server in a folder c:\mydata called test.txt which is a comma seperated file...
1,"Fred",200
2,"Bob",300
3,"Jim",50As sys user:
CREATE OR REPLACE DIRECTORY TEST_DIR AS "c:\mydata";
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser;Note: creates a directory object, pointing to a directory on the server and must exist on the server (it doesn't create the physical directory).
As myuser:
SQL> CREATE TABLE ext_test
2 (id NUMBER,
3 empname VARCHAR2(20),
4 rate NUMBER)
5 ORGANIZATION EXTERNAL
6 (TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY TEST_DIR
8 ACCESS PARAMETERS
9 (RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ","
11 OPTIONALLY ENCLOSED BY '"'
12 (id,
13 empname,
14 rate
15 )
16 )
17 LOCATION ('test.txt')
18 );
Table created.
SQL> select * from ext_test;
ID EMPNAME RATE
1 Fred 200
2 Bob 300
3 Jim 50
SQL>
{code}
http://www.morganslibrary.org/reference/externaltab.html -
Read .csv File and Update DB
I have a .csv file with about 11 columns and multiple rows.
I need to read this file and from each row extract the first
4 columns and update my local database.
If the value if 1st column (unique#) is already in DB do an
Update else do an Insert.
How do I read this .csv file and accomplish this goal?You read the file with <cffile>
It then becomes nested lists. For the outer list, your
delimiter is chr(10). Each list item is a row from your file. For
your inner list, the delimiter is a comma.
That should get you started. Details list functions and
<cffile> are in the cfml reference manual. If you don't have
one, the internet does. -
// Code Help need .. in Reading CSV file and display the Output.
Hi All,
I am a new Bee in code and started learning code, I have stared with Console application and need your advice and suggestion.
I want to write a code which read the input from the CSV file and display the output in console application combination of first name and lastname append with the name of the collage in village
The example of CSV file is
Firstname,LastName
Happy,Coding
Learn,C#
I want to display the output as
HappyCodingXYZCollage
LearnC#XYXCollage
The below is the code I have tried so far.
// .Reading a CSV
var reader = new StreamReader(File.OpenRead(@"D:\Users\RajaVill\Desktop\C#\input.csv"));
List<string> listA = new List<string>();
while (!reader.EndOfStream)
var line = reader.ReadLine();
string[] values = line.Split(',');
listA.Add(values[0]);
listA.Add(values[1]);
listA.Add(values[2]);
// listB.Add(values[1]);
foreach (string str in listA)
//StreamWriter writer = new StreamWriter(File.OpenWrite(@"D:\\suman.txt"));
Console.WriteLine("the value is {0}", str);
Console.ReadLine();
Kindly advice and let me know, How to read the column header of the CSV file. so I can apply my logic the display combination of firstname,lastname and name of the collage
Best Regards,
Raja Village Sync
Beginer CoderVery simple example:
var column1 = new List<string>();
var column2 = new List<string>();
using (var rd = new StreamReader("filename.csv"))
while (!rd.EndOfStream)
var splits = rd.ReadLine().Split(';');
column1.Add(splits[0]);
column2.Add(splits[1]);
// print column1
Console.WriteLine("Column 1:");
foreach (var element in column1)
Console.WriteLine(element);
// print column2
Console.WriteLine("Column 2:");
foreach (var element in column2)
Console.WriteLine(element);
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP] -
Powershell read CSV file line by line and only first header
I have a CSV file, which reads like this:
read, book
read1, book1
read2, book2
I want to read only the first value, before comma one line at time,
meaning first time it will be
read
read1
read2
no headers and i want to pass that value to a variable for a if condition.
I have script it read line by line but it reads both values before coma and after line by line, so instead of having three values i'm ending with 6 values.
$file = Import-CSV c:\script\server.csv
$file | ForEach-Object {
foreach ($property in $_.PSObject.Properties)
$property.Name
$property.Value
#replace = $property.ValueIf you can work with headers then do so as it will make your life easier.
with a csv file called server.csv like this:
headername1, headername2
read, book
read1, book1,
read2, book2
and this bit of code
$file = Import-CSV c:\script\server.csv
#output to host, file or directly pipe the command above.
foreach($cell in $file.headername1){ if($cell -eq $something){ }}
will evaluate the content of each cell to $something.
This is because Powershell will grab the first row and claim that as a header name.
So whatever you put in cell A1 in excell will end up as name of the first collumn and its corresponding property (e.g. $file.A1 oor $file.headername1 if you will).
Maybe you are looking for
-
Okay. I'm brand spankin new to OSX Server. I can't seem to figure out how to host a website from my computer. Can anyone help me?
-
select code.code_combination_id CCIDs, code.segment1||'*'|| code.segment2||'*'|| code.segment3||'*'|| code.segment4||'*'|| code.segment5 Segments from ( select cc.CODE_COMBINATION_ID from gl_je_headers jh, gl_je_lines jl, gl_code_combinations cc, (se
-
PLD: how to do subtotalX - subtotalY ????
Hi all, Nobody knows how can i do aritmetic operation between the subtotalX of the subsortX and the subtotalY of the subsortY? Something like that: INCOME(subsortgroup1) 1 ghghghg 333.333 2 frfrfrfrfrfrfr 444.444 <b>subtotal1 777.777</b> EXPENSES(s
-
To execute an external process in java we use Process P = Runtime.getRuntime().exec(String[] cmds, String[] env, File wrkDir)where env is the key=value pairs that set up various env options. If the cmd I am running alters or sets new env variables, i
-
CLI156 Could not start the domain domain1
I installed successfully the Appserver on desktop, but when I try to start it from laptop, comes the message below. Both are w2k and 512 memory. Environment: C:\>set ALLUSERSPROFILE=C:\Documents and Settings\All Users APPDATA=C:\Documents and Setting