cancel
Showing results for 
Search instead for 
Did you mean: 

access to client data bag from webdynpro

Former Member
0 Kudos

Hi!

Is it possible for a webdynpro to get the Data that is stored in the client data bag?? I make use of some sap bussiness package iviews and they often store the parameters in the client data bag. Now i want to get these parameters to use them in a webdynpro.

I know that webdynpro does not support scripting so i cannot use

EPCM.loadClientData("urn:com.sap.bor:BUS0010","objid");

because EPCM is a javascript object.

Is there any other way to get that Data?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

One more thing. I cannot import the class javax.servlet.http.Cookie and the webdynpro does not know what a Cookie[] is....

How have you solved the import?

achim_hauck2
Active Contributor
0 Kudos

import "servlet.jar" to your project and add it to the java build path.

i think, you can find the file somewhere on the WAS, otherwise google for it, it's a common jar-file.

kr, achim

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks a lot, it works now!

Former Member
0 Kudos

Thats a good idea...could you give me some source code on how to do this??

achim_hauck2
Active Contributor
0 Kudos

this is code, I use (but be warned: SAP wouldn't like it, because we're using the unsupported TaskBinder in a WD application. anyway, it works for us


Cookie[] mycookies = TaskBinder.getCurrentTask().getWebContextAdapter().getHttpServletRequest().getCookies();
	
for (int i = 0; i < mycookies.length; i++) {
  if (mycookies<i>.getName().equals("SAPPORTALSDB0")) {
	String cookie = "";
	try {
	  cookie = URLDecoder.decode(URLDecoder.decode(mycookies<i>.getValue(), "UTF-8"), "UTF-8");
	} catch (UnsupportedEncodingException ex) {
	// do something
        }
        String[] ckeys = cookie.split(";");
        // in this array are your values
  }
}

Former Member
0 Kudos

Hi;

is it works on 7.0 or 7.1 Portal ?

achim_hauck2
Active Contributor
0 Kudos

Andreas,

because the client data bag is stored as a cookie, i wrote my own routine to extract the needed data from the data bag out of this cookie.

but it's no API or something like that, just a straightforward approach for my personal needs...

kr, achim

achim_hauck2
Active Contributor
0 Kudos

additional information:

the cookie is called SAPPORTALSDB0 and the values are stored separated by ";".

you have to unescape the cookie-value.

kr, achim