Skip to Content
Former Member
Sep 18, 2017 at 08:20 PM

Writing file in application server in ISO 8859-1 encoding

1194 Views Last edit Sep 19, 2017 at 08:53 AM 2 rev

Hi All,

I want to write a file in application server in ISO 8859-1 encoding. In order to do this i have coded like below but the issue is when we download and open the file in notepad++ which is in application server it is showing as UTF-8. Can any one help on this

data:   lv_encoding   TYPE abap_encod.
        lv_encoding = /tdag/cpcl_c_gen=>code_page_latin1.

LOOP AT lt_tab INTO ls_tab.
      CONCATENATE lv_char ls_tab lv_char INTO lv_string1.
      CONCATENATE lv_string1 cl_abap_char_utilities=>cr_lf INTO lv_string1.
          text     = lv_string1
*         MIMETYPE = ' '
          encoding = lv_encoding
          buffer   = lv_xstring
          failed   = 1
          OTHERS   = 2.
      IF sy-subrc <> 0.
* Implement suitable error handling here

      ASSIGN lv_xstring TO <lf_any>.
      TRANSFER <lf_any> TO lv_file.
*      TRANSFER lv_string TO lv_file.
      CLEAR: ls_tab, lv_string, lv_xstring.