cancel
Showing results for 
Search instead for 
Did you mean: 

Call of URL in new browser window ?

Former Member
0 Kudos

Hi,

is there a function module or method in a class where it is possible to open a browser window with an specific URL and with window size as parameter !

lets say i want to open the site "www.google.com" in a seperate IE window with a specific height and place.

any ideas ?

br Martin

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Martin,

I just tested in my sandbox and it works like a charm the way I described in my earlier post.

What you need to do.

1. Create a "modal dialogue box"(Screen attributes tab) screen in my Example it is 9000. Create a custom control and name that "HTML" in the Layout of the screen.

2. Please find below the code.

REPORT ZZTEST.

DATA: html_control TYPE REF TO cl_gui_html_viewer,

       my_container TYPE REF TO cl_gui_custom_container.

parameters : p_url type char80 LOWER CASE OBLIGATORY.

call screen 9000 STARTING AT 10 5. ( The position of the window )

*&---------------------------------------------------------------------*

*&      Module  STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE status_9000 OUTPUT.

   SET PF-STATUS 'URLNAV'.

   SET TITLEBAR 'For fun'.

     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_9000  OUTPUT

*&---------------------------------------------------------------------*

*&      Form  LOAD_HOME_PAGE

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM load_home_page .

       CALL METHOD html_control->show_url

          EXPORTING

               url       = p_url.

ENDFORM.                    " LOAD_HOME_PAGE

*&---------------------------------------------------------------------*

*&      Module  USER_COMMAND_9000  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE user_command_9000 INPUT.

   leave to screen 0.

ENDMODULE.                 " USER_COMMAND_9000  INPUT



3. Bingo : The output


Former Member
0 Kudos

hi roy,

thank you, i will try this next week as i am on vacation until monday and have no access to SAP.

one question remains: why is there not a simple  function module/method to do such simple things like displaying an url ? why do i need this long coding for that ?

br Martin

Former Member
0 Kudos

It is not long Martin. May be you are on holiday mood that is why you are finding it long. .

But good suggestion: May be you can create a method / FM for your project for this. so that you anybody can re-use it.

I copied some of the code from the standard program I mentioned in my earlier post. It hardly took me 15 mins to develop this.

Anyway enjoy your holiday. Let me know how it goes.

Cheers

R

Former Member
0 Kudos

Hi Martin,

I just found out the you can simply use this also. Or else the earlier method will anyway work.

Please check.

CALL METHOD cl_abap_browser=>show_url

   EXPORTING

     url          = 'www.google.com'

*    title        =

*    size         = CL_ABAP_BROWSER=>MEDIUM

*    modal        = ABAP_TRUE

*    printing     = ABAP_FALSE

*    buttons      = NAVIGATE_OFF

*    format       = CL_ABAP_BROWSER=>LANDSCAPE

*    position     = CL_ABAP_BROWSER=>TOPLEFT

*    container    =

*    context_menu = ABAP_FALSE

     .


R

Former Member
0 Kudos

Hi Roy,

sorry, but none of your proposal is working:

the call of cl_abap_browser=>show_url brings an exception "CNTL_ERROR" in NWBC, i already mentioned that

The second options -> your coding in the ZZTEST program with the call screen is not possible.

When checking the coding i get the error:

For a class-pool it is not possible to define dynpros. Therefore the Statement "CALL SCREEN" is not possible.


I have to do the coding in an enhancement at the end of an method of a POWL-application.

br Martin

Former Member
0 Kudos

Hi Martin,

It is quite easy to open up a url in a new tab. Use this sample code

data: lo_window_manager type ref to if_wd_window_manager.

data: lo_api_component type ref to if_wd_component.

data: lo_window type ref to if_wd_window.

data: ld_url type string.

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

ld_url = 'http://www.itelligence.dk'.

CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW

  EXPORTING

  URL = ld_url "'http://www.sapdev.co.uk'

  RECEIVING

  WINDOW = lo_window.

lo_window->open( ).

     .


This was tested using an existing web dynpro application to open up the url.


Is this what you were looking for?

Former Member
0 Kudos

hi jakob,

i already have tried this, but:

wd_comp_controller is not known ! how to define this ?


br Martin

Former Member
0 Kudos

Hi Martin,

That is because my development is done on a web dynpro for abap component. I assume you are doing your in a GUI program?

Former Member
0 Kudos

well, i am using an enhancement at the end of method "HANDLE_ACTION" of an POWL feeder class -> so this is web dynpro abap ?!?

br Martin

nomssi
Active Contributor
0 Kudos

I suggest to try CL_ABAP_BROWSER=>SHOW_URL( url = 'http://www.google.com' ).

Note you have no fine grained control on the window size, just MEDIUM, LARGE and so on.

regards,

JNN

Former Member
0 Kudos

same situation as with other medhods it is not working within NWBC, and i have no idea why

When calling CL_ABAP_BROWSER=>SHOW_URL i get the following error

br, Martin

matt
Active Contributor
0 Kudos

The proposed solutions are all designed to work with SAPGui (that's what the CNTL error means). I'm moving your post to the NWBC space.

Former Member
0 Kudos

thank you.......but i can't believe that there is NO possibility to do it in NWBC ????

any ideas ?

br Martin

matt
Active Contributor
0 Kudos

I've moved your post to a specialist space. You were getting standard SAPGui answers from people who don't know NWBC either, which as you've seen is no use. NWBC has its own programming model.

What you want to do may well be possible. I can't say either way as I've no experience of NWBC, nor do I have access to a site that's using it

Former Member
0 Kudos

thank you very much for your answers, but it is not working

when i do the following inside a method which is called in side NWBC:

call method cl_gui_frontend_services=>execute

  exporting

*   document = 'http://www.google.com'

    application = 'http://www.google.com'

    exceptions

    others   = 1.

i get sy-subrc = 1  no window opens up with "www.google.com"

when test this in SE80 with F8 with exactly the same parameters it is working ! a browswer windows opens up and www.google.com is displayed.

so why this is working with sap gui but not inside NWBC ?

br Martin

raymond_giuseppi
Active Contributor
0 Kudos

Execute with cl_gui_frontend_services=>execute passing a string built from concatenation of 'iexplore.exe' some command line options and your url. (you can only pass url if no switches)

Hint: for available command line switches, look in Internet Explorer 11 Technical Library (or your version) or search at technet or msdn.microsoft.com

Regards,

Raymond

Former Member
0 Kudos

Please check program SAPHTML_DEMO1 . You will get an idea. What you want is possible.

There are classes like  cl_gui_html_viewer method  show_url_in_browser that you may eventually have to call.

Check FM DOC_DISPLAY_URL also . It is more inclined towards your requirement. But cannot be called directly but you will get the idea.

former_member204264
Participant
0 Kudos

Hi Martin,

You can open a link in a Web browser calling ' cl_gui_frontend_services=>execute' method. See more details in this thread:

Regards.

Luis