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

Regarding file format conversion while transfer the file to FTP server

Former Member
0 Likes
792

Hi Expert,

How to convert file format to Unicode while transfering text file on to FTP Server.

I have requirement to transfer text file from SAP to FTP server in perticulat file format.SAP system generate file by default in ANSI format but my client requirement is Unicode or UTF .Is there any FM or class ,logic for same.

Thanks,

Hi Expert,

How to convert file format to Unicode while transfering text file on to FTP Server.

I have requirement to transfer text file from SAP to FTP server in perticulat file format.SAP system generate file by default in ANSI format but my client requirement is Unicode or UTF .Is there any FM or class ,logic for same.

Thanks,

3 REPLIES 3
Read only

Former Member
0 Likes
575

HI,

you can use the below classes.

CL_ABAP_CONV_IN_CE : Reading binary data

CL_ABAP_CONV_OUT_CE : exporting binary data

CL_ABAP_CONV_X2X_CE : reading and exporting binary data and changing the format

hope they may useful...

Regrds...!

Read only

Former Member
0 Likes
575

Hi,

Try this Code to convert data as per the UTF format...

DATA: conv TYPE REF TO cl_abap_conv_out_ce,
        convin   TYPE REF TO cl_abap_conv_in_ce,
        l_data   TYPE string,
        record_length TYPE i,
        l_buffer TYPE xstring.


  FIELD-SYMBOLS: <x_data1> TYPE c,
                 <x_data2> TYPE string,
                 <x_data3> TYPE xstring.

  ASSIGN p_data TO <x_data1> CASTING.
  ASSIGN l_data TO <x_data2> CASTING.

  <x_data2> = <x_data1>.

  conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8'
                                      endian   = 'L'
                                      ignore_cerr = 'X'
                                      replacement = '#' ).
  CALL METHOD conv->write( data = l_data ).
* CALL METHOD CONV->WRITE( DATA = CL_ABAP_CHAR_UTILITIES=>CR_LF ).

  l_buffer = conv->get_buffer( ).

  CALL METHOD cl_abap_conv_in_ce=>create
    EXPORTING
      encoding    = 'UTF-8'
      endian      = 'L'
      ignore_cerr = 'X'
      replacement = '#'
      input       = l_buffer
    RECEIVING
      conv        = convin.

  CALL METHOD convin->read
    IMPORTING
      data = l_data.

  CALL METHOD conv->reset.

  <x_data1> = <x_data2>.

Read only

0 Likes
575

Hi ,

Thanks for reply ,My requirement is to change file format not file contain ...