Skip to Content
0
Former Member
Apr 20, 2007 at 05:54 AM

CSV file upload into interal table with unicode system.

17 Views

Hi everyone.

I have a problem. I made a sample program to upload CSV file to server memory;iternal table i mean. if csv file has numeric and english data, it works well. but it's not work when i made a csv file with Korean. my code is below. how can i do??

DATA: FILEUPLOAD TYPE REF TO CL_HTMLB_FILEUPLOAD.
DATA: CONTENT_LENGTH TYPE STRING,
      FILE_CONTENT TYPE XSTRING ,
      FILE_LENGTH TYPE STRING ,
      FILE_MIME_TYPE TYPE STRING ,
      FILE_NAME TYPE STRING .

DATA: CONTENT TYPE STRING.

FILEUPLOAD ?= CL_HTMLB_MANAGER=>GET_DATA(
                       REQUEST = REQUEST
                       ID      = 'file1'
                       NAME    = 'fileUpload' ).

FILE_NAME      = FILEUPLOAD->FILE_NAME.
FILE_MIME_TYPE = FILEUPLOAD->FILE_CONTENT_TYPE.
FILE_LENGTH    = FILEUPLOAD->FILE_LENGTH.
FILE_CONTENT   = FILEUPLOAD->FILE_CONTENT.


data: conv type ref to CL_ABAP_CONV_IN_CE .
data: tmp type string.
data: cnt type i.

    CONV = CL_ABAP_CONV_IN_CE=>CREATE( INPUT = FILE_CONTENT
                                       ENCODING = 'UTF-8' ).
    CONV->READ( EXPORTING N = cnt
                IMPORTING DATA = CONTENT ).

    tmp = content.