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: 

GUI_DOWNLOAD with txt file?

Former Member
0 Kudos

I can succesfully upload a csv, comma delimited, file, and manipulate it with GUI_DOWNLOAD. This way....

DATA: BEGIN OF gt_coa_data_holder OCCURS 0,
         rec(200) TYPE c,
      END OF gt_coa_data_holder.

CALL FUNCTION 'GUI_UPLOAD'
         EXPORTING
              filename                = lv_filename
         TABLES
              data_tab                = gt_coa_data_holder
         
LOOP AT gt_coa_data_holder into <gs_coa_data_holder>.

    SPLIT <gs_coa_data_holder> AT ',' INT into wa-fields

But I discovered the file has commas in it so I need to do this with a text, space delimited file. When I use the new txt, space delimited file the space appears as a # in gt_coa_data_holder but as a /h/ in the work area. Thus I can not split up the records lines field by field properly. Even when I say

SPLIT <gs_coa_data_holder> AT '#' INT into wa-fields

or

SPLIT <gs_coa_data_holder> AT '/h/' INT into wa-fields

I tried using different parameters like "has field seperator" whos default is space.

Any suggestions?

Thank-You.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

has_field separator only works with files delimited with tabulator, I suggest you to use that instead of creating a routine.

And no, space is not '#' or '/h/' that is a way the debugger displays it, it doesn't look like you are using a space to separate the files.

Look for the hex code of that character, that's the delimiter you need to use

6 REPLIES 6

Former Member
0 Kudos

has_field separator only works with files delimited with tabulator, I suggest you to use that instead of creating a routine.

And no, space is not '#' or '/h/' that is a way the debugger displays it, it doesn't look like you are using a space to separate the files.

Look for the hex code of that character, that's the delimiter you need to use

Former Member
0 Kudos

hi use the repalce all occurances command

Former Member
0 Kudos

Hi Tom,

In GUI_DOWNLOAD funtion module you hadnt specified a attribute WRITE_FIELD_SEPARATOR = 'X'. specify that option and its will be TAB spaced in CSV file... but internally it will store as comma seperated.... Not 100% sure about this but it had worked for me..

Hope this would help you.

Regards

Narin Nandivada.

Former Member
0 Kudos

Sorry, I meant GUI UPLOAD, not download.

0 Kudos

Use: CL_ABAP_CHAR_UTILITIES=>CR_LF for splitting.

Like:


split wa_text at CL_ABAP_CHAR_UTILITIES=>CR_LF into fld1 fld2 in character mode.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hello Tom,

I've encountered a similar problem. Not being aware of the exits or abap classes as of which to use, what I've done is that...

Downloaded the file on the presentation server into an elementary table of type c. Then used the SPLIT AT ','command and store them into the required table fields, here 'gt_coa_data_holder' .

It worked this way!!

Indu.