SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Demo HTML Viewer



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sun Nov 04, 2007 6:29 pm    Post subject: Demo HTML Viewer Reply with quote

Code:
*&---------------------------------------------------------------------*
*& Report SAPHTML_EVENTS_DEMO                                          *
*&---------------------------------------------------------------------*
REPORT  saphtml_events_demo.

DATA: html_control TYPE REF TO cl_gui_html_viewer,
      my_container TYPE REF TO cl_gui_custom_container,
      prog_repid LIKE sy-repid,                             "#EC NEEDED
      edurl(2048),
      edframe(255),
      edaction(256),
      edgetdata(2048),
      edpostdataline(1024),
      ok_code LIKE sy-ucomm,
      myevent_tab TYPE cntl_simple_events,
      myevent TYPE cntl_simple_event,
      postdata_tab TYPE cnht_post_data_tab,
      edquery_table TYPE cnht_query_table.                  "#EC NEEDED


*****************************************************
*              CLASS cl_myevent_handler             *
*****************************************************
CLASS cl_myevent_handler DEFINITION.

  PUBLIC SECTION.
    METHODS: on_sapevent
               FOR EVENT sapevent OF cl_gui_html_viewer
                 IMPORTING action frame getdata postdata query_table.

ENDCLASS.

SET SCREEN 100.

DATA: evt_receiver TYPE REF TO cl_myevent_handler.

* CLASS CL_GUI_CFW DEFINITION LOAD.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'TESTHTM1'.
  SET TITLEBAR '001'.

  IF html_control IS INITIAL.
    prog_repid = sy-repid.

    CREATE OBJECT my_container
        EXPORTING
            container_name = 'HTML_CONTROL'.

    CREATE OBJECT html_control
         EXPORTING
              parent    = my_container.
    IF sy-subrc NE 0.
*
    ENDIF.

* register event
    myevent-eventid = html_control->m_id_sapevent.
    myevent-appl_event = 'x'.
    APPEND myevent TO myevent_tab.
    CALL METHOD html_control->set_registered_events
        EXPORTING
           events = myevent_tab.

    CREATE OBJECT evt_receiver.

    SET HANDLER evt_receiver->on_sapevent
                FOR html_control.

    PERFORM load_graphics.
    PERFORM load_home_page.
  ENDIF.
ENDMODULE.                             " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE ok_code.
    WHEN 'BACK'.                       "Beenden
      IF NOT html_control IS INITIAL.
        CALL METHOD html_control->free.
        FREE html_control.
      ENDIF.
      LEAVE TO SCREEN 0.

    WHEN 'HHOM'.                       " show the home page
      PERFORM load_home_page.

    WHEN 'HBAK'.
      CALL METHOD html_control->go_back.

    WHEN 'HFWD'.
      CALL METHOD html_control->go_forward.

    WHEN 'HRFR'.
      CALL METHOD html_control->do_refresh.

    WHEN OTHERS.
      CALL METHOD cl_gui_cfw=>dispatch.
  ENDCASE.
  CLEAR ok_code.
ENDMODULE.                             " USER_COMMAND_0100  INPUT


*&---------------------------------------------------------------------*
*&      Form  LOAD_HOME_PAGE
*&---------------------------------------------------------------------*
FORM load_home_page.
  DATA: doc_url(80).

  CALL METHOD html_control->load_html_document
       EXPORTING
            document_id  = 'SAPHTML_EVENTS_DEMO_HOME'
       IMPORTING
            assigned_url = doc_url
       EXCEPTIONS
            OTHERS       = 1.

  IF sy-subrc EQ 0.
    CALL METHOD html_control->show_url
         EXPORTING
              url = doc_url.
  ENDIF.
ENDFORM.                               " LOAD_HOME_PAGE


