cancel
Showing results for 
Search instead for 
Did you mean: 

Client Side Cookies? Alternatives?

Former Member
0 Kudos

We have a SSO setup where in the multiple users ultimately use the same user id to access the sap system.

USER1A Logs in Company Portal --> Single Sign on to SAP using  User id : USER1.
USER1B Logs in Company Portal --> Single Sign on to SAP using User id : USER1.
USER1C Logs in Company Portal --> Single Sign on to SAP using User id : USER1.

So, I need to know if there is anyway I can set a client side cookie in the browser? I looked at various discussions but none of them seem to be solving my problem.

Method 1. CL_BSP_SERVER_SIDE_COOKIE --:> Can't use as this one because I don't have the session ID.

Method 2. Put the below code to set the cookies in one of button click event action

DATA :request TYPE REF TO if_http_request.
      request = wdr_task=>request.
lv_salesorder= '12345'
request->set_cookie(
       name    = 'SALESORDER'
       value   = lv_salesorder
       expires = '19991231' ).

and i have added the below code in the WDDOINIT

DATA :request TYPE REF TO if_http_request.
DATA: lt_cookies TYPE tihttpcki.
request = wdr_task=>request.
request->get_cookies( CHANGING cookies = lt_cookies   ).

Now, when i close the browser and restart the browser the get_cookies does not find the cookies which were set in the previous sessions.

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>We have a SSO setup where in the multiple users ultimately use the same user id to access the sap system.

I do believe that such a setup is a violation of your SAP license agreement. Each user accessing your backend Business Suite system must have a license/user id.

>Can't use as this one because I don't have the session ID.

You don't need a session ID.  You can fill in any dummy value you want - just so its consistent between the read and write calls.

Former Member
0 Kudos

> I do believe that such a setup is a violation of your SAP license agreement. Each user accessing your backend Business Suite system must have a license/user id.

Well, I tried to explain it in a simple way... In this case multiple user ids <==> one sap id still belong to the same person. so it's not a violation.  But the access of the same application is from different systems.

So, I need to figure out a way to set client cookies which would be retained in the browser.

What about method 2? any ideas why it does not work? any other alternatives?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>one sap id still belong to the same person. so it's not a violation.

Still sounds strange to me.  Have you checked this exact usage with your SAP Account Executive?

>What about method 2? any ideas why it does not work? any other alternatives?

You didn't say what didn't work about it.  The Server Side cookie is ultimately just a database entry.  Those parameters you pass in are the entry keys.  As long as you use the same keys on read and write, I don't see how it couldn't work.  Perhaps you need to supply more details on how you are using the server side cookies and what went wrong. 

Former Member
0 Kudos

The Server side cookie works.. but not the client side cookie(code below)..

Put the below code to set the cookies in one of button click event action

DATA :request TYPE REF TO if_http_request.
      request = wdr_task=>request.
lv_salesorder= '12345'
request->set_cookie(
       name    = 'SALESORDER'
       value   = lv_salesorder
       expires = '19991231' ).

and i have added the below code in the WDDOINIT

DATA :request TYPE REF TO if_http_request.
DATA: lt_cookies TYPE tihttpcki.
request = wdr_task=>request.
request->get_cookies( CHANGING cookies = lt_cookies   ).

Now, when i close the browser and restart the browser the get_cookies does not find the cookies which were set in the previous sessions.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I have no comment about the client side cookies except that you are using unreleased and unsupported APIs to access the request object.  Access to the client side cookies is not intended or supported for use in Web Dynpro.   Furthermore I image the cookies are being created as session cookies and not persistent cookies and therefore only have the lifetime of the browser session.  In my mind, its a moot point since you shouldn't use client side cookies in Web Dynpro in the first place.