2005 Aug 30 10:41 AM
Hi all,
I know that this is easy and possible too but I haven't worked on this kind yet. I need to display a screen/ABAP program like TCODE PPMDT, where an HTML page is to be displayed and on the click of the HTML links provided, I need to navigate to someother transaction codes.
Cheers,
Sam
2005 Aug 30 10:57 AM
Hi,
See this sample code
REPORT ZTESTHTML .
DATA: ok_code LIKE sy-ucomm,
myurl(132).
data: custom_container type ref to cl_gui_custom_container,
myhtml type ref to CL_GUI_HTML_VIEWER,
repid like sy-repid.
DATA events TYPE cntl_simple_events.
DATA wa_events TYPE cntl_simple_event.
----
CLASS lcl_event_receiver DEFINITION
----
........ *
----
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS NC_Handler
FOR EVENT NAVIGATE_COMPLETE OF CL_GUI_HTML_VIEWER
IMPORTING URL.
ENDCLASS.
----
CLASS lcl_event_receiver IMPLEMENTATION
----
........ *
----
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD NC_Handler.
myurl = URL.
ENDMETHOD.
ENDCLASS.
start-of-selection.
set screen 100.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
CALL METHOD myhtml->go_back
EXCEPTIONS cntl_error = 1.
if sy-subrc ne 0.
endif.
WHEN 'FORW'.
CALL METHOD myhtml->go_forward
EXCEPTIONS cntl_error = 1.
if sy-subrc ne 0.
endif.
WHEN 'STOP'.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'REFR'.
CALL METHOD myhtml->SHOW_URL
EXPORTING
URL = myurl
IN_PLACE = 'X'
FRAME = ''
EXCEPTIONS
CNTL_ERROR = 1
CNHT_ERROR_NOT_ALLOWED = 2
CNHT_ERROR_PARAMETER = 3
DP_ERROR_GENERAL = 4.
WHEN 'OTHERS'.
CALL METHOD CL_GUI_CFW=>DISPATCH.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
if myhtml is initial.
CREATE OBJECT custom_container
EXPORTING
CONTAINER_NAME = 'CONTAINER1'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT myhtml
EXPORTING
PARENT = custom_container
EXCEPTIONS
CNTL_ERROR = 1
CNTL_INSTALL_ERROR = 2
DP_INSTALL_ERROR = 3
DP_ERROR = 4.
wa_events-eventid = CL_GUI_HTML_VIEWER=>M_ID_NAVIGATE_COMPLETE .
wa_events-appl_event = 'X'.
APPEND wa_events TO events.
CALL METHOD myhtml->set_registered_events( events = events ).
SET HANDLER lcl_event_receiver=>NC_Handler FOR myhtml.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS cntl_system_error = 1
cntl_error = 2.
endif.
ENDMODULE. " STATUS_0100 OUTPUT
Svetlin
2005 Aug 30 10:44 AM
2005 Aug 30 10:46 AM
2005 Aug 30 10:49 AM
check out transaction <b>DWDM</b> for all control based program examples.
Regards
Raja
2005 Aug 30 10:52 AM
Hi,
Check this link
http://www.sapgenie.com/abap/controls/htmlviewer.htm
Hope this helps u.
Thanks&Regards,
Ruthra.R
2005 Aug 30 10:57 AM
Hi,
See this sample code
REPORT ZTESTHTML .
DATA: ok_code LIKE sy-ucomm,
myurl(132).
data: custom_container type ref to cl_gui_custom_container,
myhtml type ref to CL_GUI_HTML_VIEWER,
repid like sy-repid.
DATA events TYPE cntl_simple_events.
DATA wa_events TYPE cntl_simple_event.
----
CLASS lcl_event_receiver DEFINITION
----
........ *
----
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS NC_Handler
FOR EVENT NAVIGATE_COMPLETE OF CL_GUI_HTML_VIEWER
IMPORTING URL.
ENDCLASS.
----
CLASS lcl_event_receiver IMPLEMENTATION
----
........ *
----
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD NC_Handler.
myurl = URL.
ENDMETHOD.
ENDCLASS.
start-of-selection.
set screen 100.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
CALL METHOD myhtml->go_back
EXCEPTIONS cntl_error = 1.
if sy-subrc ne 0.
endif.
WHEN 'FORW'.
CALL METHOD myhtml->go_forward
EXCEPTIONS cntl_error = 1.
if sy-subrc ne 0.
endif.
WHEN 'STOP'.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'REFR'.
CALL METHOD myhtml->SHOW_URL
EXPORTING
URL = myurl
IN_PLACE = 'X'
FRAME = ''
EXCEPTIONS
CNTL_ERROR = 1
CNHT_ERROR_NOT_ALLOWED = 2
CNHT_ERROR_PARAMETER = 3
DP_ERROR_GENERAL = 4.
WHEN 'OTHERS'.
CALL METHOD CL_GUI_CFW=>DISPATCH.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
if myhtml is initial.
CREATE OBJECT custom_container
EXPORTING
CONTAINER_NAME = 'CONTAINER1'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT myhtml
EXPORTING
PARENT = custom_container
EXCEPTIONS
CNTL_ERROR = 1
CNTL_INSTALL_ERROR = 2
DP_INSTALL_ERROR = 3
DP_ERROR = 4.
wa_events-eventid = CL_GUI_HTML_VIEWER=>M_ID_NAVIGATE_COMPLETE .
wa_events-appl_event = 'X'.
APPEND wa_events TO events.
CALL METHOD myhtml->set_registered_events( events = events ).
SET HANDLER lcl_event_receiver=>NC_Handler FOR myhtml.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS cntl_system_error = 1
cntl_error = 2.
endif.
ENDMODULE. " STATUS_0100 OUTPUT
Svetlin
2005 Aug 30 11:28 AM
Hi all,
Thanks to everyone for your valuable suggestions. I can now go ahead creating a new screen for myself.
Cheers,
Sam