17
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com © 2009 SAP AG 1 Dialog Windows in WebDynpro ABAP Applications Applies to: WebDynpro ABAP For more information, visit the Web Dynpro ABAP homepage . Summary This document explains how to create popup dialog windows, external windows and confirmation boxes with example in WebDynpro ABAP. Author: Tulasi Palnati Company: Yash Technologies Created on: 21 September 2009 Author Bio Tulasi Palnati is an Enterprise Portal Consultant at Yash Technologies, Hyderabad-India

Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

  • Upload
    others

  • View
    24

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 1

Dialog Windows in WebDynpro

ABAP Applications

Applies to:

WebDynpro ABAP For more information, visit the Web Dynpro ABAP homepage.

Summary

This document explains how to create popup dialog windows, external windows and confirmation boxes with example in WebDynpro ABAP.

Author: Tulasi Palnati

Company: Yash Technologies

Created on: 21 September 2009

Author Bio

Tulasi Palnati is an Enterprise Portal Consultant at Yash Technologies, Hyderabad-India

Page 2: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 2

Dialog Boxes in Web Dynpro Applications

Procedure: .......................................................................................................................................................... 3

Create a WebDynpro Component ................................................................................................................... 3

Create a Context to hold data in the component controller and define methods............................................ 4

Create New Window and View for Dialog box. ............................................................................................... 6

Design the Layout for EMAILVIEW and Bind the context to UI Elements ...................................................... 7

Design the Layout for ADDRESSBOOKVIEW and Bind the context to UI Elements ................................... 10

Output: .............................................................................................................................................................. 13

Related Content ................................................................................................................................................ 16

Disclaimer and Liability Notice .......................................................................................................................... 17

Page 3: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 3

The Task

The starting point is the application for sending an e-mail. This application contains an input form for the e-mail addresses of the sender and the recipient, the subject, and the text.

The task of this tutorial is to assign functions to the To, Search (Google), and Send Email pushbuttons (see figure).

If you choose to, a new Web Dynpro window containing a simple address book is displayed in a dialog box. If you select an address in this dialog box, this is written to the input field for the recipient address.

If you choose Search (Google), an external window, which is assigned a URL address (for example, http://www.google.com), opens.

If you choose Send Email, a confirmation dialog box containing two pushbuttons appears. Ok closes the dialog box and new email closes the dialog box and deletes the content of the input form.

Procedure:

Create a WebDynpro Component

1. Create a new WebDynpro component by the name YDIALOGWINDOWS and view name is EMAILVIEW

2. Create Web Dynpro Application by the name Ydialogwindows

Page 4: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 4

Create a Context to hold data in the component controller and define methods.

3. Double click on Component controller. Go to Context tab

4. Create Node Address book of cardinality 0..n with attributes Email and Name as of type String.

5. Create Node EMailSetting of Cardinality 1..1 with attributes TOADDRESS,FROMADDRESS,MSGBODY,SUBJECT as of type String.

6. The Context of the controller looks as below:

7. Delcare the Global Variables gr_window of type IF_WD_WINDOW.

Page 5: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 5

8. Delcare the Methods ShowAddressbookPopup and HideAddressBookPopup in the Component Controller which are should be called in views.

9. Copy and paste the below code into your methods.

Page 6: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 6

Create New Window and View for Dialog box.

10. Create New Window with name ADDRESSBOOKWINDOW for addressbook Dialog box. Create New View with name ADDRESSBOOKVIEW.

Page 7: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 7

Design the Layout for EMAILVIEW and Bind the context to UI Elements

11. Drag and Drop the Context of controller to the EMAILVIEW Context. Design the layout as below.

12. Create an action ToAddress and bind to the To button. Create an action ToSearch and bind to Search button. Create an action SendMail and bind it to Sendmail button.

Page 8: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 8

13. Copy the below codes to the action TOADDRESS, TOSEARCH and SENDMAIL.

Page 9: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 9

14. Create two actions for the Confirmation Dialog Box i.e., OK and NEW_EMAIL.

15. Copy the below code Onaction NEW_EMAIL.

Page 10: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 10

Design the Layout for ADDRESSBOOKVIEW and Bind the context to UI Elements

16. Drag and Drop the Context of controller to the ADDRESSBOOKVIEW Context. Design the layout as below.

17. Create an action ADDRESSBOOK bind it to the Toolbar button.

18. Copy the below Code to action ADDRESSBOOKVIEW.

Page 11: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 11

19. Populate the static data to the Address book Table. Copy the below code into WDDOINIT() method of ADDRESSBOOKVIEW.

Page 12: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 12

20. Embed the ADDRESSBOOKVIEW into ADDRESSBOOKWINDOW.

21. Save, Activate all the objects and Test it.

Page 13: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 13

Output:

Fill the data of the screen as required. When you choose To, a dialog box displaying the address book appears.

If you complete the e-mail form and choose Send Email, the confirmation window appears.

Page 14: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 14

If you click on NEW EMAIL then it resets the form.

When you choose Search (toGoogle), an external window displaying the Google homepage appears.

Page 15: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 15

Page 16: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 16

Related Content

Use POP UPs

WebDynpro ABAP HomePage

Sample Example in WebDynpro JAVA

Page 17: Dialog Windows in WebDynpro ABAP Applications Windows in...Dialog Windows in WebDynpro ABAP Applications SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

Dialog Windows in WebDynpro ABAP Applications

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com

© 2009 SAP AG 17

Disclaimer and Liability Notice

This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.