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

HTML Control: Use as General WWW Browser



 
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: 1639

PostPosted: Sun Nov 04, 2007 6:16 pm    Post subject: HTML Control: Use as General WWW Browser Reply with quote

Demo for HTML Control: Use as General WWW Browser
Code:

*&---------------------------------------------------------------------*
*& Report  SAPHTML_DEMO1                                               *
*&---------------------------------------------------------------------*
REPORT  saphtml_demo1.

DATA: html_control TYPE REF TO cl_gui_html_viewer,
      my_container TYPE REF TO cl_gui_custom_container,
      fcode LIKE sy-ucomm,
      myevent_tab TYPE cntl_simple_events,
      myevent TYPE cntl_simple_event,
      edurl(2048),
      alignment TYPE i.

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

  PUBLIC SECTION.
    METHODS: on_navigate_complete
               FOR EVENT navigate_complete OF cl_gui_html_viewer
               IMPORTING url.
ENDCLASS.

DATA: evt_receiver TYPE REF TO cl_myevent_handler.

SET SCREEN 100.

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

  IF my_container IS INITIAL.

    CREATE OBJECT my_container
        EXPORTING
            container_name = 'HTML'
        EXCEPTIONS
            others = 1.
    CASE sy-subrc.
      WHEN 0.
*
      WHEN OTHERS.
        RAISE cntl_error.
    ENDCASE.
  ENDIF.

  IF html_control IS INITIAL.
    CREATE OBJECT html_control
         EXPORTING
              parent    = my_container.
    IF sy-subrc NE 0.
      RAISE cntl_error.
    ENDIF.

* register event

*************************************************************
* DON'T USE the NAVIGATE_COMPLETE event in application logic
*************************************************************
    myevent-eventid = html_control->m_id_navigate_complete.
    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_navigate_complete
                FOR html_control.

    PERFORM load_home_page.
  ENDIF.
ENDMODULE.                             " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE fcode.
    WHEN 'BACK'.
      IF NOT html_control IS INITIAL.
        CALL METHOD html_control->free.
        FREE html_control.
      ENDIF.
      IF NOT my_container IS INITIAL.
        CALL METHOD my_container->free
          EXCEPTIONS
            OTHERS = 1.
        IF sy-subrc <0>load_html_document
       EXPORTING
            document_id  = 'HTMLCNTL_CNHTTST1_START'
       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

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

*************************************************************
* DON'T USE the NAVIGATE_COMPLETE event in application logic
*************************************************************
  METHOD on_navigate_complete.
    edurl = url.
  ENDMETHOD.

ENDCLASS.

*GUI Texts
*----------------------------------------------------------
* 001 --> HTML Control als WWW Browser
* 001 --> HTML Control as WWW browser
* 001 --> HTML-Control как WWW-браузер


****************************************************************
* This file was generated by Direct Download Enterprise. *
* Please do not change it manually. *
****************************************************************
%_DYNPRO
SAPHTML_DEMO1
0100
620
40
%_HEADER
SAPHTML_DEMO1 0100 0100 32117192 35 0 0 32117 0G D 20001113154303
%_DESCRIPTION
Initial Screen
%_FIELDS
EDURL C CHAR 132 81 02 80 00 00 1 2 0 0 0 93 1 0 0 ____________________________________________________________________________________________________________________________________
HTML 117 00 30 00 30 00 2 2 0 0 0
FCODE 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.