on 05-28-2015 3:23 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.