SAP BSP 入门1

落日映苍穹つ 2022-07-05 15:07 281阅读 0赞

Components of a BSP program lists:

  1. Business Server Pages: Define the Web pages that are displayed to the user. Each BSP contain two parts: static part which can use HTML or XML, dynamic part which can use ABAP or Javascripts.
    · Pages with flow logic: Including layout and attributes and also event handler which used to do the control work
    · Page fragments: Including layout, you can include this page in every common place for simple implementation, no URL defined.
    · Views: Used to display data
    · One table: BSPDEFPAG
  2. Application class
    Encapsulate the business logic required in the application.
    Instance name: application
    The Class must be a global class defined in the class builder
  3. MIME(Multipurpose Internet Mail Extension) objects
    For example: Audio, Video, Graphics, Stylesheet.
    Goto MIME object: SE80
  4. Topic
  5. Navigation structure
    Define the sequence of BSPs within an application. The navigation path are maintained in a table as a property of BSP application.
  6. Controller

Directives:
· BSP directive tag definition:
Enclose with <% and %>
· Page directives tag definition:
<%@page language=’’ABAP’’%>
· Include directive
<%@ include file = ‘’fragment.htm’’%>
· Inline Code :
<% data ls type string.%>
· Output of a variable values
<%= wa-carrid%>
· Comments
<%– xxxxxx –%>

Layouts of a BSPs.

BSP structure :

3
Page types:
–F: page with flow logic
–V: View
–P: page fragment

BSP events:
When the request coming, the process follow the below logic:

  1. OnCreate: This event just execute once for stateful, otherwise once the BSP is called.
  2. OnRequest: Executed each time when the BSP is called, and restore the internal data structure from the request.
  3. OnInputProcessing: Used for process the user inputs and subsequent navigation to the next pages.
  4. OnInitialization: Executed after OnRequest, mainly for data retrieval, such as read data from database, filling internal tables….
  5. Layout:
  6. OnManipulation: Used for manipulating the data stream according to the layout.
  7. OnDestroy: The last to be executed, for deleting the information of the BSP application.

Processing user input:

Statements:

…….












































Field Type HTML Tag Note
Input/Output type <input type=”text”

 

name=”A”

value=”B”>

The field is filled with the

 

value B.

Password field <input type=”password”

 

name=”A”>

 
Checkbox <input type=”checkbox”

 

name=”A”

value=”X”>

The name/value pair A=X

 

is then sent with the HTTP

request to the receiver, if the

checkbox is ticked.

Radio button <input type=”radio”

 

name=”A”

value=”X”>

All of the selection buttons

 

in a group have the same

name (but different values).

Dropdown list <select name=”A”>

 

<option value=”B”>

Disp

</option>

</select>

The user sees the values

 

specified between

<option> and

</option> (in this

example, Disp).

Input area with

 

more than one line

<textarea name=”A”

 

rows=”…”

cols=”…”>

 
Send button <input type=”submit”

 

name=”A”

value=”Send”>

The text specified after the

 

value addition appears on

the button as a label.

Static Navigation:
















Attribute Description
method=″type″ This attribute specifies how the system sends the form

 

to the server (that is, which method is used).

GET

The query string is appended to the URL,

separated by a question mark (?). The query

string appears in the address bar in the browser!

The maximum length of the query string is 4 KB.

This is the default method.

POST

The data is sent to the server in the HTTP body,

which means that it does not appear in the address

bar in the browser. The data is not buffered in an

HTTP cache. There is no limit to the length of the

query string.

ACTION=″execution″ This attribute specifies the program that the query

 

string executes on the server.

Example:

Text

Text

Global Objects:

4

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

  1. 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

  1. 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

  2. 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.

  3. Data retain in stateless BSP application
    There are two technic for this topic:
    1). Hidden–>Storage of data in BSP

    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

发表评论

表情:
评论列表 (有 0 条评论,281人围观)

还没有评论,来说两句吧...

相关阅读

    相关 BSP模型学习

    第一次写CSDN,格式还不太熟悉,但是总算是一个好的开始,这个学期要保本校的研,但是由于大一大二大三上都不太努力,所以会有些难度,这博客是个新的开始,所以努力吧,这个博客主要是

    相关 BSP 概念解析

    BSP是板级支持包,是介于主板硬件和操作系统之间的一层,应该说是属于操作系统的一部分,主要目的是为了支持操作系统,使之能够更好的运行于硬件主板。BSP是相对于操作系统而言的,不

    相关 bsp&&Portal Demo

    找朋友用3DMax做拉个简单的符合要求的场景,结果发现原来的程序在生成portal时有问题,现在已经修正拉这个问题。下一步要做的就是利用portal进行可见判断。现在有两种选择