‎2008 May 05 2:46 PM
Hey Masters,
I have a text file that I'm uploading into a local table and then checking it line by line.
In each line, I'm splitting it by coma (,), the problem is that at some point there are addresses in the line, which have comas...and there goes my splitting. This file is also splited by TAB. So I need to know how can I split by TAB.
Something like:
SPLIT line AT TAB INTO var1 var2 var3
Thank you in advance.
Jorge Ferreira
‎2008 May 05 3:07 PM
Instead of using TYPE X value '09' it is better to use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
Greetings,
Gert.
‎2008 May 05 2:54 PM
Hope this helps
CONSTANTS:
c_tab TYPE x VALUE '09'.
SPLIT wk_rec AT c_tab
INTO in_rec-recnum
in_rec-leadid
in_rec-ltype
in_rec-ltype_txt
in_rec-status
in_rec-status_txt
*
*
*
‎2008 May 05 2:55 PM
hi,
do this way ..
data : TAB type x value '09'.
SPLIT line AT TAB INTO var1 var2 var3. Regards,
santosh
‎2008 May 05 2:56 PM
Hi,
ur requirement is not clear, ur file is tab separated or comma separated?
if it is comma separated then do like this, - ((here i m assuming that data in first column will never contain , )
as it is comma separated file if any of ur data contains , then " (double quote) will be added at start and end of that data.
First read file into an internal table which contains only one column.
Then split each row into an internal table at "
then loop through the internal table and replace (,) by space of data in each even number row.
now loop through the same table again and concatenate all the splits and insert into say final dummy table.
do this for all rows of first internal table (which contains the uploaded data)
now loop through the final dummy table, split at ,
hope this will help u.
reward if useful
‎2008 May 05 3:07 PM
Instead of using TYPE X value '09' it is better to use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
Greetings,
Gert.