cancel
Showing results for 
Search instead for 
Did you mean: 

How do we access the portal databag?

Former Member
0 Kudos

Hi,

Has anyone been able to access the portal databag object for use in web dynpro succesfully? How is this done?

We tried reading the cookies of the WebContextAdapter request, but it appears that the cookies are only for the local WAS. This doesn't work for the instance where the SP6 portal is running on WAS 6.2 and the webdynpro is running in another WAS. How can this be solved?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I'd like to add to Thomas Lin's solution above...

In order to use the cookie classes, use first need to import "servlet.jar" into your web dynpro project as an external jar. Instructions for this can be found in the following post:

You can then use the following code to access the databag:

//check databag for employee cookie

Cookie[] cookieset = TaskBinder.getCurrentTask().getWebContextAdapter().getHttpServletRequest().getCookies();

for (int i=0;i<cookieset.length;i++) {

if (cookieset<i>.getName().compareTo("urn:com.sap.pct.hcm.orgmanagement:CurrentObject") == 0) {

String dataObject = cookieset<i>.getValue();

foundCookie = true;

break;

}

}

In my example, I was looking for data from the manager self service team viewer and found it in the cookie "urn:com.sap.pct.hcm.orgmanagement:CurrentObject", but the cookie SAPPORTALSDB0 mentioned above was there as well.

Former Member
0 Kudos

Able to get it succesfully with a little hacking around of the portal.

essentially did a

readCookie("SAPPORTALSDB0")

after casting the WDWebContextAdapter object.

This only works if you set your views to use javascript/ cookies.

Former Member
0 Kudos

Hi Tomas,

Unfortunately this is not supported at this point of time. I will put it on the requirement list.

Best regards,

Karin