‎2007 Jan 22 10:46 AM
HI EXPERTS,
I AM SASIDHAR, WORKING ON BW SERVER.
I HAD UPLOADED CSV FORMAT FLATFILE INTO INTERNAL TABLE IN STRING FORMAT. NOW I HAVE TO SPLIT THIS STRING AND ALSO NEED TO CONVERT INTO NUMERIC TYPE, BUT I DON'T KNOW NUMBER OF FIELDS AND LENGTH OF FIELD. PLEASE ANY ONE SEND THE SAMPLE CODING FOR THIS SCENARIO.
‎2007 Jan 22 11:18 AM
since its CSV, the field delimiter will be comma.
split <record> at ',' into <field1> field2> , etc
Raja
‎2007 Jan 22 11:19 AM
If your input file is a CSV file and if you are uploading from local machine then you might be using GUI_UPLOAD function module wherein you can set FIELD_SEPERATOR as X. this enables you to get all the detail to the different fields in the internal table.
if you are uploading from server , you might be using OPEN DATA SET, then you should use the seperator (,) and use SPLIT or make you of offset position of the string.
~thomas
null
‎2007 Jan 22 11:21 AM
You can use this code.
loop at it_file into wa_file.
refresh it_split.
split wa_file-<field> at ',' into table it_split.
.....
endloop.it_split will contain each of the fields in a record in the CSV file as a separate record.
‎2007 Jan 22 11:23 AM
say u have 10 fields...as it is CSV file and u have uploaded using GUI_UPLOAD, there is an option HAS_SEPERATOR which u need to put as 'X' and all fields get into internal table .... or else use Split file into <field1>.......<field10> at ','.