cancel
Showing results for 
Search instead for 
Did you mean: 

UWL Item URL Links

0 Kudos

Hello Experts,

I have created a Webdynpro application in which i have the UWK Items. I am able to read all the properties of the items.

But I don't know how to create the URL for the specific ITEMS, to open the item, when clicked.

Can you please provide me information of how to create the specific Item URLs, which i can link to the Item.

Regards,

Gursimran Singh

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hello Experts,

Please help on this issue.

Regards

Former Member
0 Kudos

Hi,

Try the following

package samplepackage;

import java.util.Iterator;

import java.util.Locale;

import java.util.Properties;

import javax.naming.InitialContext;

import javax.naming.NamingException;

import com.sap.netweaver.bc.uwl.IUWLItemManager;

import com.sap.netweaver.bc.uwl.IUWLService;

import com.sap.netweaver.bc.uwl.IUWLSession;

import com.sap.netweaver.bc.uwl.Item;

import com.sap.netweaver.bc.uwl.ItemCollection;

import com.sap.netweaver.bc.uwl.QueryResult;

import com.sap.netweaver.bc.uwl.UWLContext;

import com.sap.netweaver.bc.uwl.UWLException;

import com.sap.security.api.IUser;

import com.sap.security.api.UMFactory;

public class Sample {

public void retriveItems() {

try {

// look up UWL service

IUWLService uwlService = findService();

// define session timeout perios

final int sessionIdleTimeout = 60;

// create context

UWLContext uwlContext = new UWLContext();

// find logged in user.

IUser user = //TODO Get the user for whom the items are to be retrieved.

uwlContext.setUser(user);

uwlContext.setLocale(Locale.getDefault());

// begin session

IUWLSession uwlSession;

uwlSession = uwlService.beginSession(uwlContext, sessionIdleTimeout);

uwlContext.setSession(uwlSession);

IUWLItemManager itemManager = uwlService.getItemManager(uwlContext);

QueryResult result = itemManager.getItems(uwlContext, null, null);

ItemCollection items = result.getItems();

Item item = null;

for (int i = 0; i < items.size(); i++) {

item = items.get(i);

Map params = new HashMap();

params.put("taskId", item.getExternalId());

String executionURL = WDURLGenerator.getApplicationURL("sap.com/tcbpemwdui~taskinstance", "ATaskExecution", params);

//TODO Add code send mail which contains above URL.

}

} catch (UWLException e) {

e.printStackTrace();

} catch (NamingException e) {

e.printStackTrace();

}

}

// look up UWL service

private IUWLService findService() throws NamingException {

Properties env = new Properties();

env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "com.sapportals.portal.prt.registry.PortalRegistryFactory");

// create initial context

InitialContext ctx = new InitialContext(env);

// retrieve UWL service

IUWLService uwlService = (IUWLService) ctx.lookup("/broker/services/" + IUWLService.ALIAS_KEY);

return uwlService;

}

}

which is taken from the following blog : <br>

/people/kenichi.unnai/blog/2009/10/19/how-to-use-uwl-api-for-netweaver-bpm-tasks

0 Kudos

Hello Priya,

I have already tried this, but it doesn't work. I have got the UWL Items, but the item link to the required iview is not working.

Regards