Scenario: In this case two web dynpro components/applications are there. One web dynpro application calls another web dynrpo application based on user interaction (Button Click).
Step1. Create a web dynpro component in SE80.
Step2. Provide description and continue.
Step3. In the VIEW just design your UI. In this case for the demo purpose we have taken a text .
Step4. Create a application by navigating along the highlighted path.
Step5. Provide an application Name and click on continue button. This application name is useful later from the web dynpro component who is calling it.
Step6. Click on Save and then click on test button.
Step7. The Application appears.
Step8. Create another application who is going to call the previous created application.
Step9. Provide short text and continue.
Step10. In the View create a text element.
Step11. Place a button on the View and provide the button text. As per our demo, while this user click on this button this would call another web dynpro application. In the events section, click on the CREATE button for the OnAction option.
Step12. Provide an Action name and description and at last click on Continue button.
Step13. In the attribute section, double click on the Interface which provides some api methods used later.
Step14. Click on the Actions Tab and double click on the Event Handler method name for the above created button event.
Step15. Provide the below code in the method.
________________________________________________________________________________
METHOD onactioncall_ant_appl .
DATA : o_comp TYPE REF TO if_wd_component.
" CALL API METHOD TO GET THE REFERENCE OF THE COMPONNET CONTROLLER
CALL METHOD wd_comp_controller->wd_get_api
RECEIVING
result = o_comp.
DATA : wdw_mgr TYPE REF TO if_wd_window_manager.
" CALL BELOW METHOD TO GET THE REFERENCE OF WINDOW MANAGER
CALL METHOD o_comp->get_window_manager
RECEIVING
window_manager = wdw_mgr. " Reference to Window Manager
DATA : appl_url TYPE string.
" CALL THIS METHOS TO GET THE URL OF THE WEB DYNPRO APPLICATION TO BE CALLED
CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = 'ZWD_COMP_CALLED_APPL' " Application
IMPORTING
out_absolute_url = appl_url. " Absolute URL (Incl. Log, Host, Port)
DATA : wdw TYPE REF TO if_wd_window.
" CALL THE BELOW METHOD TO CRETAE A WINDOW BY PASSING THE URL
CALL METHOD wdw_mgr->create_external_window
EXPORTING
url = appl_url
RECEIVING
window = wdw.
" CALL BELOW METHOD TO OPEN THE WINDOW
CALL METHOD wdw->open.
ENDMETHOD.
_________________________________________________________________________________
Step16. Create an application.
Step17. Save the application name and test it.
Step18. The window is appeared. now click on the Button.
Step19. The button click calls another web dynpro application window.
________________________________________________________________________________
Step1. Create a web dynpro component in SE80.
Step2. Provide description and continue.
Step3. In the VIEW just design your UI. In this case for the demo purpose we have taken a text .
Step4. Create a application by navigating along the highlighted path.
Step5. Provide an application Name and click on continue button. This application name is useful later from the web dynpro component who is calling it.
Step6. Click on Save and then click on test button.
Step7. The Application appears.
Step8. Create another application who is going to call the previous created application.
Step9. Provide short text and continue.
Step10. In the View create a text element.
Step11. Place a button on the View and provide the button text. As per our demo, while this user click on this button this would call another web dynpro application. In the events section, click on the CREATE button for the OnAction option.
Step12. Provide an Action name and description and at last click on Continue button.
Step13. In the attribute section, double click on the Interface which provides some api methods used later.
Step14. Click on the Actions Tab and double click on the Event Handler method name for the above created button event.
Step15. Provide the below code in the method.
________________________________________________________________________________
METHOD onactioncall_ant_appl .
DATA : o_comp TYPE REF TO if_wd_component.
" CALL API METHOD TO GET THE REFERENCE OF THE COMPONNET CONTROLLER
CALL METHOD wd_comp_controller->wd_get_api
RECEIVING
result = o_comp.
DATA : wdw_mgr TYPE REF TO if_wd_window_manager.
" CALL BELOW METHOD TO GET THE REFERENCE OF WINDOW MANAGER
CALL METHOD o_comp->get_window_manager
RECEIVING
window_manager = wdw_mgr. " Reference to Window Manager
DATA : appl_url TYPE string.
" CALL THIS METHOS TO GET THE URL OF THE WEB DYNPRO APPLICATION TO BE CALLED
CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = 'ZWD_COMP_CALLED_APPL' " Application
IMPORTING
out_absolute_url = appl_url. " Absolute URL (Incl. Log, Host, Port)
DATA : wdw TYPE REF TO if_wd_window.
" CALL THE BELOW METHOD TO CRETAE A WINDOW BY PASSING THE URL
CALL METHOD wdw_mgr->create_external_window
EXPORTING
url = appl_url
RECEIVING
window = wdw.
" CALL BELOW METHOD TO OPEN THE WINDOW
CALL METHOD wdw->open.
ENDMETHOD.
_________________________________________________________________________________
Step16. Create an application.
Step17. Save the application name and test it.
Step18. The window is appeared. now click on the Button.
Step19. The button click calls another web dynpro application window.
________________________________________________________________________________
No comments:
Post a Comment