*&---------------------------------------------------------------------*
*&      Form  LOAD_FRAME_SET
*&---------------------------------------------------------------------*
FORM load_frame_set.
  DATA: doc_url(80).

  CALL METHOD html_control->load_html_document
       EXPORTING
            document_id  = 'SAPHTML_EVENTS_DEMO_FRAME1'
            document_url = 'HTMLFrame1.htm'
       EXCEPTIONS
            OTHERS       = 1.

  CALL METHOD html_control->load_html_document
       EXPORTING
            document_id  = 'SAPHTML_EVENTS_DEMO_HOME'
            document_url = 'HTMLFrame2.htm'
       EXCEPTIONS
            OTHERS       = 1.

  CALL METHOD html_control->load_html_document
       EXPORTING
            document_id  = 'SAPHTML_EVENTS_DEMO_FRAMESET'
       IMPORTING
            assigned_url = doc_url
       EXCEPTIONS
            OTHERS       = 1.

  IF sy-subrc EQ 0.
    CALL METHOD html_control->show_url
         EXPORTING
              url = doc_url.
  ENDIF.
ENDFORM.                               " LOAD_FRAME_SET


*&---------------------------------------------------------------------*
*&      Form  LOAD_GRAPHICS
*&---------------------------------------------------------------------*
FORM load_graphics.
  CALL METHOD html_control->load_mime_object
     EXPORTING
          object_id  = 'HTMLCNTL_TESTHTM2_SAPLOGO'
          object_url = 'SAPLOGO.GIF'
     EXCEPTIONS
          OTHERS     = 1.
  CALL METHOD html_control->load_mime_object
       EXPORTING
            object_id  = 'HTMLCNTL_TESTHTM2_SAP_AG'
            object_url = 'SAP_AG.GIF'
       EXCEPTIONS
            OTHERS     = 1.
  CALL METHOD html_control->load_mime_object
       EXPORTING
            object_id  = 'HTMLCNTL_TESTHTM2_BACKGROUND'
            object_url = 'HOME_BACKGROUND.GIF'
       EXCEPTIONS
            OTHERS     = 1.
ENDFORM.                               " LOAD_GRAPHICS

****************************************************
*    cl_myevent_handler implementation             *
****************************************************
CLASS cl_myevent_handler IMPLEMENTATION.

  METHOD on_sapevent.

    CLEAR edaction.
    CLEAR edframe.
    CLEAR edgetdata.
    CLEAR edpostdataline.

    edaction       = action.
    edframe        = frame.
    edgetdata      = getdata.
    postdata_tab   = postdata.
    IF NOT postdata_tab IS INITIAL.
      READ TABLE postdata_tab INDEX 1 INTO edpostdataline.
    ENDIF.
    edquery_table  = query_table.

    CASE action.
      WHEN 'SHOW_FRAMESET'.
        PERFORM load_frame_set.
      WHEN OTHERS.
    ENDCASE.
  ENDMETHOD.

ENDCLASS.

*GUI Texts
*----------------------------------------------------------
* 001 --> HTML Control Event Demo
* 001 --> HTML Control Event Demo
* 001 --> HTML-Control: демонстрационное событие


****************************************************************
* This file was generated by Direct Download Enterprise. *
* Please do not change it manually. *
****************************************************************
%_DYNPRO
SAPHTML_EVENTS_DEMO
0100
620
40
%_HEADER
SAPHTML_EVENTS_DEMO 0100 0100 39115192 35 0 0 39116 0G D 20001113154303
%_DESCRIPTION
Initial Screen
%_FIELDS
%#AUTOTEXT001 CHAR 3 00 00 00 30 00 1 2 0 0 0 0 0 0 URL
EDURL C CHAR 132 81 02 80 30 00 1 16 0 0 0
%#AUTOTEXT002 CHAR 6 00 00 00 30 00 2 2 0 0 0
EDACTION C CHAR 80 81 00 80 30 00 2 16 0 0 0
%#AUTOTEXT003 CHAR 5 00 00 00 30 00 2 57 0 0 0
EDFRAME C CHAR 80 81 00 80 30 00 2 64 0 0 0
%#AUTOTEXT004 CHAR 9 00 00 00 30 00 3 2 0 0 0
EDGETDATA C CHAR 132 81 00 80 30 00 3 16 0 0 0
%#AUTOTEXT005 CHAR 10 00 00 00 30 00 4 2 0 0 0
EDPOSTDATALINE C CHAR 132 81 00 80 30 00 4 16 0 0 0
HTML_CONTROL 115 00 30 00 30 00 5 2 0 0 0
OK_CODE CHAR 20 80 10 00 00 00 255 1 O 0 0 0
%_FLOWLOGIC
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.