Skip to Content

Environment

We’re currently implementing SAP CRM 4.0 at our company. Our CRM Server is a Unicode installation. To create CRM Activities from incoming emails in Outlook we are using an Outlook extension which converts the email into a HTML Form which is automatically submitted to a BSP Application running in the CRM Server. The Values in the HTML Form are Base64 encoded. The problem was that we had problems getting the German umlauts correctly into the system.

Useful hint in the morning

Today I’ve received the monthly MySQL Newsletter which pointed me to this Article: “Unicode and Other Funny Characters”. At the end of the article I found this little Code snippet in HTML and PHP:


This HTML is an additional hidden form field which must be added to the HTML Form.


This PHP directed me to a solution for our umlaut problem.

Solution

I adopted the HTML input field with the Base64 encoded value of “ä™®”:


And thisis the relevant code snippet of the Base64 decode function. The function import parameters are encoded_value and charset_check from Type STRING and the export parameter is decoded_value also from Type STRING.

data: lv_decoded_value type xstring,       lv_decoded_value_string type string,       charset_check_decoded_value type xstring.   data:  conv type ref to cl_abap_conv_in_ce.   * * Convert encoded_value from base64 to xstring *   call function 'SSFC_BASE64_DECODE'     exporting       b64data                        = encoded_value *   B64LENG                        = *   B_CHECK                        =    importing      bindata                        = lv_decoded_value  exceptions    ssf_krn_error                  = 1    ssf_krn_noop                   = 2    ssf_krn_nomemory               = 3    ssf_krn_opinv                  = 4    ssf_krn_input_data_error       = 5    ssf_krn_invalid_par            = 6    ssf_krn_invalid_parlen         = 7    others                         = 8.     if sy-subrc <> 0.     message id sy-msgid type sy-msgty number sy-msgno             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.   endif.   * * Convert charset_check from base64 to xstring *   call function 'SSFC_BASE64_DECODE'     exporting       b64data                        = charset_check *   B64LENG                        = *   B_CHECK                        =    importing      bindata                        = charset_check_decoded_value  exceptions    ssf_krn_error                  = 1    ssf_krn_noop                   = 2    ssf_krn_nomemory               = 3    ssf_krn_opinv                  = 4    ssf_krn_input_data_error       = 5    ssf_krn_invalid_par            = 6    ssf_krn_invalid_parlen         = 7    others                         = 8.     if sy-subrc <> 0.     message id sy-msgid type sy-msgty number sy-msgno             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.   endif.   * * What codepage was used for charset_check * Depending on this we initialize the converter class *   if charset_check_decoded_value eq 'C3A4E284A2C2AE'.     conv = cl_abap_conv_in_ce=>create(            encoding = 'utf-8'            endian = 'L'            input = lv_decoded_value          ).     elseif charset_check_decoded_value eq 'E499AE'.     conv = cl_abap_conv_in_ce=>create(            encoding = '1160'            endian = 'L'            input = lv_decoded_value          ).     else.     charset = 'unknown'.   endif. * * Convert the XString *     data:  int type i.   call method conv->read(     importing data = lv_decoded_value_string   ). * * Assign Decoded String to export parameter *     decoded_value_string = lv_decoded_value_string.

This does the trick. Now we can create Activities from emails in Outlook which includes also German umlauts. What a nice day.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply