Show TOC

DEMO_POPUPS_01Locate this document in the navigation structure

Use

Application DEMO_POPUPS_01 of the DEMO_POPUPS_01 component in teh package SWDP_DEMO shows a demo application for dialog boxes where the dialog box and main window belong to the same component.

Application DEMO_POPUPS_01 demonstrates the following aspects when dealing with dialog boxes in Web Dynpro ABAP:

  • Creating, opening, and closing a dialog box where its window belongs to the same component as the calling controller.

  • Setting some dialog box properties

  • Registering action handlers on the dialog box buttons

  • Closing the dialog box depending on a condition

The following first explains the process and use of the application in general and then deals with the individual relevant methods of the related components more deeply.

Note

For general information about dialog boxes, see Working with Dialog Boxes .

General Functions and Use of DEMO_POPUPS_01

Application DEMO_POPUPS_01 makes it possible to set different dialog box properties dynamically and to check their effect on the appearance and behavior of the dialog box.

The following properties can be set:

  • Title of the dialog box

  • Dialog box buttons

  • Default button

  • Icons that you want to display in the dialog box

  • Cancel symbol

  • Flag if the dialog box is to be closed automatically with a click on a dialog box button

Title of the Dialog Box

If the title is not set then the title of the parent dialog box is displayed. If the dialog box does not have a parent dialog box then the description text of the application is used as the title of the dialog box. If the application does not have a description text then the name of the application is used as the title followed by the text Web Dynpro ABAP .

Dialog Box Buttons

You can choose one of the following combinations of dialog box buttons:

  • OK

  • Close

  • OK, Close

  • Yes, No

  • Yes, No, Cancel

  • Cancel, Retry, Ignore

Default Button

You can mark a specific button from one of the button combinations mentioned above as a Default Button . This button is then shown as focussed. In addition to this, pressing the Enter button in the dialog box executes the action that belongs to the default button (if one has been registered).

Icons

An icon can be displayed in the dialog box. The following icons are available:

  • Information

  • Error

  • Terminating

  • Warning

Note

Note that the Question icon is obsolete . Therefore selecting this icon has no effect.

Cancel Symbol

Sie können angeben, ob das Dialogfenster ein Abbrechen -Symbol (kleines Kreuz im rechten oberen Rand) erhalten soll.

Closing Dialog Boxes Automatically

If no action is registered to a dialog box button then the dialog box is automatically closed with a click on this button. However, if actions are registered to the dialog box buttons, then you can specify whether the dialog box is to close automatically with a click on one of the buttons (standard behavior) or not. This is of particular interest if a dialog box is to be closed when a particular condition applies.

You can deactivate the automatic closing of a dialog box by deleting the selection next to the Close Dialog Box Automatically checkbox in the DEMO_POPUPS_01 application.

Creating and Opening the Dialog Box

The dialog box is created and opened in the Action Handler ONACTIONSHOW_POPUP of the MAIN view. This method also reads the dialog box properties selected by the user from the related context node. These properties can be set directly (as in the example) when creating the dialog box or later using the programming interface IF_WD_WINDOW .

Registering action handlers on the dialog box buttons

The V_POPUP_01 view is embedded in the POPUP_01 window of the dialog box. Actions are registered to dialog box buttons in the WDDOINIT method of this view. The related actions are in the V_POPUP_01 view.

You register the action by checking the Registering Actions to Buttons of a Dialog Box checkbox in the DEMO_POPUPS_01 application.

Closing the Dialog Box Depending on a Condition

When creating the dialog box (in the ONACTIONSHOW_POPUP Action Handler of the MAIN view), the CLOSE_IN_ANY_CASE parameters controls if the dialog box is to be closed automatically with a click on a dialog box button ( Close Dialog Box Automatically checkbox). If this is not the case (parameter CLOSE_IN_ANY_CASE has the value ABAP_FALSE), then the dialog box has to be closed explicitly. This involves the following steps:

  • Registering actions to all dialog box buttons of the selected button combination

    Note

    If no action is registered to a button then the dialog box is not closed automatically with a click on this button.

  • Closing the dialog box in all registered actions (see, for example, action YES of the V_POPUP_01 view) might depend on a condition

  • If a Cancel button is included in the selected button combination, it normally makes sense to chose the dialog box in all situations, irrespective of any possible errors. If automatic closing is deactivated for the dialog box, then this must be executed explictly in an action registered to the Cancel button as described above. For this action to be executed when there is an error, flag the action as Validation-Independent .