Skip to Content
author's profile photo Former Member
Former Member

Data Conversion

Can some one please tell me how can i upload a file using BSP,read the file and convert the contents of file to unicode.

I am using simple HTML to upload the file that works fine. But my problem is.. the contents of the file are in some other language(Chinese) and i need to convert it to unicode. If i try to set the locale and read the fails. Can someone please help me out.


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Feb 02, 2004 at 10:09 AM

    well if you use the HTMLB tag to upload the data it will be returned as binary string. There is some good online help for the fileUpload tag that shows you how to do the data extraction part. You should then be able to convert the code page from the source one to a compatible destination one using some function calls. First call SCP_CODEPAGE_BY_EXTERNAL_NAME. With this you can convert the external name of the encoding type to the interal SAP code page.



    external_name = encoding

    * KIND = 'H'


    sap_codepage = codepage


    not_found = 1

    others = 2.

    Next you can call function SCP_TRANSLATE_CHARS to make the conversion. You can supply an input and export code page along with a input binary buffer. In this example I am converting a Unicode binary string to Unicode character based string. However it should work just as well for going from Chinese Simplified (GB2312) or Chinese Traditional (Big5) to Unicode (UTF-8).

    call function 'SCP_TRANSLATE_CHARS'


    inbuff = e_data

    inbufflg = xdocument_length

    incode = codepage

    * OUTBUFFLG = 0

    outcode = codepage

    * CSUBST = 'X'

    * SUBSTC_HASH = ' '

    * SUBSTC_DOT = ' '

    substc_space = 'X'

    substc = '00035'


    * INUSED =

    outbuff = cdocument


    * OUTUSED =

    * SUBSTED =


    * ERRMSG =


    invalid_codepage = 1

    internal_error = 2

    cannot_convert = 3

    fields_bad_type = 4

    others = 5.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Can you please tell me on the same lines If I wanted to process the data of an uploaded Excel File how should I go about doing it ?

      I get a Binary represenation of the excel file please advice. I need to convert that into Internal Table.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.