Close BSP Session (type 'Pluggin HTTP') including when in SAP portal

When you execute an SAP BSP as a standalone application or within a portal iView, depending on how you have coded it, it may leave open sessions (type 'Pluggin HTTP') on your SAP system. This could cause an issue in itself if too many of these are opened at the same time but could cause other more fundamental issues when old data is retained.

For example if you log into the portal it will use the same login details for the BSP, then if you click the portal logout button it can leave you logged into the BSP and BSP session open. Then if you had a situation where you then needed to log in as a different user, say for testing purposes it may retain the previous user session for the BSP and process the BSP under those user details.

If you code your BSP using HTMLB then your application should automatically perform the session handling correctly without any extra coding. The problem occurs when you use standard HTML code which means the automatic session handling is not included by default. One solution to this is to add the following htmlb code somewhere in your BSP page. I think this can go pretty much anywhere so try to place it somewhere where it doesn't have any effect on the look and feel of your existing code. This should then incorporate the standard session management and any sessions created for the BSP as a standalone app or from within the portal will be removed when the user logs off. This is because when this code is included the BSP's url will then get registered with the DSM which will then know to close it when the user logs off.

<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content  >
  <htmlb:page title = " ">
    <htmlb:form>
      <htmlb:textView     text          = "In Progress"
                          design        = "EMPHASIZED" />
    </htmlb:form>
  </htmlb:page>
</htmlb:content>


Better solution
Another solution would be to add the following code between you html head tags whicg will also build all the session management javascript functions

<%=runtime->session_manager->header_script( )%>


SAP OSS note
Please note: if after trying the above solutions you are still getting a similar issue then you may need to check out OSS note 604599 and insert the sessionManagement="true" attribute to the HTMLB content tag.

<htmlb:content sessionManagement="true" >


Session management pages from SYSTEM BSP application
Another solution you can try is to copy the following pages from the standard SAP BSP application called 'SYSTEM' into yours:
- session_default_frame.htm
- session_single_frame.htm

Now within the layout code of session_single_frame.htm change the target_page variable to store the initial page of your BSP
DATA: target_page TYPE STRING VALUE 'bsp_initial_page.htm'.

Now use session_single_frame.htm as the initial page of you BSP application. Please note you are free to change the name of this page to what ever you want


Related Articles

Javascript to capture when a user closes or leaves sap bsp html page
Using AJAX functionality within our SAP BSP
SAP BSP to auto select region when user selects country using HTML and Javascript
HTML and Javascript code to force enter key to perform tab
JavaScrip command getElementById useful examples
MVC BSP input field - Demonstrate how to retrieve a value entered into text input field
Allowing multiple instances of a BSP application to be run by a user
Execute Standard SAP Transaction from BSP using dynamically created shortcut
Uplaod file within SAP BSP application using HTML and ABAP coding
UUseful SAP BSP application code - ABAP, HTML, HTMLB, Javascript, CSS
Creating a BSP Application class to help store and pass data betwenn your BSP pages
Training Course and Workshop Booking Form
BSP checkboxes using HTML and the OnInputProcessing BSP Event
BSP checkboxes using HTML and the OnInputProcessing BSP Event
Check HTML checkbox is checked using Javascript within your SAP BSP
BSP Dropdown List - create a BSP dropdown list which allows user selection!!
ABAP BSP to allow user to select from SAP HR org structure - CSS file
Java script to display tree structure on your SAP BSP web page
Create a Simple BSP - Simple BSP to display text and call section BSP page using HTML
SAP BSP Training course booking - Creating an example training course booking form using BSP
Creating an SAP BSP which executes an ABAP report to retrieve data for use within BSP application
org selection BSP - detials.htm page
Display page of the SAP BSP example application to store favourite tcodes as a cookie
Execute.htm page of the SAP BSP example application to store favourite tcodes as a cookie
Favourites cookie bsp - initial page to display input fields and retrieve user input
BSP using cookies - Demonstrate use of cookies within a BSP to store user favourits
ABAP Export data to memory - Demonstrate use of ABAP program to retrieve data for use in BSP
MVC BSP HTMLB input field - Demonstrate how to retrieve a value entered into text input field
BSP development using standard HTML code instead of Business HTML (HTMLB)
Business HTML (HTMLB) - List of business HTML tags you can use within your BSP
Adding JavaScript to BSP (HTML) pages - Shows how to add javascript to your BSP pages
Example JavaScript code which can be added to your BSP application
BSP MIME Objects for Org. search application
Call onInputProcessing event from SAP BSP page via href or button
Organisation selection BSP - close internet window using javascript
Organisation selection BSP - get server side cookie ( get_server_cookie )
orgaisation selection BSP - set and get server side cookie ( set_server_cookie )
Display orgaisation selection BSP
BSP which allows HR Organisation Structure search and selection using javascript
Organisation update program - get server side cookie ( get_server_cookie )
BSP to capture user entry into HTML input fields
Capture BSP radiobutton selection using HTML and the OnInputProcessing BSP Event
BSP checkboxes using HTML and the OnInputProcessing BSP Event
Stateful and stateless BSP applications
Get user entry into HTML input fields with SAP BSP
Javascript to capture when a user closes or leaves sap bsp html page
Creating a BSP using the Model View Controller ( MVC ) technique
Using SAP Model View Controller (MVC) development techniques to develop BSPs
Adding a JavaScript date selection field to a BSP
Creating a BSP using the Model View Controller ( MVC ) technique
Creating a BSP using the Model View Controller(MVC) technique
Creating a BSP using the Model View Controller ( MVC ) technique
Retrieve value from input text field within a model view controller ( MVC) BSP
Web Application Development - Example code and information on development using BSP
SAP BSP / Business Server Pages combine ABAP and other web technologies such as HTML, CSS
BSP development screen - developing application using business server pages
Standard Program created in SE38 or SE80