This is the details.htm page of the example favourits BSP, this is being used to demonstrate the use of cookies to store and retrieve information entered by a sap bsp user. Please note this page will do very little on it own and needs to be implemented as part of the whole favourits BSP application
*details.htm Type Definitions ---------------- TYPES: begin of t_favourites, tcode type tstc-tcode, PGMNA type tstc-PGMNA, ttext type TSTCT-ttext, end of t_favourites. types: tt_favourites type standard table of t_favourites. types: tt_tcodes type standard table of tstc. Page Attributes --------------- gd_pgmna TYPE TSTC-PGMNA (Auto Checked) gd_tcode TYPE TSTC-TCODE (Auto Checked) gd_text TYPE STRING it_favourites TYPE TT_FAVOURITES (Auto Checked) it_favouritesstr TYPE TT_FAVOURITES it_tcodes TYPE TT_TCODES (Auto Checked) OnInitialization --------- select single ttext into gd_text from tstct where SPRSL eq sy-langu and tcode eq gd_tcode. OnInputProcessing ----------------- data: a_name type string value 'NONE', a_name_space type string value 'NONE', u_name type string value 'NONE', session_id type string value 'NONE'. data wa_favourites like line of it_favourites. navigation->goto_page( 'INITIAL.HTM' ). Layout ------ <%@page language="abap"%> <html> <head> <link rel="stylesheet" href="../../sap/public/bc/bsp/styles/sapbsp.css"> <title> Display Users Card </title> </head> <body class="bspBody1"> <h3> Transaction Code List<br> </h3> <table width="50%" cellspacing="0" cellpadding="0" border="0"> <% data: wa_tcodes like line of it_tcodes, wa_favouritesstr like line of it_favouritesstr. "Loop at it_tcodes into wa_tcodes where tcode eq gd_tcode. %> <tr> <td> Transaction Code </td> <td> <%=gd_tcode%> </td></tr> <tr> <td> Program </td> <td> <%=gd_pgmna%> </td></tr> <tr> <td> Description </td> <td> <%=gd_text%> </td> </tr> <% "move-corresponding wa_tcodes to wa_favouritesstr. wa_favouritesstr-tcode = gd_tcode. wa_favouritesstr-pgmna = gd_pgmna. wa_favouritesstr-ttext = gd_text. append wa_favouritesstr to it_favouritesstr.%> <% "Endloop. %> </table> <% * for defining navigation data: a_name type string value 'NONE', a_name_space type string value 'NONE', u_name type string value 'NONE', session_id type string value 'NONE'. data wa_favourites like line of it_favourites. CL_BSP_SERVER_SIDE_COOKIE=>GET_SERVER_COOKIE( EXPORTING NAME = 'NET200' APPLICATION_NAME = a_name APPLICATION_NAMESPACE = a_name_space USERNAME = u_name SESSION_ID = session_id DATA_NAME = 'COOKIE_ID_43CASE2' * IMPORTING * EXPIRY_DATE = * EXPIRY_TIME = CHANGING DATA_VALUE = it_favourites ). LOOP at it_favouritesstr into wa_favourites. append wa_favourites to it_favourites. ENDLOOP. delete adjacent duplicates from it_favourites comparing tcode. CL_BSP_SERVER_SIDE_COOKIE=>SET_SERVER_COOKIE( EXPORTING NAME = 'NET200' APPLICATION_NAME = a_name APPLICATION_NAMESPACE = a_name_space USERNAME = u_name SESSION_ID = session_id DATA_VALUE = it_favourites DATA_NAME = 'COOKIE_ID_43CASE2' * EXPIRY_TIME_ABS = * EXPIRY_DATE_ABS = EXPIRY_TIME_REL = 3600 * EXPIRY_DATE_REL = ). %> <form> <input type="submit" name="OnInputProcessing(ADD)" value="Add to Favourits"></td> </form> </body> </html>