Working with the SAP HTML Viewer

Use

This section lists the functions that are specific to the SAP HTML Viewer.

Prerequisites

The process described here is an extension of the general process for using controls that is specific to the SAP HTML Viewer. It does not contain all of the steps required to produce a valid instance of the control.

Process

Creating the Instance

  • Define a reference variable for the SAP HTML Viewer:

    DATA html_viewer TYPE REF TO cl_gui_html_viewer.

  • Create an instance of the SAP HTML Viewer:

    CREATE OBJECT html_viewer

    EXPORTING parent  = container.

Register the Events

  • Register events for the SAP HTML Viewer. The SAP HTML Viewer supports the following events:

Event Name

Meaning

SAPEVENT

Click on a special HTML link that triggers an SAP event.

NAVIGATE_COMPLETE

HTML page was loaded completely.

Working with the SAP HTML Viewer

Load

HTML pages with method load_html_document or

parts of HTML pages with method load_mime_object.

  • Display the loaded objects ( show_url).

  • Navigate forwards ( go_forward) and backwards ( go_back) in the navigation stack of your HTML browser from the application program, or return to the homepage ( go_home).

  • Update the displayed HTML page from your application program ( do_refresh).

    • Query the address of the page that is currently displayed ( get_current_url).

Destroying the Control

The Lifetime Management is normally responsible for destroying any controls you use. However, if you want to destroy the controls manually in your program, you must proceed as follows:

  • Destroy the SAP HTML Viewer on the frontend ( free). If you do not need the control container any more, destroy it as well:

    CALL METHOD html_viewer->free.

  • Delete the reference variable to the SAP HTML Viewer and, if necessary, the reference to the control container as well:

FREE html_viewer.