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: 

Dowdload text file to the desktop with separator semicolon(;)

Former Member
0 Kudos

Hi fnds,

I have one requirment as follows:

I need to write a conversion program which have to use in different systems like with version 5.0 and bellow 4.6c.

the file format is like this:

Each column should separated with semicolon ( and the blank field should be replaced with '/'.

Let me knwo if u have any clus.

thanks in advance,

Sunil

1 ACCEPTED SOLUTION

glio_ad
Active Participant
0 Kudos

Hello.

Check this example:

DATA: BEGIN OF itab OCCURS 0,

field1(10) TYPE c,

field2(10) TYPE c,

END OF itab.

DATA: wa_line(20) TYPE c.

DATA: out_tab LIKE wa_line OCCURS 0 WITH HEADER LINE.

itab-field1 = ' test '.

itab-field2 = ' ok?'.

DO.

REPLACE space WITH '/' INTO itab-field1.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ENDDO.

DO.

REPLACE space WITH '/' INTO itab-field2.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ENDDO.

CONCATENATE itab-field1 itab-field2 INTO wa_line SEPARATED BY ';'.

APPEND wa_line TO out_tab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'c:\temp\out.txt'

filetype = 'ASC'

TABLES

data_tab = out_tab.

Reward if it helps,

Regards,

George

2 REPLIES 2

glio_ad
Active Participant
0 Kudos

Hello.

Check this example:

DATA: BEGIN OF itab OCCURS 0,

field1(10) TYPE c,

field2(10) TYPE c,

END OF itab.

DATA: wa_line(20) TYPE c.

DATA: out_tab LIKE wa_line OCCURS 0 WITH HEADER LINE.

itab-field1 = ' test '.

itab-field2 = ' ok?'.

DO.

REPLACE space WITH '/' INTO itab-field1.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ENDDO.

DO.

REPLACE space WITH '/' INTO itab-field2.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ENDDO.

CONCATENATE itab-field1 itab-field2 INTO wa_line SEPARATED BY ';'.

APPEND wa_line TO out_tab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'c:\temp\out.txt'

filetype = 'ASC'

TABLES

data_tab = out_tab.

Reward if it helps,

Regards,

George

former_member156446
Active Contributor
0 Kudos

LOOP AT p_final_table ASSIGNING <fs_record>.

DO.

ASSIGN COMPONENT sy-index OF STRUCTURE <fs_record> TO <fs_comp>.

IF sy-subrc <> 0.

EXIT.

ENDIF.

lv_line = <fs_comp>

here replace ' ' by '/' ..........<<

CONCATENATE lf_line lf_buf INTO lf_line SEPARATED BY ';'.

ENDIF.

CLEAR lf_buf.

ENDDO.

CONCATENATE lf_line INTO lf_line.

APPEND lf_line TO p_output_file.

CLEAR lf_line.

ENDLOOP.

award points if helpful