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: 

SAP_CONVERT_TO_TXT_FORMAT - SAP data to Text File Conversion???

Former Member
0 Kudos

Hello Gurus,

I need some info about the FM SAP_CONVERT_TO_TXT_FORMAT.

I am getting an EXCEL File in the given location when I am using FM <b>SAP_CONVERT_TO_XLS_FORMAT</b>.

Like that, Can I get a TXT File in the given location when I use FM <b>SAP_CONVERT_TO_TXT_FORMAT</b>.

Thanks in Advance

LIJO

4 REPLIES 4

former_member223537
Active Contributor
0 Kudos

Yes, you should get it. You need to pass the file separator, filename, file header.

0 Kudos

Hello,

Following is the Report Program. But I am not getting TXT File.

<b>REPORT zlij_test .

DATA : wa_data(4096) TYPE c OCCURS 0.

DATA: t100_lines TYPE STANDARD TABLE OF t001 WITH DEFAULT KEY.

DATA : wa LIKE LINE OF t100_lines.

PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'c:\test1.txt'.

SELECT * FROM t001 INTO TABLE t100_lines.

CALL FUNCTION 'SAP_CONVERT_TO_TXT_FORMAT'

EXPORTING

  • I_FIELD_SEPERATOR = 'X'

I_LINE_HEADER = 'X'

i_filename = p_file

I_APPL_KEEP = ' '

TABLES

i_tab_sap_data = t100_lines

CHANGING

i_tab_converted_data = wa_data

EXCEPTIONS

conversion_failed = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.</b>

Please Help

LIJO

0 Kudos

Hi,

This code will give you a txt file as you have mentioned.

REPORT zlij_test .

DATA : wa_data(4096) TYPE c OCCURS 0.

DATA: t100_lines TYPE STANDARD TABLE OF t001 WITH DEFAULT KEY.

DATA : wa LIKE LINE OF t100_lines.

PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'c:\test1.txt'.

SELECT * FROM t001 INTO TABLE t100_lines.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'C:\test1.txt'

FILETYPE = 'ASC'

TABLES

DATA_TAB = t100_lines

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards,

Lijo Joseph

Former Member
0 Kudos

You can. with in fm SAP_CONVERT_TO_TXT_FORMAT, SAP calls FM SAP_CONVERT_TO_TEX_FORMAT which write data to the local file.

Regards,

Subbu.