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: 

Dowloading tab delimited .txt file

Former Member
0 Kudos

Hello friends,

I am downloading one tab delimited .txt file from internal table using OPEN dataset , READ dataset.

But output looks like...


4500603096	20081008[]4500603095	20081003[]4500603087	20080924[]4500603083	20080910[]4500603084	20080910[]

and I want output as follows in .TXT file

4500603096 20081008

4500603095 20081003

4500603087 20080924

4500603083 20080910

4500603084 20080910

While same file i open with excel it works correctly.

Why this is happening?

My code is below...



OPEN DATASET l_file FOR OUTPUT IN TEXT MODE.
      IF sy-subrc = 0.
        LOOP AT i_po_extarct INTO lw_po_extract.
          CONCATENATE lw_po_extract-ebeln
                      lw_po_extract-aedat
              INTO l_string
              SEPARATED BY wc_tab.
*         Get the logs to the file.
          TRANSFER l_string TO l_file.
        ENDLOOP.
*       Close the dataset
        CLOSE DATASET l_file.
      ELSE.
        MESSAGE e303(me) WITH 'File not found'.
      ENDIF.

note : l_string and l_file are type STRING.

Edited by: Ronny Hanks on Oct 21, 2008 10:39 AM

Edited by: Ronny Hanks on Oct 21, 2008 10:40 AM

3 REPLIES 3

Former Member
0 Kudos

Hi,

Both Output Looks Same to me......What the difference?

Former Member
0 Kudos

OPEN DATASET a_plant FOR INPUT IN TEXT MODE ENCODING DEFAULT.

DO.

READ DATASET a_plant INTO w_string.

IF sy-subrc <> 0.

EXIT.

ENDIF.

SPLIT w_string AT cl_abap_char_utilities=>horizontal_tab

INTO w_txt1-werks w_txt1-name1 w_txt1-country .

MOVE w_txt1 TO it_plant.

APPEND it_plant.

CLEAR w_txt1.

CLEAR w_string.

ENDDO.

CLOSE DATASET a_plant.

hope it will useful to you

Former Member
0 Kudos

Thanks !!