Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Html Viewer

Former Member
0 Likes
3,264

Hello,

i ve the following req :

i ve some pushbuttons on the container.thru 1 button i need to navigate

to an intranet web page.i tried with cl_gui_html_viewer, but i couldnt get

the right o/p.can anybody help me on how to use the method SHOW_URL.

thanks

Swaminathan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,870

hi kinshuk,

is it possible to show the URL in explorer instead of SAP screen?

i mean, my requirement is when i press the pushbutton it shud open the

concerned url in IE.

Thanks & Regards,

Swami.

8 REPLIES 8
Read only

athavanraja
Active Contributor
0 Likes
1,870

check out transaction DWDM - it has got sample programs which is easy to follow.

Regards

Raja

Read only

former_member150733
Contributor
0 Likes
1,870

You can try this method

DATA : URL TYPE STRING.

URL = 'http://sdn.sap.com/'.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

EXPORTING

DOCUMENT = URL

EXCEPTIONS

OTHERS = 1.

Regards,

Anish Thomas

Read only

Former Member
0 Likes
1,870

Hi Swaminathan,

Check the following example:

Create a screen 100 having a control area 'HTML' copy paste the following code


REPORT  ZHTML_CONTROL                 .
data: CONTENT  type standard table of char255,
      url(256) type c.
DATA: HTML_CONTROL TYPE ref to cl_gui_html_viewer,
      my_container type ref to cl_gui_custom_container,
      ui_flag type i.


call screen 100.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module STATUS_0100 output.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.


    CREATE OBJECT MY_CONTAINER
        EXPORTING
            CONTAINER_NAME = 'HTML'
        EXCEPTIONS
            OTHERS = 1.

    ui_flag = CL_GUI_HTML_VIEWER=>UIFLAG_NO3DBORDER +
              CL_GUI_HTML_VIEWER=>UIFLAG_NOIEMENU.

    create object html_control
         EXPORTING
              PARENT    = my_container
              SAPHTMLP  = 'X'
              UIFLAG    = ui_flag
              lifetime  = CL_GUI_HTML_VIEWER=>LIFETIME_DYNPRO.

url = 'http://help.sap.com'.

CALL METHOD html_control->load_data
  EXPORTING
    URL                  = url
*    TYPE                 = 'text'
*    SUBTYPE              = 'html'
*    SIZE                 = 0
    IMPORTING
      ASSIGNED_URL         = url
  CHANGING
    data_table           = content
*  EXCEPTIONS
*    DP_INVALID_PARAMETER = 1
*    DP_ERROR_GENERAL     = 2
*    CNTL_ERROR           = 3
*    others               = 4
        .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL METHOD html_control->show_url
  EXPORTING
    url                    = url
*    FRAME                  =
*    IN_PLACE               = ' X'
*  EXCEPTIONS
*    CNTL_ERROR             = 1
*    CNHT_ERROR_NOT_ALLOWED = 2
*    CNHT_ERROR_PARAMETER   = 3
*    DP_ERROR_GENERAL       = 4
*    others                 = 5
        .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


endmodule.                 " STATUS_0100  OUTPUT

Hope this helps.

Regards,

kinshuk

Read only

Former Member
0 Likes
1,870

hello kinshuk,

thank u very much. your help is invaluable.

i will be very thankful if u describe briefly about the

code.

Thanks & Regards,

Swaminathan.

Read only

0 Likes
1,870

Hi Swaminathan,

For html view control you have to follow the following steps.

describing the above example.

steps:

1. data declaration

data: CONTENT  type standard table of char255,
      url(256) type c.
DATA: HTML_CONTROL TYPE ref to cl_gui_html_viewer,
      my_container type ref to cl_gui_custom_container,
      ui_flag type i.

2. create a screen and on the screen create a control area and name it .

eg. here : screen 100 and control area name 'HTML'

3. on the PBO of the screen,

a. create container object


    CREATE OBJECT MY_CONTAINER
        EXPORTING
            CONTAINER_NAME = 'HTML'
        EXCEPTIONS
            OTHERS = 1.

b. set the ui flag for web browser (check docu)


   ui_flag = CL_GUI_HTML_VIEWER=>UIFLAG_NO3DBORDER +
              CL_GUI_HTML_VIEWER=>UIFLAG_NOIEMENU.

c. create html control object

create object html_control
         EXPORTING
              PARENT    = my_container
              SAPHTMLP  = 'X'
              UIFLAG    = ui_flag
              lifetime  = CL_GUI_HTML_VIEWER=>LIFETIME_DYNPRO.

d. set the url

url = 'http://help.sap.com'.

e. load data on to the html control

CALL METHOD html_control->load_data
  EXPORTING
    URL                  = url
*    TYPE                 = 'text'
*    SUBTYPE              = 'html'
*    SIZE                 = 0
    IMPORTING
      ASSIGNED_URL         = url
  CHANGING
    data_table           = content
*  EXCEPTIONS
*    DP_INVALID_PARAMETER = 1
*    DP_ERROR_GENERAL     = 2
*    CNTL_ERROR           = 3
*    others               = 4
        .

e. Finally show the URL on the control screen


CALL METHOD html_control->show_url
  EXPORTING
    url                    = url
*    FRAME                  =
*    IN_PLACE               = ' X'
*  EXCEPTIONS
*    CNTL_ERROR             = 1
*    CNHT_ERROR_NOT_ALLOWED = 2
*    CNHT_ERROR_PARAMETER   = 3
*    DP_ERROR_GENERAL       = 4
*    others                 = 5
        .

hope this helps.

Regards,

Kinshuk

Read only

Former Member
0 Likes
1,871

hi kinshuk,

is it possible to show the URL in explorer instead of SAP screen?

i mean, my requirement is when i press the pushbutton it shud open the

concerned url in IE.

Thanks & Regards,

Swami.

Read only

0 Likes
1,870

for that use FM

CALL_BROWSER

Regards

Raja

Reward helpful answers with points.

Read only

Former Member
0 Likes
1,870

hi raja,

thank u very much.

regards,

Swami.