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

Problem with 'SAP_CONVERT_TO_CSV_FORMAT'

Former Member
0 Likes
980

Hi Experts,

I am trying to covert internal table to CSV format. But i am getting error "The statement is defined only for character tye objects only". Only character-type data objects are supported at the argument

position "op1" for the statement

"IF ... op1 CO op2 ...".In this case, the operand "op1" has the non-character-type "I". The

current program is flagged as a Unicode program. In the Unicode context,

type X fields are seen as non-character-type, as are structures that

contain non-character-type components.

Below this my coding


 
*TYPE-POOLS: truxs.*

*TABLES: BSEG.*

*DATA: ITAB TYPE STANDARD TABLE OF  BSEG  WITH HEADER LINE .*
*DATA: ITAB1 TYPE TRUXS_T_TEXT_DATA.*

*SELECT **
*UP TO 5 ROWS*
*FROM BSEG*
*INTO TABLE itab WHERE GJAHR EQ '2006'.*

*CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'*
*EXPORTING*
*i_field_seperator = ';'*
*TABLES*
*i_tab_sap_data = itab*
*CHANGING*
*i_tab_converted_data = itab1*
*EXCEPTIONS*
*conversion_failed = 1*
*OTHERS = 2.*
*IF sy-subrc EQ 0.*
*MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno*
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.*
*ENDIF.*

*CALL FUNCTION 'GUI_DOWNLOAD'*
*EXPORTING*
*filename = 'C:\TMP\test.CSV'*
*TABLES*
*data_tab = itab1*
*EXCEPTIONS*
*OTHERS = 1.*

1 REPLY 1
Read only

Former Member
0 Likes
523

Hi,

So convert to character and try. C N D and T are conider as character field.