Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data seperator check

Former Member
0 Likes
821

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.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
789

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.

7 REPLIES 7
Read only

vinod_vemuru2
Active Contributor
0 Likes
789

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.

Read only

Former Member
0 Likes
789

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.

Read only

Former Member
0 Likes
789

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

Read only

Former Member
0 Likes
789

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.

Read only

Former Member
0 Likes
789

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
790

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.

Read only

Former Member
0 Likes
789

Hello all,

I solved it by using search function.

Thanks for the replies.

I will close this thread.

Rgds,

karthi.