带你进入SAP BSP系列—理论部分(7)


Stateful and Stateless BSP Applications

1. Stateful programming of a BSP application means that the application context is retained after the response and is available when you continue to work with the application.

Advantage:  Easy to program
Disadvantage: Waste resources

2. Stateless programming of a BSP application means that a new application context is created for each new request. In addition when you work with the BSP application, the old context is no longer available.

Advantage: Resource are only required on the SAP Web AS during HTTP request processing, that is save resources
Disadvantage: Data is required over serveral  BSPs needs to be read from the database, that is lower performance

3. Mixed Mode for BSP programming
How to set BSP application as stateful & stateless
1). Setting the flag on the properties tab
2). On runtime with method:
runtime->keep_context = 0     After this, the BSP application is excuted as stateless
runtime->keep_context = 1     After this, the BSP application is excuted as stateful
3). If the BSP is stateful application, and you can define the lifetime of this BSP application, there are options listed below:
Lifetime: Session
The page object of this BSP is not deleted, until the application become stateless or is ended.
navigation->exit ().
Lifetime: Page Chagne
The page object of this BSP is not deleted, until the applicaiton become stateless or is ended or the page change to another
navigation->goto_page() or navigation->next_page()
Lifetime: Request
The page object of this BSP is deleted after each HTTP request

4. Data transfer in stateful BSP application
If you want to transfer data between two BSP application, for example, BSP1 to BSP2, you need do the following steps:
1). Make the BSP1 stateful
2). Transfer the data to application object, for example, you want to transfer table, take the below statement:
In BSP1: application->table = itab1.
3). Goto page BSP2, and excute with the below statement:
In BSP2: itab2 = application->table.
4). Make the BSP1 stateless.

5. Data retain in stateless BSP application
There are two technic for this topic:
1). Hidden–>Storage of data in BSP
<input type=”hidden” name=”counter” value=”5″>
Disadvantages:
a. Stored in character string
b. Hidden field must be elementary or field, no structure and table
c. Part of HTML page, need trigger from user
2). Cookies
With two type, client-side cookie and server-side cookie
Client-side cookies:
How-to use:
ICF use IF_HTTP_ENTITY interface to provide sending/receiving cookies, this interface was implemented by CL_HTTP_REQUEST and CL_HTTP_RESPONSE
How-to delete:
Method: DELETE_COOKIE_AT_CLIENT
Class: CL_HTTP_RESPONSE
Tips: How-to change date to cookies required date format
CL_BSP_UTILITY=>DATE_TO_STRING_HTTP
Server-side cookies:
Class: CL_BSP_SERVER_SIDE_COOKIE
Storage: In DB cluster table SSCOOKIE
Advantages:
a. No limitation to the number of cookies(clinet-side: 300 cookies)
b. No limitation for the volumn(4KB for client-side cookies)
c. Complex data could be stored with appropriate type
Tips:
Show server-side cookies:  BSP_show_server_cookies
Clear server-side cookies: BSP_clean_up_server_cookies
Commonly-used technical:
Combination with the client-side cookies and server-side cookies, In server-side cookies, store sensitive data, in client-side cookies, store identity information.
Global objects and session handling

5


About The Author

从事SAP行业有些年头,对SAP技术稍有了解; 如无特别声明,本博客文章为原创,转载请注明; 博主MSN:xuchunbo0901@hotmail.com; 博主邮箱:bob.xu@abaptech.com。

No Comments

Leave A Reply


注意: 评论者允许使用'@user空格'的方式将自己的评论通知另外评论者。例如, ABC是本文的评论者之一,则使用'@ABC '(不包括单引号)将会自动将您的评论发送给ABC。使用'@all ',将会将评论发送给之前所有其它评论者。请务必注意user必须和评论者名相匹配(大小写一致)。

无觅相关文章插件,快速提升流量