Skip to Content

bsp + smartforms (codepage? problem)

hi folks,

when calling a webfrom from an bsp , e.g. des sample forms, than some characters like ä ö etc. are not shown correctly - when switching manually (on the explorer) to encoding UNICODE than they are shown correctly -> we have this problem only with webFroms , are there any suggestions what we made wrong? or how can we avoid that.

kind regards

oliver

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Posted on Jul 14, 2004 at 07:20 AM

    Hallo Oliver,

    This is going to be slightly complex. I can give you some ideas what to look for. You will have to debug yourself, or will have go via OSS if you need more help.

    The problem has to do with two things that must match. One is the call to the response object to set the Content-Type header. The other is the actual content that is set.

    For example, is you are running in DE, then set the Content-Type (which also includes the charset) with iso-something. Then write in the content into the response.

    It is ultra important that the Content-Type (with charset) must be set before the first byte is written onto the response. Otherwise the kernel will set it for you.

    So as first step, BSP will try to set this Content-Type depending on logon language. You can configure this on the properties tab of pages and controllers to set you own. I am not sure if smart forms do anything with the request. And then you might also be setting this header.

    Whatever the final value, it must match the data you are going to write. And now comes the next aspect. I suspect SmartForms give you UTF-8 output. If this is true, then you must yourself the Content-Type correctly.

    The last aspect is that there was a kernel change to work around some problems here. I can not remember the exact rules, but from what I remember, on Unicode systems, the data is always forced into UTF-8 format.

    Maybe this is enough to track down the problem. As a first step use a proxy tool and see what the actual header values are. If you require more help, please open OSS message.

    ++bcm

    Add comment
    10|10000 characters needed characters exceeded

    • hi brian,

      my logon language is German -> i used iso-1151, i just tried an ibm codepage 850 compatible one, thats the first i found 😉

      my code goes here:

      lv_formname = 'ZCP_0001'.

      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

      EXPORTING

      formname = lv_formname

      IMPORTING

      fm_name = lv_fm_name

      EXCEPTIONS

      no_form = 1

      no_function_module = 2

      OTHERS = 3.

      ls_output_options-xsf = 'X'. " XSF Output active

      ls_output_options-xsfcmode = 'X'. " Get XSF params from program

      ls_output_options-xsfoutmode = 'A'. " A:Application

      ls_output_options-xsfformat = 'X'. " Formatting ON

      ls_output_options-xsfaction = space. " Action URL for submit btn.

      ls_control_parameters-langu = sy-langu.

      CALL FUNCTION lv_fm_name

      EXPORTING

      is_print = ls_print

      control_parameters = ls_control_parameters

      output_options = ls_output_options

      user_settings = ''

      IMPORTING

      job_output_info = ls_output_data

      EXCEPTIONS

      formatting_error = 1

      internal_error = 2

      send_error = 3

      user_canceled = 4

      OTHERS = 5.

      ls_xmloutput = ls_output_data-xmloutput.

      lt_html_raw = ls_xmloutput-trfresult-content[].

      lt_style = ls_xmloutput-stsheet.

      *----


      • Fill HTTP request

      *----


      • manipulieren????

      response->set_header_field( name = 'content-type'

      value = 'text/html; charset=iso-1151' ).

      *----


      • SAP Smart Forms returns XML data island in raw data format.

      • method 'set_data' of the response object needs the output

      • in XSTRING. The next loop convertes the raw table into xstring.

      *----


      LOOP AT lt_html_raw INTO lv_xstring.

      CONCATENATE lv_html_xstring lv_xstring INTO lv_html_xstring

      IN BYTE MODE.

      ENDLOOP.

      lv_xlength = XSTRLEN( lv_html_xstring ).

      response->set_data( data = lv_html_xstring

      length = lv_xlength ).

  • Posted on Jul 14, 2004 at 08:40 AM

    Hi,

    since kernel patch (I believe)1253 all data written with

    append_cdata into the response object will be converted

    into the codepage set be char-set in the header field.

    The point is that you can display the whole data with or

    without conversion. If you call the layout of the BSP

    append_cdata will be always executed and the data will be

    converted. That's what you don't want. So you must leave the page before the onLayout will be called. This can be

    done by navigation->response_complete( ) if you're

    working with a page. If you use MVC, just don't call the

    view. You can find an example in application IT00 called

    transition_parameter.htm

    Hoping this helps.

    Rainer

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 14, 2004 at 09:35 AM

    Hi Oliver,

    call it at the end of onInputProcessing. Please also

    have a look at the example.

    Regards,

    Rainer

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 14, 2004 at 01:29 PM

    Hi Oliver,

    I should add that as Brian has already mentioned the Smartforms give you the right output. So just use something like:

    file = entity->get_data( ).

    Do not use get_cdata( ) because this will do the conversion.

    At the end (after you got the data) call the

    response_complete( ).

    This should help.

    Rainer

    Add comment
    10|10000 characters needed characters exceeded