cancel
Showing results for 
Search instead for 
Did you mean: 

BSP and session management

Former Member
0 Kudos

Hi everyone, I am doing development with BSPs in CRM People-Centric UI. Here's something that is puzzling me... when a BSP calls another using the BSP extension "BSP" "CALL" from within a view, under what circumstances is another terminal session launched?

In my case, I am calling a screen of type "Preview" which means in real terms that a URL is constructed with the name of a new BSP and its controller. The URL is then launched by view code that looks like this:

<script language="JavaScript" type="text/javascript">

window.open("<%= gv_url %>", "Preview");

//window.open();

</script>

After this, the new browser window opens with the url displayed at the top. The controller class executes (do_request method).

OK so far. Here's my question... this new window sometimes executes in the original terminal session, and sometimes not! This affects debugging and more importantly program execution, since the code in the second window gets its data by an IMPORT FROM SHARED MEMORY command. If the new code is in a separate terminal session, the logic fails. This is SAP code, not my code!

When does this happen? Yesterday, I could get the same terminal session (and program success) by starting the BSP from within an open CRM SAPGUI session. The different terminal session (program failure) happens if you start the application from the internet browser directly. Today, even starting from SAPGUI is triggering a separate terminal session. Can anyone help me to track down where the same session/different session decision happens?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181879
Active Contributor
0 Kudos

Hallo Paul,

You write a lot of detail, but not all of it hangs together so that one can easily answer the question (or be sure that the answer is correct). So let my write little bits of answers, and we take it from there.

First aspect: When you are already in the server, and just using <bsp:call> to call another controller, then session management plays no role. You are already in one session, and you are just effectively asking another controller (which is just an ABAP class!) to place its output into the response. No session management aspects here.

Next aspect is that we have "window.open(url)". Usually each BSP application runs in its own session (roll-area). You did not give any information about what is this URL, but your write "name of new BSP", so we assume for the moment different BSP application, new session.

There are techniques to force this new controller into the same session, but we do not officially support this, and I assume for the moment it is not what you are doing.

Although not completely relevant, you might also consider to read:

  BSP In-Depth: Confusion between Stateless, Stateful and Authentication

/people/mark.finnern/blog/2003/09/24/bsp-in-depth-confusion-between-stateless-stateful-and-authentication

Why do you think that you are in another session? Use transaction SM04 to see how many HTTP sessions you have open. (You can filter for your user.) Specifically check before pressing the preview button in browser, and check again afterwards.

Next aspect is: "gets its data by an IMPORT FROM SHARED MEMORY". This is my opinion should make no difference to whether you are running in the same session or a new session. Shared memory means exactly "shared" over sessions. And this is why I am thinking that there is another type of problem, and it is not session related.

Maybe a stupid question: are you 100% sure that the preview request lands on the same application server? (Especially with load-balancers, etc.) I know of cases where people were trying to debug on one appserver, and the requests were running against another appserver. To see what the browser is doing, consider to read:

  BSP Trouble Shooting: HTTP Browser Traces

/people/brian.mckellar/blog/2003/10/12/bsp-trouble-shooting-http-browser-traces

You write "This is SAP code, not my code!". My usual advice: send it back! If you think there is a problem, then of course you are free to open a OSS/CSN trouble ticket.

regards, brian

PS: I tip different application server. However, there is one other common reason for this type of problem, namely that the browser session is running into a different client that the SAPGUI session for debugging is using! I would recommend to check and verify these aspects first.

Former Member
0 Kudos

Thank you Brian,

I used SM04 and found that the new window corresponds to a new session... in a different client! This explains why debugging has been failing. What about the IMPORT FROM SHARED MEMORY? I see that the table INDX is client dependent, so IMPORT FROM DATABASE is client dependent. I guess the IMPORT FROM SHARED MEMORY is also client dependent, although the documentation doesn't make this clear.

So, WHY does the window.open(url) switch to a new client? I am in client 400 when I issue the call, the URL is this:

http://sap010.alarismed.com:8002/sap/bc/bsp/sap/crm_ml_preview/ml_preview.do?gv_type=text%2Fhtml&gv_...

What is there in here that is going to trigger a client switch? I checked the SICF transaction, looking for overriding clients in the sap..bc..bsp..sap.. chain, and didn't find any. The host and port names are the same in the originating page and the new page. The "scrambled" stuff is different in the 2 pages. In the original page we have (descrambled)

l=en&c=400&d=min

and in the new window we have (descrambled)

l=en&c=200&d=min

Can you give me any ideas what to look for next?

Paul

Former Member
0 Kudos

Hold the phones! I goot it figured out! There were no clients in the tree in SICF, so web services were allocating the default client (200) for new web pages! We added client 400 at the BSP node level, and things are working smoothly now. Thanks for the input, Brian, as i was explaining it and writing the last post, something clicked in my brain and I got it.

Paul

former_member181879
Active Contributor
0 Kudos

Hallo Paul,

I am still on hold here

But to get back to your question on client dependance of the IMPORT FROM SHARED MEMORY, I decided to ask the real experts. I called (using my second phone:) the ABAP Language group, and received the answer below (all names changed to protect the innocent).

bye, brian

-

-


The table INDX is client dependent, but you can define your own table (similar to INDX) without a client field:

MANDT      optional (client)

RELID        mandatory

          mandatory

SRTF2       mandatory

user data   optional (any number of user data fields)

CLUSTR    mandatory

CLUSTD    mandatory

Regards, Thomas