Show TOC Start of Content Area

Procedure documentation Creating Work Units  Locate the document in its SAP Library structure

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:

       One window will hold an instance of the work unit framework window, which will provide services to the work unit.

       One window will contain the view with your work unit functionality, and the window will be embedded in the work unit framework window.

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

This graphic is explained in the accompanying text

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

The IWUFramework used component interface definition defines a set of context attributes that provide information, such as the name of the portal object being edited, to the work unit. The interface also defines a set of methods to be implemented, mostly to respond to administrator actions.

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:

                            a.      Right-click Implemented Interfaces and select Add.

The Implement Component Interfaces window is displayed.

This graphic is explained in the accompanying text

                            b.      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.

This graphic is explained in the accompanying text

                            c.      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.

When you expand the object tree, the following is displayed:

This graphic is explained in the accompanying text

                            d.      Click OK.

       6.      Add an IWUFramework component usage, as follows:

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

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

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

                            d.      Click Finish.

       7.      In the IWorkUnit window, do the following:

                            a.      Right-click and select Embed view.

                            b.      Select Embed existing view,and click Next.

                            c.      Select your view.

                            d.      Click Finish.

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

                            a.      Right-click and select Embed view.

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

                            c.      Select WU_FrameworkInterfaceView from the IWUFramework component.

                            d.      Click Finish.

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

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

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

This graphic is explained in the accompanying text

   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(), as these 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.

Result

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.

 

 

 

 

End of Content Area