sapdev logo background
sapdev logo sapdev logo
Comments

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




comments powered by Disqus