Skip to Content
Author's profile photo Former Member

Custom WDJ Application to process Tasks using BPM JAVA API in NWDS 7.3

Hi Everyone,

This is my first blog.Hope you all will read it & give me your valuable suggestions regarding the content.

The objective of the blog is to create a very simple custom WDJ Application to process tasks using BPM JAVA API in NWDS 7.3 instead of using Universal Worklist provided by SAP. Though SAP provided us an user inbox under Universal Worklist Tab in Portal.But some time client want a customized user inbox created using WDJ Application.With the Business Process Management (BPM) application programming interfaces (API’s), we can customize and enhance the way we use business processes and execute tasks and can design user friendly inbox for better user experience and performances.


1.0.Install SAP Net weaver Developer Studio (NWDS 7.3).

2.0.BPEM End User & Every User Core Role should be assigned to user.

3.0.Create the Web Dynpro Java Application in NWDS 7.3

3.1. Create a WebDynpro Java DC comprising of one component controller,view and application inside it. Iamge_1.JPG

Add following  dependencies to the Web Dynpro Java DC through Component Properties View.

a)tc/bpem/façade/ear  – BPEM-FAÇADE

b)tc/je/sdo21/pi – ENFCADE


Add following Application Properties to enable the default Logon Portal Page into WDJ application.



Description:Authentication Mode

3.4. Create a node “Task” with the attributes CreationDate,ID,Name and URL in both Component Controller(New1Comp) and View Controller(New1CompView) and create context mapping also. Image_4.JPG
3.5. Create a view with a label and a table with four columns Name,ID, CreationTime and URL and assigned an event for the “onSelect” property of the table. Image_5.JPG

3.6. Create one action “OnSelectTask” and implemented the following code inside it.

public void onActionOnSelectTask ( wdEvent )
            String url=wdContext.currentTaskElement().getURL();

3.7.In Component Controller implemented following codes in wdDoInit() and LinkToOpenTask( java.lang.String url )methods.

public void wdDoInit()
ArrayList<TaskDetail> testList = new ArrayList<TaskDetail>();
try {
//To get the logged on user details
IUser user = UMFactory.getAuthenticator().getLoggedInUser();
      String firstName = user.getFirstName();
      String lastName = user.getLastName();
      String userName = firstName != null ? firstName + " " + lastName: lastName;  
      wdComponentAPI.getMessageManager().reportSuccess("Welcome "+userName);
// Retrieve the TaskInstanceManager.
TaskInstanceManager taskInstanceManager = BPMFactory.getTaskInstanceManager() ;
// Build the set of statuses to query.
Typically, use READY, RESERVED and IN_PROGRESS statuses, which mean that the tasks are ready to work on and the user is a potential or actual owner of the task.
HashSet<Status> statuses = new HashSet<Status> ();
// Query those statuses.
The returned set contains TaskAbstracts, which are basic descriptions of a task instance and thus contain the required information to build up the task worklist. The method always executes the query for the user who is currently logged in and returns texts in the locale which is set for the user.
Set<TaskAbstract> myTasks = taskInstanceManager.getMyTaskAbstracts(statuses);
//Use Iterator of type TaskAbstract to loop trough the myTasks.
Iterator<TaskAbstract> taskIter = myTasks.iterator();
URL taskExecutionURL=null;
//Get single Task
TaskAbstract myTask =;
// Get the ID of the Task. taskInstanceId = myTask.getId();
// Use the ID of a task instance to generate the URL of the task execution UI. This can then be opened as an action, for example when the user clicks the task.                
taskExecutionURL = taskInstanceManager.generateTaskExecutionUrl(taskInstanceId);
TaskDetail taskDetail = taskInstanceManager.getTaskDetail(taskInstanceId);
// Filter the tasks for the current year “2013”
if((""+myTask.getCreatedTime()).contains("2013") ){
IPublicNew1Comp.ITaskElement Ele =wdContext.nodeTask().createTaskElement();
catch (BPMException e) {
// TODO Auto-generated catch block

public void LinkToOpenTask( java.lang.String url )  {
//Open window to view the Task
IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(url, "Task",false);;

3.8. Build,Deploy & Run the application

4.0. Result:

4.1. Logon Screen:- Image_6.JPG
4.2. User will be able to see all the listed tasks and click on selected task and perform it. Image_7.JPG

Thanks & Regards,

Patralekha Sur

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Siddhant Bhatankar
      Siddhant Bhatankar

      Very very useful document.

      Author's profile photo Former Member
      Former Member

      Thanks for sharing. Very helpful!