sapdev logo background
sapdev logo sapdev logo
Comments

Call URL from SAP Webdynpro for ABAP ACTION




It is a simple process to create a LinktoURL UI element on one of your wdp views which points to a website URL but what if you want to use and ABAP web dynpro action to perform some ABAP functionality first and then call the URL. The simple answer is add the following code to your ACTION method and it will call display your desired URL link either in the current web page or call a new page / popup and display it in that.


Code to call a URL in new popup window

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.sapdev.co.uk'.

CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
  EXPORTING
    URL            = ld_url   "'http://www.sapdev.co.uk'
  RECEIVING
    WINDOW         = lo_window.

lo_window->open( ).


Code to call a URL in same window

  data: lo_frontend_window type ref to ig_frontend_window,
        ld_url type string.

  lo_frontend_window =   wd_this->get_frontend_window_ctr( ).

  select single url
      from zurlconfig
      into ld_url
     where sysid eq sy-sysid.

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

  lo_frontend_window->fire_op_approver_plg(
*              close_window =  'X'
    url = ld_url   "close_window must be = ' '
  ).

For this version (calls the url in the same window) you will need to add the controller for the current window to the view within the properties tab(i.e. in this example the current window is FRONTEND_WINDOW). You also need to change the references in the code above to match the name of your window.




comments powered by Disqus