Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_GUI_HTML_VIEWER method load_data

Former Member
0 Likes
2,710

Hi,

i am using the mentioned method to load a documentation as html, the problem is that I have several ä, ö, ü in the text which I can't display in the correct form, is there any possibility to display it ìn the right form?

I get this sign for the ä = ü

9 REPLIES 9
Read only

MarcinPciak
Active Contributor
0 Likes
2,176

I guess you need to use proper charset


call method r_html_viewer->load_data
exporting
   ....
   charset = 'ISO-8859-2'  "your country specific charset here

Regards

Marcin

Read only

0 Likes
2,176

Where can I found my country specific charset?

Is ISO-8859-2 right for german?

Read only

0 Likes
2,176

Hello

ISO-8859-1 should be sufficient for the German language (see [ISO/IEC 8859-1|http://en.wikipedia.org/wiki/ISO/IEC_8859-1])

Regards

Uwe

Read only

0 Likes
2,176

[Google says|http://a4esl.org/c/charset.html] for Western European countries it's ISO-8859-1

But not sure if you also don't have to provide encoding parameter in above method. Check with providing only charset first.

Regards

Marcin

Read only

0 Likes
2,176

Hello,

I have now tried to use only the charset parameter with ISO-8859-1 but it doesn't work, what can I put in the encoding parameter because there is no documentation in the method to show what kind of values are allowed for the parameters.

Read only

0 Likes
2,176

I've newer used that too, so I am not sure. Try giving that ISO.. to encoding instead of charset .Also ensure these parameters are provided like


   type         = 'text'
   subtype      = 'html'

If that doens't work try directly showing your html page with method SHOW_URL without use of load_data first.

Regards

Marcin

You may also try giving internal abbreviation for codepage (4 digit number instead of character name)


CALL FUNCTION 'SCP_CODEPAGE_BY_EXTERNAL_NAME'
  EXPORTING
    external_name = 'ISO-8859-2'
  IMPORTING
    sap_codepage  = codepage.

DATA: char_codepage.

char_codepage = codepage.   "then try passing CHAR_CODEPAGE as encoding or charset

Edited by: Marcin Pciak on Aug 17, 2009 11:56 AM

Read only

0 Likes
2,176

Hello MArcin,

unfortunately it doesn't work, I have to use the method load_data as I nedd the url which I get from this method.

I have now solve it as follows:

LOOP AT l_t_html_page INTO l_r_html_page.

REPLACE ALL OCCURRENCES OF 'Ü' IN l_r_html_page-tdline WITH 'Ü'.

REPLACE ALL OCCURRENCES OF 'ü' IN l_r_html_page-tdline WITH 'ü'.

REPLACE ALL OCCURRENCES OF 'Ö' IN l_r_html_page-tdline WITH 'Ö'.

REPLACE ALL OCCURRENCES OF 'ö' IN l_r_html_page-tdline WITH 'ö'.

REPLACE ALL OCCURRENCES OF 'Ä' IN l_r_html_page-tdline WITH 'Ä'.

REPLACE ALL OCCURRENCES OF 'ä' IN l_r_html_page-tdline WITH 'ä'.

REPLACE ALL OCCURRENCES OF 'ß' IN l_r_html_page-tdline WITH 'ß'.

MODIFY l_t_html_page FROM l_r_html_page.

ENDLOOP.

But I don't know if this is the best way?

Read only

0 Likes
2,176

Sorry for repliyng so late but I faced issues with posting a reply having html tags here.

In below code you must place HTML , BODY and META in b/w < > brackets. As I mentioned this caused a big trouble to reply to this message when using them.

The solution itself works fine


DATA: html TYPE REF TO cl_gui_html_viewer.
DATA container TYPE REF TO cl_gui_custom_container.

DATA: l_doc_url(255) TYPE c.
DATA: html_table TYPE TABLE OF char50.

APPEND ' html  body  ÜüÖöÄäß   /body   /html ' TO html_table.  "you need to provide your html b/w  HMTL  BODY  ...  /BODY /HTML  tags

CALL SCREEN 900.


MODULE pbo OUTPUT.
  CREATE OBJECT container
    EXPORTING
      container_name     = 'CUSTOM_CONTROL'.

  CREATE OBJECT html
    EXPORTING
      parent             = container.


  CALL METHOD html->load_data
    EXPORTING
      type         = 'text'
      subtype      = 'html'
    IMPORTING
      assigned_url = l_doc_url
    CHANGING
      data_table   = html_table.   "now this method will automatically append META  tags with correct charset (UTF-8) and hence will dipslay your German letters correctly. 
"without those  HTML  and  BODY  tags you will get those A1, as  META  tag can't be appended to HTML_TABLE correctly

  CALL METHOD html->show_data
    EXPORTING
      url = l_doc_url.

ENDMODULE.          

Regards

Marcin

Read only

0 Likes
2,176

Hello Marcin,

I ahev already done it with the mentioned replace syntax from me. So it works fine with this. But thank you for you help.