‎2010 Feb 08 6:08 AM
Hello,
I am uploading CSV file to internal table,I need to check the data seperator should be only
semicolon.
Content will be like this.
Ex: a;b;c;d
;p; ; q
How can i do that ?
Rgds,
Karthi.
‎2010 Feb 08 8:25 AM
You will knowing the no of fields already.
So use "split into table" statement, count the rows.
If the count is equal to the no of fields then no problem else it doesnt satisy.
‎2010 Feb 08 6:14 AM
HI,
You need to use SPLIT statement.
Just search the forum with "How to upload a csv file". You can get lot of sample codes.
Thanks,
Vinod.
‎2010 Feb 08 6:30 AM
Hi,
I have already use the Split statement to do this & my upload program is working fine.
Here i am making an additional check for semicolons.
Theare are some cases where the data may be empty with only semicolon as a seperator.
In this cases how do we check the line.
Rgds,
Karthi.
‎2010 Feb 08 6:36 AM
hi,
If you are already using SPLIT statement,and if there is any empty filed then it will move goes into respective varaible based on your declaration.i think there no need to check again.
Regards,
Srilatha
‎2010 Feb 08 6:45 AM
Its my code, here i am able to check the data seperator.
if the data seperator is not semicolon then any one of the fields would be empty
then i throw a message to terminate the Program.
But there are cases i can also have empty value for fields.
split g_r_tab_temp at ';' into g_r_tab_final-vkorg
g_r_tab_final-matnr
g_r_tab_final-prodh
g_r_tab_final-loc_snp.
if sy-tabix eq 1.
if g_r_tab_final-vkorg eq ' ' or
g_r_tab_final-matnr eq ' ' or
g_r_tab_final-prodh eq ' ' or
g_r_tab_final-loc_snp eq ' '.
message i100 with text-011.
leave program.
endif.
endif.
‎2010 Feb 08 6:50 AM
Hi,
Try this out,
loop at it_table.
clear it_temp.
split it_table-line at ';' into it_temp-fld1
it_temp-fld2
it_temp-fld3.
append it_temp.
endloop.
loop at it_temp.
write:/ it_temp-fld1, it_temp-fld2, it_temp-fld3.
endloop.
Hope it helps you,
Regards,
Abhijit G. Borkar
‎2010 Feb 08 8:25 AM
You will knowing the no of fields already.
So use "split into table" statement, count the rows.
If the count is equal to the no of fields then no problem else it doesnt satisy.
‎2010 Feb 08 2:31 PM
Hello all,
I solved it by using search function.
Thanks for the replies.
I will close this thread.
Rgds,
karthi.