Show TOC

Creating Work UnitsLocate this document in the navigation structure

Context

To create a work unit, create a Web Dynpro development component with a component that defines the following:

  • Implemented Interfaces: IWorkUnit

  • Views: A set of views that defines the work unit

  • Used Components: An IWUFramework interface definition

  • Windows: Two windows:

    • A window that contains the work unit framework interface view, which provides services to the work unit.

    • A window that contains a view with the work unit functionality. It is later embedded in the work unit framework window.

The following figure shows a Web Dynpro development component that defines a work unit ( MyWorkUnitComp ) in the Web Dynpro Explorer:

The work unit development component must also define an application, whose component is MyWorkUnitComp .

The IWUFramework used component defines a set of context attributes that provide information, such as the name of the portal object being edited, to the work unit. This component also defines a set of methods to communicate with the admin studio framework.

Procedure


  1. Create a Web Dynpro development component.

  2. Set a dependency to the following DCs (SC listed in parentheses):

    • tc/ep/admin/wd/api (EP-WDC)

    • tc/ep/admin/api (EP-PSERV)

    • tc/ep/pb/wd/api (EP-WDC)

  3. Create a new component.

    A view, window and interface view are automatically created.

  4. Create a new window called IWorkUnit .

  5. Implement the IWorkUnit component interface definition as follows:

    1. Right-click Implemented Interfaces and select Add .

      The Implement Component Interfaces window is displayed.

    2. Click Add , select the IWorkUnit interface, and click OK .

      IWorkUnit is now displayed as an implemented interface. The component interface view of IWorkUnit is displayed, as well as all of the current windows. The IWorkUnit window is automatically set to implement the component interface view.

    3. Click Finish .

      The Implementation Results window opens, showing all the windows, interface views, methods, and other objects that will be added to the project as a result of implementing IWorkUnit .

    4. Click OK .

  6. Add an IWUFramework component usage, as follows:

    1. Right-click Used Components and select Add Used Component . The New Web Dynpro Component Usage dialog opens.

    2. In the Name textbox, enter IWUFramework as the name for the used component.

    3. Next to the Used Web Dynpro Component textbox, click Browse and select IWUFramework .

    4. Click Finish .

  7. In the IWorkUnit window, do the following:

    1. Right-click and select Embed view .

    2. Select Embed existing view , and click Next .

    3. Select your view.

    4. Click Finish .

  8. In the default window (created automatically with your component), do the following:

    1. Right-click and select Embed view .

    2. Select Embed Interface View of a Component Interface and click Next .

    3. Select WU_FrameworkInterfaceView from the IWUFramework component.

    4. Click Finish .

  9. For both windows, declare the IWUFramework component interface controller as a required controller, as follows:

    1. In the Required Controllers section of the Properties tab for the window, click Add .

    2. Select the IWUFramework component usage, and then click OK .

  10. For both windows, add code to the wdInit() method.

    • For the IWorkUnit window, add the following:

      WorkUnitFWUtils.activateFWUsage(wdThis.wdGetIWUFrameworkComponentUsage());
      wdThis.wdGetIWUFrameworkInterface().useDefaultImplEditModeEnabler();
      wdThis.wdGetIWUFrameworkInterface().useDefaultlImplLockingPolicy(); 
      
                                 

      The last two lines are only needed if you want to use the built in PCM edit mode enabler (checks if the user has valid permissions for editing the object) and locking policy.

    • For the window automatically generated for the component, add the following:

      WorkUnitFWUtils.createFWUsage(wdThis.wdGetIWUFrameworkComponentUsage());
                                 
      Note

      The above code assumes that you named the used component IWUFramework .

  11. In the component controller, implement the following methods:

    • doPreview() : Called when the administrator clicks the Preview button.

    • doClose() : Called when the administrator clicks the Close button.

    • doRefresh() : Called when the administrator clicks the Refresh button.

    • doSave() : Called when the administrator clicks the Save button.

    • getTitle() : Returns the title of the work unit. Currently, the text is not displayed.

    • getActions() : Returns a list of actions to add to the Portal Catalog when this work unit is active.

    You must implement doClose() , doSave() , getTitle() and getActions() , because they return objects and none has a default implementation.

  12. Create an application for the project.

  13. Create the user interface logic and implement the logic for your work unit.

  14. Create an archive from the development component and deploy it.

Results

The new work unit application is listed under the development component in the Web Dynpro Application Repository in the portal.

You can create an iView from the application, and add it to an administration studio configuration. For example, you can create an action for a custom administration studio, and specify that your work unit be run when the administrator selects the action.