REPORT  z_test_sourav_html.*----------------------------------------------------------------------*
*       CLASS lcl_class DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class DEFINITION.PUBLIC SECTION.
 METHODS:
 main,
 on_html_event FOR EVENT sapevent OF cl_gui_html_viewer
  IMPORTING action frame getdata.PROTECTED SECTION.
PRIVATE SECTION.
 DATA oref TYPE REF TO cl_gui_html_viewer.ENDCLASS.                    "lcl_class DEFINITION
*----------------------------------------------------------------------*
*       CLASS lcl_class IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_class IMPLEMENTATION.METHOD main.
 DATA oref_lcl TYPE REF TO lcl_class.
 DATA html TYPE w3htmltab.
 DATA url  TYPE c LENGTH 255.
 CREATE OBJECT oref
   EXPORTING
     parent = cl_gui_container=>screen0.

 DATA events TYPE cntl_simple_events.
 DATA event TYPE cntl_simple_event.

 event-eventid = oref->m_id_sapevent.
 event-appl_event = 'X'.
 APPEND event TO events.

 CALL METHOD oref->set_registered_events
   EXPORTING
     events = events.
 SET HANDLER me->on_html_event FOR oref.

 APPEND '<html>'                       TO html.
 APPEND '<body bgcolor= "#FFFFCC">'    TO html.
 APPEND '<font face="arial" size="2">' TO html.
 APPEND '<b>Header</b>'                TO html.
 APPEND '<br>'                         TO html.
 APPEND 'Text'                         TO html.
 APPEND '</font>'                      TO html.
 APPEND '<form name= "form1" action="SAPEVENT:save">' TO html.
 APPEND 'First name:'                  TO html.
 APPEND '<input type="text" name="firstname">' TO html.
 APPEND '<br>'                         TO html.
 APPEND 'Last name: '                  TO html.
 APPEND '<input type="text" name="lastname">'  TO html.
 APPEND '<br>'                         TO html.
 APPEND '<input type="submit" value="Submit">' TO html.
 APPEND '</form>'                      TO html.
 APPEND '</body>'                      TO html.
 APPEND '</html>'                      TO html.
 oref->load_data( IMPORTING assigned_url = url
                  CHANGING data_table = html ).
 oref->show_url( url = url ).ENDMETHOD.                    "main
METHOD on_html_event.
 DATA:l_string TYPE string.
 l_string = getdata.

 MESSAGE i001(00) WITH l_string.ENDMETHOD.                    "on_html_event
ENDCLASS.                    "lcl_class IMPLEMENTATION
PARAMETERS: p_dummy TYPE c LENGTH 1.AT SELECTION-SCREEN OUTPUT.DATA:lcl_oref TYPE REF TO lcl_class.IF lcl_oref IS NOT BOUND.
 CREATE OBJECT lcl_oref.
 CALL METHOD lcl_oref->main.ENDIF.
 
 
 
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com