Wednesday 22 February 2012


Calling an URL on click of a button (Web Dynpro for ABAP)


1. Create one Webdynpro Application ZWA_CALLING_URL, and Save it in the ‘Local Object’.
2. In the View, Right click the ROOTUIELEMENTCONTAINER and give Insert Element. It will open a Pop-Up for Creating an Element. 
 
3. Enter ‘BUTTON’ in the Name Field and Select ‘Button’ from the Dropdown for the Typ Field and   Press Enter. 
 
4. In the Text Field of the Button Properties, Give Click.  
5. In the OnAction of the Button Properties, Click Create Action Button. Give the Action Name as GENERATE_URL and Press Enter. 
 
6. In the Methods Tab of the View, Go to the Method ONACTIONGENERATE_URL , and Paste the Following 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.
lo_api_component  = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW
  EXPORTING
    URL            = 'http://www.google.co.in/'
    MODAL          = ABAP_FALSE
    HAS_MENUBAR    = ABAP_TRUE
    IS_RESIZABLE   = ABAP_TRUE
    HAS_SCROLLBARS = ABAP_TRUE
    HAS_STATUSBAR  = ABAP_TRUE
    HAS_TOOLBAR    = ABAP_TRUE
    HAS_LOCATION   = ABAP_TRUE
  RECEIVING
    WINDOW         = lo_window.
lo_window->open( ). 
7. Save and Activate the Application. 
 
8. Test the Application. 
9. After Clicking the Click Button, It will open the New Window with URL  ‘http://www.google.co.in/’. (as seen in the following screenshot) 

No comments:

Post a Comment