Skip to Content

BSP server cookies


We are experiencing problems regarding server cookies in our bsp applications on Sap nw 7.3 ep 5.

This problem occurs in the following scenario: we have a stateless application which writes and reads server cookies to store authentication information. Lately we experience the problem that a server cookie which was set couldn't be read. After some debugging we found out the attribute runtime->session_id was the problem. It changed after a request to the server, which didn't happen before.

Does somebody know a solution to this problem? And aditionnaly, can somebody explain why this session_id is necessary when working with a stateless BSP application?

Kind regards,


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jun 06, 2012 at 10:40 PM

    Hi Maarten,

    pretty obviously the session_id is used with stateful pages to identify pages from the same session. As you rightly point out this is superfluous when using a stateless BSP application.

    While the session_id field is required there is no compulsion to put the actual session identifier in this field - you can put anything in there. For stateless applications I usually put the username in this field. i.e. sy-uname


    Graham Robbo

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Maarten,

      you can pass the session_id in your call. Something like this....

      CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie


      name = sy-uname

      application_name = runtime->application_name

      application_namespace = runtime->application_namespace

      username = sy-uname

      session_id = sy-uname

      data_name = 'mycookie'

      data_value = cookie

      expiry_date_rel = 7

      expiry_time_rel = 0.


      Graham Robbo

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.