SAP Virtual/Onsite Trainings

Document Categories:

What's New?

Contribute?

Sample Specs

What's Hot?

Web Dynpro for ABAP Tutorials 


Join the Mailing List
Enter name and email address below:
Name:
Email:
Subscribe  Unsubscribe 

HTML viewer in ABAP

By Ankit Doshi, TCS

This is a simple tutorial which shows how to use the html text viewer to display the HTML contents on the screen.

HTML viewer can be used to display the preview of the HTML emails that are being sent or it can be even used to display websites.

Class CL_GUI_HTML_VIEWER is used to display the HTML viewer.

Steps to create a HTML Viewer:

1.     Create a module pool screen with container.

2.     Declare reference variable for container (cl_gui_custom_container) and html viewer(cl_gui_html_viewer) in your ABAP program.

DATA : ref_cont TYPE REF TO cl_gui_custom_container,
       ref_html TYPE REF TO cl_gui_html_viewer.

3.     Create objects for the reference variables in step#2

4.     Call the method load_data of the class cl_gui_html_viewer and pass the html code to it and it will return a URL.(variable w_url and table ts_data are of type char, see the example given below for data declarations)

5.     Use the method SHOW_URL to display the html content on screen.

Example:

In this example a selection screen is displayed to user which takes SAP User ID as input and finds the user name through a function module.

A custom HTML email is created to reply the user about the invoice query that user had submitted.

This HTML email will take the name entered by the user on the selection screen incorporate it in the HTML email and display the HTML email to the user using the HTML viewer.

Enter the SAP User id in the below selection screen.

On executing the above report we get the following output.

The above screen shows us the preview of the HTML that we created and greets the user in the HTML email whose sap user id was entered on the selection screen.

Click here for the code...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image