Skip to Content
Author's profile photo Łukasz Pęgiel

WYSIWYG HTML Editor

I was lately trying to find an HTML WYSIWYG editor for ABAP, but I failed. I though or this was not needed so far, or the solution was not posted anywhere. So I’ve tried several times and thanks to NICEdit and this tread on SCN I found the way to make HTML WYSIWYG editor for ABAP.

My editor use CL_GUI_HTML_VIEWER to display NICEdit in container, and then thanks to POST method I put changes back to SAP. ZCL_HTML_EDITOR class,  raises an event whenever someone click on save button in the editor, so you can easily handle it and then use new HTML for your purposes. Video bellow shows the demo of usage.

NUGG with class and demo program + HTML file with editor can be found here http://abapblog.com/articles/tricks/103-wysiwyg-html-editor-in-abap

Enjoy!

Assigned Tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Peter Inotai
      Peter Inotai

      Hi Lukasz,

      I have to admit I couldn't watch your video because of our firewall (so maybe totally stupid what I'm asking),  but just curious what is the main difference compare to the BTF Editor?

      ( BSP Developer's Journal Part XVI - Using the BTF Editor )

      Thanks,

      Peter

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Hello Peter,

      I was once told, "There are not stupid questions, only stupid answers." Hopefully my answer will not be considered as stupid 🙂

      My editor can be used in SAP GUI for Windows, don't know if BTF editor can, if it does then I would be glad if you could post some examples for me to try it. On my system I could not find any, but I may be looking in wrong place, as I see that BTF is linked to BSP pages?

      The main purpose of my development was to allow to have editor on one screen together with other GUI elements like ALV, and to allow users to do edit of mail body which comes out of SAP.

      Cheers

      Łukasz

      Author's profile photo Peter Inotai
      Peter Inotai

      Hi Łukasz,

      Thanks for the info and clarification.

      Now I see the point. To have the BTF Editor in SAPGUI, it would be necessary to develop a custom BSP page, call it from an HTML control. That would also work, but it overcomplicates things a little bit.

      Cheers,

      Peter

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Thanks for the info! One day I will surely try BTF 🙂

      Author's profile photo Volker Wegert
      Volker Wegert

      Hi Peter,

      you certainly mean something like IF_BTF_EDITOR / report SAPBTFEDITOR_DEMO...?

      Cheers

        Volker

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      That was exactly what I was looking for few months ago... 

      anyway I've learnt how to use SAPEvents of HTML control 🙂

      Thanks for this!

      Author's profile photo Peter Inotai
      Peter Inotai

      Hi Volker,

      I have to admit I didn't know this program.

      Thanks a lot for this info, it's very useful demo program for BTF. It seems it can be used directly in SAPGUI without BSP, which is a nice feature.

      Cheers,

      Peter

      Author's profile photo Matthew Billingham
      Matthew Billingham

      "There are not stupid questions, only stupid answers." Whereas I was told "There are no stupid questions, but there are a lot of inquisitive idiots", 😆


      Nice blog.


      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      😀 Thanks Matthew

      Author's profile photo Miguel Motta
      Miguel Motta

      Hi Łukasz,

      Can you help me with ZCL_HTML_EDITOR class? I need handle special characters like 燂, but CL_GUI_HTML_VIEWER class escape special characters with #.

      Thanks!

      Author's profile photo Miguel Motta
      Miguel Motta

      Hi,

      ADJUST_HTML_DATA method of CL_GUI_HTML_VIEWER class, is not able to adjust NiceEdit HTML, including <meta http-equiv="content-type" content="text/html; charset=utf-8">.

      Without this tag, the post event don't be able to return special characters. After edit HTML file including this tag manually, my report works as expected.

      Systems non unicode works well without meta tag.

      Regards

      Author's profile photo Sathees Kumar Palaniappan
      Sathees Kumar Palaniappan

      Hi Lukasz,

      It is workout for as HTML WYSIWYG editor. But it comes as small in size, is it possible to manage the size/width of HTML Editor as size of HTML viewer – Custom Control?

       

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Hi Satheeskumar,

      as far as I remember, in the method show there was a possibility to adjust the size of the editro.

       

      Cheers
      Łukasz

      Author's profile photo Sathees Kumar Palaniappan
      Sathees Kumar Palaniappan

      Hi Lukasz,

      Following is code with height & width parameters are used, but still it is not effective (SAP_BASIS Rel. 754 sp0000)

      htmleditor->show(
      iv_html |test <a href="http://abapblog.com">ABAPblog.com QWRQEWR QE QRWQER QWERWQER WQERQWERWEQR</a><br>test2|
      iv_height 800
      iv_width  = 800 )

       

      Thanks,

      Sathees

      Author's profile photo Łukasz Pęgiel
      Łukasz Pęgiel
      Blog Post Author

      Strange, I don't have access to 754, but I will try to check on 752

      Author's profile photo Guillaume ROSATI
      Guillaume ROSATI

      Hello maybe too late but we never know, i have same problem than you, editor was appearing very small.

      The problem was in class ZCL_HTML_EDITOR, method SHOW, I added two CONDENSE statement and know it works fine.

      Edit%20of%20show%20method

      Edit of show method

       

      Before concatenation result in "800 px" while we want "800px" whitout space.