cancel
Showing results for 
Search instead for 
Did you mean: 

csv file umlaute (cl_abap_char_utilities=>cr_lf)

Former Member
0 Kudos

Hi guys,

im uploading a csv file.

But after the upload and splitting the file i have instead of a Ö,Ü,Ä a # in lt_data table.

Here is the part of the coding:

lo_nd_upload = wd_context->get_child_node( name = wd_this->wdctx_upload ).
lo_el_upload = lo_nd_upload->get_element( ).
lo_el_upload->get_static_attributes( IMPORTING static_attributes = ls_upload_node ).
 
   REFRESH lt_bapiret2.

    CALL FUNCTION 'LXE_COMMON_XSTRING_TO_STRING'
     EXPORTING
       in_xstring = ls_upload_node-content
     IMPORTING
       ex_string  = ls_data
     EXCEPTIONS
       error      = 1
       OTHERS     = 2.

   IF sy-subrc <> 0.

   ELSE.


SPLIT ls_data AT cl_abap_char_utilities=>cr_lf INTO TABLE lt_data.

THX

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hello kan,

the file and the SAP system seem to have a different code page. This normal and nothing to worry to about. It seems that the function you use does not perform a code page transformation. The solution to this is to use the CL_ABAP_CONV_IN_CE class instead.

     try.

           lo_conv = cl_abap_conv_in_ce=>create( encoding = '4103' ). "<= your file code page

*--      Convert file data to string
          lo_conv->convert(
           exporting input = lv_file
           importing data = lv_text ).
        catch cx_root.
*--     Conversion error

      endtry.

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

i've tried your coding, but i receive unreadable letters

•††††††††††††††††††††††††††††††††††删䱏卅ਊ单剅≓㬻刻充䕕呓剅㬻㬻

㬻䄻偐佒䕖㭒啐䍒䅈䕓㭒㬻医䕐䥃䱁删䱏卅㬻䕒佐呒义㭇㬻㬻单剅䐠呁㭁㬻㬻㬻㬻㬻㬻㬻㬻㬻㬻഻㬊㬻汁整湲瑡癩

⁥潒敬㭳㬻㬻㬻㬻㬻㬻伻⁋‭敒畱獥整㭲䭏ⴠ倠牵档獡湩⁧敒潰瑲㭳䭏ⴠ䴠湡条牥删灥牯獴㬻䄻牮摥㭥歁摡‮楔整

Part of the the output

Best regards

thomas_szcs
Active Contributor
0 Kudos

Hello kan,

as said you need to use the codepage that is applicable to your environment. Codepage 4103 is just an example.

Best regards,

Thomas

Answers (0)