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

Tab delimited file access from application server

Former Member
0 Likes
890

Hi,

I am trying to read a tab delimited file and I see following in a temperary place holder.

0002#02#10032#1000280#10.00 #1#EA#08/19/2008#12/31/9999

Infact, tab has been replaced by # in the above string.

Now I need to take each field into an internal tabel.

I tried following and none worked.

split w_line at '09' into table IT_ZR00_DATA. " In this string 09 is equvalent of TAB

split w_line at '#' into table IT_ZR00_DATA.

What mistake am I doing in reading ?

How generally people read a tab delimited file from application server ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
803

Hi,

Its not required to handle for #

just read the dataset into the string and split the string into work area fields seoparated by TAb delimiter.

Eg:

READ DATASET <filename> INTO l_string.

SPLIT l_string

AT cl_abap_char_utilities=>horizontal_tab "Horizontal tab

INTO l_funcloc_clas-tplnr

w_funcloc_clas-class

w_funcloc_clas-klart

w_funcloc_clas-atnam

w_funcloc_clas-atwrt

w_funcloc_clas-atfor.

append w_funcloc_clas to l_funcloc_clas.

With Regards,

Dwarakanath.S

Hi,

I am trying to read a tab delimited file and I see following in a temperary place holder.

0002#02#10032#1000280#10.00 #1#EA#08/19/2008#12/31/9999

Infact, tab has been replaced by # in the above string.

Now I need to take each field into an internal tabel.

I tried following and none worked.

split w_line at '09' into table IT_ZR00_DATA. " In this string 09 is equvalent of TAB

split w_line at '#' into table IT_ZR00_DATA.

What mistake am I doing in reading ?

How generally people read a tab delimited file from application server ?

4 REPLIES 4
Read only

Former Member
0 Likes
804

Hi,

Its not required to handle for #

just read the dataset into the string and split the string into work area fields seoparated by TAb delimiter.

Eg:

READ DATASET <filename> INTO l_string.

SPLIT l_string

AT cl_abap_char_utilities=>horizontal_tab "Horizontal tab

INTO l_funcloc_clas-tplnr

w_funcloc_clas-class

w_funcloc_clas-klart

w_funcloc_clas-atnam

w_funcloc_clas-atwrt

w_funcloc_clas-atfor.

append w_funcloc_clas to l_funcloc_clas.

With Regards,

Dwarakanath.S

Read only

former_member585060
Active Contributor
0 Likes
803

No need to handle that #, as when u download it to internal table it goes to the next fields where # is there.

OPEN DATASET p_asfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.

DO.

READ DATASET p_asfile INTO wa_emp.

IF sy-subrc <> 0.

EXIT.

ENDIF.

APPEND wa_emp TO it_emp.

ENDDO.

CLOSE DATASET p_asfile.

If u further want to download that internal table data to desktop.

In GUI_DOWNLOAD FM in file type use 'DBF'.

Regards

Bala Krishna

Read only

Former Member
0 Likes
803

> I am trying to read a tab delimited file and I see following in a temperary place holder.

>

> 0002#02#10032#1000280#10.00 #1#EA#08/19/2008#12/31/9999

>

those # are nothing but Tabs, if you want to replace that you can use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB and replace them.

as suggested above you can split the records at this CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

If you try to replace '#' you have to use the equivalent CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in your code.

Read only

Former Member
0 Likes
803

Thanks Dwarakanath and Vijay. The solution provided by you was perfect and resolved my issue.