Skip to Content
author's profile photo
Former Member

Controller (MVC) should open page in an new Browser Window

Hi,

I would like to open a page in a new browser window out of a controller.

In the end there are too pages. The first one is the only view of the main controller. It contains a list of documents which can be selected. By clicking on a document another window should open containing a pdf document (using PDF Plugin of IE).

For security reasons it is not possible to use javascript. The URL of the pdf document is not allowed to be displayed anywhere in the browser. That is why I would like to realize a frameset one the second page. The second page is a simple BSP page not a view.

I need something like:

navigation->goto_page_open_in_new_window( url = 'myPage.htm' )

Thanks for your help.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Mar 24, 2004 at 10:48 PM

    in order to open a new window you must issue window.open (JavaScript) which must have a URL as its argument. If anyone knows another way, please post it here.

    But you can hide the URL. Put the window.open command in a function within a JavaScript file, and simply refer to the file in your HTML, like this:

    <script type="text/javascript" language="javascript" src="myfile.js">

    </script>

    The source code of the file myfile.js is not visible.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello,

      for such cases I use a own method with coding as follows:

      DATA: lv_contract_num TYPE string.

      DATA: lv_tirepolicy(6) TYPE n.

      DATA: lv_help_window TYPE string VALUE 'INHELP'.

      DATA: l_urls TYPE tihttpurls2,

      l_url TYPE ihttpurls2,

      lv_tp TYPE string.

      TRANSLATE gv_type TO UPPER CASE.

      CALL METHOD cl_http_server=>get_extension_info

      EXPORTING

      extension_class = 'cl_http_ext_bsp'

      IMPORTING

      urls = l_urls.

      TRANSLATE me->http TO LOWER CASE.

      READ TABLE l_urls INTO l_url WITH KEY protocol = me->http.

      IF sy-subrc = 0.

      CONCATENATE

      l_url-protocol

      '://'

      l_url-host

      ':'

      l_url-port

      l_url-url

      '<your BSP>/<your page name>.htm'

      '?'

      'param1'

      '='

      lv_param1

      '&'

      'param2'

      '='

      lv_param2

      '&'

      'sap-syscmd=nocookie'

      '&'

      'sap-client='

      sy-mandt

      INTO lv_tp.

      CONCATENATE

      '<script type="text/javascript">'

      ' '

      'NW'

      lv_param1

      ' '

      '='

      ' '

      'window.open( '

      '"'

      lv_tp

      '"'

      ','

      '"'

      '<your Window name>'

      '"'

      ','

      '"'

      'resizable=yes,status=yes,scrollbars=yes,menubar=no,Width=850,'

      'Height=650,top=20,left=30'

      '"'

      ' );'

      ' '

      '</SCRIPT>'

      INTO rv_onclick_string.

      The rv_onclick_string can provided as URL for an Onclick event or can be pasted on your HTML-Code and if contains data you open by default:

      <%

      if model->GV_ONCLICK_string is not initial. %>

      <%= model->GV_ONCLICK_string%>

      <%

      clear: model->GV_ONCLICK_jobsheet.

      %>

      <%

      endif.

      %>

      Regards, Bernd