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

Delimiter problem while uploading using CSV format(Very Urgent)

Former Member
0 Likes
2,400

Hi All,

Actually while i upload the file using CSV Format , a field contains a text with comma. If i use split to delimit the comma then the fields are getting wrongly.

Please see the example given by me below

DATA

12,189,pjswami,"this is a long , statement,12

the above data contains 5 fields but the 4th field has text with comma. so the field datas are misplaced like the one given below

12

189

pjswami

"this is a long

statement,12

Please help me out as this is very very urgent.

Hope to get response immediately

Thanks

Siva

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,584

Well, you have two choices, you can either make sure that there are no commas in the text field before running the program, or you need to change the delimiter to something else. Personally, when doing this kind of thing, I tell the user, that there must not be any commas in the text fields.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,584

hi,

you need to use offset to achieve the proper results.

try this also

FM KCD_CSV_FILE_TO_INTERN_CONVERT.

and check ..

thanks

vijay

Read only

0 Likes
1,584

Hi Vijay,

Thanks for ur reply.

It works fine with the FM but if the total length of the text of a field is morethan 32 then it is truncated.

So, any other solution for this

Please clarify

Thanks

Siva

Read only

0 Likes
1,584
    call function 'KCD_CSV_FILE_TO_INTERN_CONVERT'
         exporting
              i_filename      = 'C:test.csv'
              i_separator     = ','
         tables
              e_intern        = itab
         exceptions
              upload_csv      = 1
              upload_filetype = 2.

this is how you are calling ,

then check lengths of fields are you giving correctly..

another possible solutions is

offset--->you need to take big char variable and condense it and offset accroding to the field length.

thanks

vijay

Message was edited by: Vijay Babu Dudla

Read only

Former Member
0 Likes
1,584

Hi,

As you said the requirement is quite urgent,

you can do this i think.

Copy the function module into z_function module and change it as required.

*" TABLES

*" E_INTERN TYPE KCDE_INTERN

Instead of KCDE_INTERN,

create a ztable with the same fields and change the data type of the field VALUE from char to what ever you need (say char132).

*" TABLES

*" E_INTERN TYPE ztable

Regards,

Sailaja.