Start of Content Area

Procedure documentation Creating Your Own Dialogs Locate the document in its SAP Library structure

Use

Using your own dialogs, you can generate your own HTML pages and call them from Web applications. To do this, you create your own ABAP class that inherits the associated properties and parameters from the CL_RSR_WWW_HELP_WINDOW class, and you redefine one or more methods for this class. In your own ABAP class, you create the HTML code or create an URL for redirecting.

The ABAP class permits access to the current navigational state of the Web application. Within the ABAP class, you can process commands and call any ABAP code (function modules and so on). In this way, you can display data as checkboxes, to change it, and then write it to database tables using ABAP function modules.

Note

You can use your own Business Server Page (BSP) applications as an alternative to this procedure. BSP applications, however, cannot access the current navigational state of the Web application. For more information, see Structure linkBusiness Server Pages.

By using your own dialogs, it is possible to redirect URLs. Additional parameters can be added to URLs; these parameters are not known when the Web application is first called. If the parameters are known during the first call, they can be inserted into the HTML code as JavaScript variables using the Web Design API for tables. Often, however, parameters are only required for specific, rare user actions. In these cases, for performance and network reasons, it is advisable to determine the parameters using your own dialog.

If standalone HTML pages or redirects are not required, and instead only parts of the Web application need to be changed, it advisable to use the Web Design API for Tables or JavaScript functions.

Prerequisites

You have created a Web application that contains at least one Web item. This Web item is required to be able to use the ABAP class in the Web template (see below).

Procedure

Creating an ABAP Class

...

       1.      On the SAP Easy Access screen, choose Tools ® ABAP Workbench ® Development ® Class Builder (transaction SE24). See also Structure linkClass Builder.

Note

You can also use the Object Navigator from the ABAP Workbench (transaction SE80) to generate a class. See also Structure linkObject Navigator.

       2.      To create a new class, under Object Type, enter a technical name for your class (such as ZCL_RSR_WWW_HELP_WINDOW) and choose This graphic is explained in the accompanying text with the quick info text Create. The Create Class YourClassName dialog box appears.

       3.      Save your class. The Create Object Catalog screen appears.

       4.      Depending on the system configuration for changes and object transports, either choose a package or save your class as a local object. For more information, contact your system administrator. The Class Builder: Change Class YOUR CLASS NAME screen appears.

       5.      Choose Superclass on the Properties tab page. Under Inherits from, enter CL_RSR_WWW_HELP_WINDOW as the superclass.

       6.      To display all the inherited properties and methods of the CL_RSR_WWW_HELP_WINDOW class in your ABAP class, choose This graphic is explained in the accompanying text with the quick info text Save.

       7.      On the Methods tab page, choose the PROCESS_CMD method that you want to redefine and choose This graphic is explained in the accompanying text with the quick info text Redefine.

       8.      To change the implementation of the method, call it by double-clicking the method name.

       9.      To return to the original screen, choose This graphic is explained in the accompanying text with the quick info text Back.

   10.      Save your changes.

   11.      To activate your changes, choose This graphic is explained in the accompanying text with the quick info text Activate.

Using the PROCESS_CMD ABAP Method

     The ABAP method PROCESS_CMD is automatically called by the Web application framework when you call your own dialog from a Web application. Using this method, the commands received and their parameters can be processed.

     The commands and parameters from the URL are transferred to the PROCESS_CMD method in the import parameter I_R_PARAMETER. Using the ABAP method I_R_PARAMTER->GET, individual commands and parameters can be queried.

     Information from the Web application framework can be accessed using the attribute N_R_PAGE.

Example 

    data: l_cmd type string.

    l_cmd = i_r_parameter->get( i_id = cl_rsr_www_page=>c_parameter_subcmd ).

     For better structuring, it is advisable to distribute processing of individual commands across separate ABAP methods. These methods generate the HTML.

     The result of the ABAP method PROCESS_CMD can be an HTML page or a URL redirect. The HTML page is returned to the N_SX_OUTPUT-STRING attribute as a character string. The URL is returned in the attribute N_SX_OUTPUT-REDIRECT_URL.

Using an ABAP Class in a Web Template

   12.      To use the ABAP class you created, it must be included in a Web template.

...

       1.      Open your Web template, which includes at least one Web item, in the BEx Web Application Designer.

       2.      To switch to the HTML view of the Web Application Designer, choose the HTML tab page.

       3.      Navigate to the object tag of the Web item and insert the following parameter lines into the HTML to make the ABAP class known as HELP_SERVICE within the Web template.

<object>…

<param name="HELP_SERVICE" value=“YourDialog"/>

<param name=“ HELP_SERVICE_CLASS “ value=”YourClassName”/>

…</object>

Example

<object>…

<param name=“HELP_SERVICE “ value=”DIALOG_1”/>

<param name=“HELP_SERVICE_CLASS“ value=” ZCL_RSR_WWW_HELP_WINDOW”/>

…</object>

The parameter HELP_SERVICE contains the name of your dialog within the Web template. The parameter HELP_SERVICE_CLASS includes the name of the ABAP class.

Caution

Note that the parameter HELP_SERVICE must be inserted into a Web item. Data providers may not be used because data providers with HELP_SERVICE are not supported for bookmarks.

Insert a command URL as a hyperlink, context menu, or form. You must specify values for the parameters CMD, HELP_SERVICE, and ITEM. You can also attach your own optional commands (such as SUBCMD).

Example

Example in HTML

<a href="<SAP_BW_URL CMD='PROCESS_HELP_WINDOW’ HELP_SERVICE='DIALOG_1’ ITEM=’TABLE_1’ SUBCMD=’COMMAND_2’>">Open Dialog</a>

Example in JavaScript

SAPBWOpenURL( SAP_BW_URL_Get()

        + "&CMD=PROCESS_HELP_WINDOW”

        + “&HELP_SERVICE=DIALOG_1”

        + “&ITEM=TABLE_1”

        + “&SUBCMD=COMMAND_2");

For more information about calling dialogs, see Save Query View Dialog Box.

       4.      Save the changes.

       5.      Execute the Web template in the browser.

Note

Note that existing bookmarks for a Web template into which you have since integrated your own dialog (HELP_SERVICE) do not recognize this dialog. Recreate the bookmarks so that the new bookmarks recognize the dialog. In addition to the current navigational state (data provider), bookmarks also save the current state of the Web item.

Debugging the ABAP Class

For more information about debugging ABAP classes in Web applications, see Creating and Using ABAP Classes.

Result

You have created an ABAP class and have redefined one or more methods to extend a Web application with your own HTML pages.

 

 

End of Content Area