Application Development 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: 

upload tab delimited file

Former Member
0 Kudos
222

ho do i upload a file that is tab delimited, if the file is comma separated we items "split at ',' . how do i split tab separated items

5 REPLIES 5

Former Member
0 Kudos
77

hi,

In GUI_upload FM

the Export Parameter HAS_FIELD_SEPARATOR will be used as follows.

<b>'X':</b> Fields are separated by tabs.

<b>SPACE:</b> Fields are not separated by tabs. In this case, the table must contain only one column or all columns must be contained in the file in their entire length.

Sudheer.A

Former Member
0 Kudos
77

Hullo,

the hexadecimal code for 'tab' is 09.

declare a constant like:

CONSTANTS: c_tab TYPE x VALUE '09'.

and then you can use "split at c_tab".

Hope this helps.

Former Member
0 Kudos
77

Hi,

sudheer Addepalli is absolutely correct. All you have to do is set the field to 'X' and specify your internal table.

Regards,

Vara

Former Member
0 Kudos
77

HI Willard

As you know, handling of files w.r.t presentation server and application server differs.

<b>Presentation Server</b>: We can use FM: <b>GUI_UPLOAD</b> for the same.

<b>Application Server</b>:

1. Declare a variable of long text.

Eg: data: l_data(1024) type c.

2. Declate a variable which identifies tab character;

data: <b>l_tab(1) type c value cl_abap_char_utilities=>horizontal_tab</b>.

3. While reading the dataset, read into l_data.

4. Split l_data at l_tab into work area fields.

Eg:

data: l_text(1024) type c,

l_tab(1) type c value cl_abap_char_utilites=>horizontal_tab.

open dataset fname for input in text mode encoding default.
if sy-subrc ne 0.
   write:/ 'Error Opening File'.
else.
   do.
      read dataset fname into l_text.
      if sy-subrc ne 0.
         exit.
      else.
         split l_text at l_tab into wa-fld1 wa-fld2 ....
         append wa to itab.
      endif.
   enddo.
   close dataset fname.
endif.

Hope the above info gives you some idea.

Kind Regards

Eswar

0 Kudos
77

I edit my post after i realised that i was wrong trying to do the same... but i can't to delete it.

Sorry...

Message was edited by:

Kike CI