Application Development and Automation 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: 
Read only

convert SAP_CONVERT_TO_CSV_FORMAT

Former Member
0 Likes
3,127

type-pools:truxs.

TYPES : STRUCT_VABK TYPE VBAK.

DATA : ITAB1 TYPE TABLE OF VBAK.

DATA : ITAB2 TYPE TRUXS_T_TEXT_DATA.

hi all,

i want to convert my itab to comma separated itab and iam down loading to a flat file.

iam using the following code, iam getting the dump . could any body let me know the problem.

and how to resolve the same.

SELECT * FROM VBAK INTO TABLE ITAB1 WHERE ERDAT GT '01.01.1997'.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = ';'

  • I_LINE_HEADER =

  • I_FILENAME =

  • I_APPL_KEEP = ' '

TABLES

I_TAB_SAP_DATA = ITAB1

CHANGING

I_TAB_CONVERTED_DATA = ITAB2

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.

regards

prasana kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,615

Hi

what is the dump that you are getting?

sample :

data:

Filename TYPE dxfile-filename c lower case,

Delimiter TYPE char01 value ';',

Ouput_String TYPE truxs_t_text_data with header line.

*Use FM SAP_CONVERT_TO_CSV_FORMAT and pass a Delimiter and ITAB. This

returns an Ouput_String

  • Convert Internal Table to ; delimited format

  • There is a filename parameter on this FM but I don't think it's used

call function 'SAP_CONVERT_TO_CSV_FORMAT'

  • exporting

  • i_field_seperator = Delimiter "default ';'

  • i_filename = Filename

tables

i_tab_sap_data = ITAB

changing

i_tab_converted_data = Ouput_String

exceptions

conversion_failed = 1

others = 2.

reg

Ramya

Edited by: Ramya S on Mar 19, 2009 7:45 AM

type-pools:truxs.

TYPES : STRUCT_VABK TYPE VBAK.

DATA : ITAB1 TYPE TABLE OF VBAK.

DATA : ITAB2 TYPE TRUXS_T_TEXT_DATA.

hi all,

i want to convert my itab to comma separated itab and iam down loading to a flat file.

iam using the following code, iam getting the dump . could any body let me know the problem.

and how to resolve the same.

SELECT * FROM VBAK INTO TABLE ITAB1 WHERE ERDAT GT '01.01.1997'.

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = ';'

  • I_LINE_HEADER =

  • I_FILENAME =

  • I_APPL_KEEP = ' '

TABLES

I_TAB_SAP_DATA = ITAB1

CHANGING

I_TAB_CONVERTED_DATA = ITAB2

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.

regards

prasana kumar

7 REPLIES 7
Read only

Former Member
0 Likes
1,616

Hi

what is the dump that you are getting?

sample :

data:

Filename TYPE dxfile-filename c lower case,

Delimiter TYPE char01 value ';',

Ouput_String TYPE truxs_t_text_data with header line.

*Use FM SAP_CONVERT_TO_CSV_FORMAT and pass a Delimiter and ITAB. This

returns an Ouput_String

  • Convert Internal Table to ; delimited format

  • There is a filename parameter on this FM but I don't think it's used

call function 'SAP_CONVERT_TO_CSV_FORMAT'

  • exporting

  • i_field_seperator = Delimiter "default ';'

  • i_filename = Filename

tables

i_tab_sap_data = ITAB

changing

i_tab_converted_data = Ouput_String

exceptions

conversion_failed = 1

others = 2.

reg

Ramya

Edited by: Ramya S on Mar 19, 2009 7:45 AM

Read only

Former Member
0 Likes
1,615

call function 'SAP_CONVERT_TO_CSV_FORMAT'

exporting

i_field_seperator = c_field_separator

i_line_header = ' '

i_filename = p_file

i_appl_keep = ''

tables

i_tab_sap_data = itab.

give a file name like

Parameters pfile like rlgrap-filename default 'c/name.csv'.

thanks

Read only

qamar_javed
Participant
0 Likes
1,615

Hi Jaya,

In the exporting parameter uncomment the I_APPL_KEEP parameter and set the value SPACE.

Hope this works.

Regards,

Qamar.

Read only

Former Member
0 Likes
1,615

Hi Jaya,

Please be more specific.Just Specify the dump ur getting.

Also check the data in ur internal table once.May it can be the problem with the type of data the internal table contains.

Regards,

Lakshman.

Read only

sarbajitm
Contributor
0 Likes
1,615

Hi,

keep space not comma for I_FIELD_SEPERATOR = ' '

Regards.

Sarbajit.

Read only

Former Member
0 Likes
1,615

Parameters pfile like rlgrap-filename default 'C:\.csv'.

call function 'SAP_CONVERT_TO_CSV_FORMAT'

exporting

i_field_seperator = c_field_separator

i_line_header = ' '

i_filename = pfile

i_appl_keep = ''

tables

i_tab_sap_data = itab.

Read only

Former Member
0 Likes
1,615

Did you checked the similar thread like yours..you'll get your answer