How often have you seen the following UWL UI?
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
...and how often have you wished that you could have a UWL with a better UI like?
Many times in your portal implementation, you are completely revamping the look and feel of the portal and the standard UWL just doesn't fit in. You can always take the SAP-shipped PAR file and modify that to achieve the desired look and feel, but it's not easy and will probably require the decompiling of lots of classes -- and even then it can become pretty complex.
You can now use the UWL API released with NetWeaver 2004s SP9 to achieve this. The JavaDoc can be referenced from: https://www.sdn.sap.com/irj/sdn/javadocs
You can create a JSPDynpage with a JSP giving you the desired look and you can retrieve the worklist items in the following manner:
To start, please make sure that the portalapp.xml has a ServicesReference for the UWL service, like this:
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
<property name="ServicesReference" value="SAPJ2EE::library:tc~kmc~bc.uwl~api"/>
Also make sure that you have bc.uwl.service.api_api.jar file in the build path for your project. Now in the JSP proceed as follows:
The above code gets a handle to the UWL service from the portal runtime and creates a session for the current user.
The above code uses the Item Manager to get a collection of the worklist items for the current user.
The above code gives the items in a java.util.List object, which you can iterate through to retrieve the individual items and also the other details like Subject, Due Date etc.
Now the only thing that remains is to know the URL of the individual items in order to able to launch the items from the custom UWL items hyperlinks. Here it's important to know the type of the work item, i.e. whether it's coming from the Adhoc Workflow or Guided procedure or R/3 workflow.
To get the type of item do this:
String connectorId = item.getConnectorId();
This returns a string with value as AdHocWorkflowConnector or GuidedProceduresConnector or WebFlowConnector. The URL should be formed depending on the type of the item. For example, for the AdHocWorkflowConnector the default URL is:
d%3D" + item.getInternalId() + "%26action%3Dsubprocess%26item_type%
3D" + item.getItemType() + "%26external_obj_type%3D"+ item.getExternalType
() + "%26dueDate%3D" + item.getDueDate() + "%2B12%253A00%253A00.0%
26appContext%3D" + item.getAppContext() + "%26System%
item.getSubject() + "%26external_obj_id%3D" + item.getExternalObjectId() + "%
26item_id%3D" + item.getExternalId() + "%26wi_id%3D" + item.getExternalId()
Now, when you click on the link, you are presented the same work item screen that you would have got with the standard UWL.
Manish Chaitanya is working for April Business Technology Consulting Pvt. Ltd.
This content is reposted from the SAP Developer Network.
Copyright 2007, SAP Developer Network
SAP Developer Network (SDN) is an active online community where ABAP, Java, .NET, and other cutting-edge technologies converge to form a resource and collaboration channel for SAP developers, consultants, integrators, and business analysts. SDN hosts a technical library, expert blogs, exclusive downloads and code samples, an extensive eLearning catalog, and active, moderated discussion forums. SDN membership is free.