Subscribe

RSS Feed (xml)



Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Thursday, February 3, 2011

Create Server-Side Cookies

Yours is a stateless or stateful application. if its stateful, instead of cookies, you can use application class to hold the data

It is a stateless application; I want to reduce the waiting time for a customer by preparing cookies for that particular customer in advance.

Go to SE80

Create a BSP application

Create a page

Click on layout tab

Paste the code in layout tab




Selection page

Stateful or stateless?


















stateful



stateless


Click on event handler tab

Paste it below code

Select oninputprocessing, Paste the below code

onManipulation code

  • event handler to manipulate dynamically the HTTP stream
data: PAGE_DATA type XSTRING.

data: NAME type STRING.

export LAST_STRING_ADDED from LAST_STRING_ADDED

STRINGS from STRINGS

to data buffer PAGE_DATA.

NAME = SY-UNAME.

call method CL_BSP_SERVER_SIDE_COOKIE=>SET_SERVER_COOKIE
exporting
NAME = 'my_cookies'

APPLICATION_NAME = 'ZCOOKIES '

APPLICATION_NAMESPACE ='ZCOOKIES '

USERNAME = NAME

SESSION_ID = 'same_for_all'

DATA_NAME = 'page_data'

DATA_VALUE = PAGE_DATA





EXPIRY_TIME_REL = 3600



Click on page attributes tab.

Declare like this

LAST_STRING_ADDED TYPE STRING

STRINGS TYPE STRING

Save, check, activate it, screen appear like this and click ok button

Click on store button

After storing, go to SE38

BSP_SHOW_SERVER_COOKIES run this program

Execute the program

These cookies will save under SSCOOKIE table











No comments:

Blog Archive