SAP BSP 入门1

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: <Form>…….</Form>

Field TypeHTML TagNote
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:

<Form method=……. Action=……>

AttributeDescription
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:

<a href=http://xxxxx> Text </a>

<a href=”bsp.htm”> Text </a>

<Form action = “bsp.htm” method = “get”>

<input type = “submit” value=”click” name=”BUTTON”>

 

 

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

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

 

 

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: ABAP是一种用于SAP系统开发的编程语言,它是一种高级语言,用于在SAP环境中编写业务逻辑。ABAP语法是ABAP程序的书写规则,用于定义数据对象、变量、函数、方法等,以实现所需的功能。 ABAP的关键语法包括:数据类型定义、变量声明、语句结构、逻辑控制、循环结构、函数和方法定义等。通过这些语法,开发人员可以对数据进行处理、进行条件判断、循环操作以及定义自定义的功能模块。 ABAP语法中的数据类型定义包括:整数、浮点数、字符串、日期、时间等。开发人员可以根据需要选择合适的数据类型来定义变量,并进行数据操作。变量声明可以通过关键字"DATA"或"FIELD-SYMBOLS"进行,这些关键字可以指定变量的数据类型、长度、可见性等属性。 在ABAP语法中,还有一些重要的语句结构。例如,条件语句(IF...ELSE...ENDIF)用于根据条件选择不同的执行路径;循环语句(DO...END...WHILE)用于多次执行同一段代码;选择语句(CASE...WHEN...ENDCASE)用于根据不同的条件选择执行不同的代码块。 除此之外,ABAP语法还支持函数和方法的定义。函数是一段独立的代码块,可以接受输入参数并返回结果;方法则是与对象关联的代码块,用于对特定对象进行操作。 总之,ABAP语法是开发ABAP程序的基础,它提供了丰富的功能和灵活的语言结构,使得开发人员可以根据需要编写复杂的业务逻辑,并在SAP系统中实现各种功能。通过熟悉ABAP语法,开发人员可以高效地进行开发工作,并实现各种业务需求。 ### 回答2: ABAP(Advanced Business Application Programming)是一种用于SAP系统的编程语言,它最初是为SAP R/3系统开发的。随着SAP系统的升级和改进,ABAP也进行了相应的发展,现今最新版本是ABAP S/4HANA。 ABAP S/4HANA是在SAP S/4HANA平台上使用的ABAP版本,它与传统的ABAP有一些重要的区别。首先,ABAP S/4HANA采用了新的数据模型,即S/4HANA物料管理(Material Ledger)和简化数据模型(SIMM)等,这些模型使用了新的内部数据技术,提高了数据处理性能和效率。 其次,ABAP S/4HANA引入了新的ABAP编程范式,例如ABAP CDS(Core Data Services)。ABAP CDS提供了一种声明式的编程方式,用于定义和处理数据模型、服务和视图。这种新的编程范式可以更好地支持SAP S/4HANA中的新功能,并且使开发人员能够更轻松地创建和维护ABAP应用程序。 此外,ABAP S/4HANA还引入了更多的功能和特性,以优化开发和运行ABAP应用程序的性能。例如,它引入了ABAP Managed Database Procedures(AMDP),用于在数据库中执行复杂的计算和处理。它还提供了更好的集成工具,如ABAP Test Cockpit和ABAP Development Tools,用于支持开发和测试过程。 总结而言,ABAP S/4HANA是ABAP语言在SAP S/4HANA平台上的最新版本,它引入了新的数据模型、编程范式和功能,以更好地支持SAP S/4HANA系统,并提高开发和运行ABAP应用程序的性能。 ### 回答3: ABAP是一种高级业务应用程序编程语言,用于开发SAP软件解决方案。ABAP语法包括各种关键字、数据类型、操作符、语句和类等。 首先,在ABAP语法中,我们使用不同的关键字来声明变量、常量和数据类型。例如,使用“DATA”关键字来声明一个变量,使用“CONSTANTS”关键字来声明一个常量,并使用不同的数据类型(例如整数、字符、日期等)来定义变量或常量。这些关键字和数据类型使开发者能够方便地处理数据和进行计算。 其次,在ABAP语法中,我们可以使用各种操作符来进行数学、逻辑和比较操作。例如,加号“+”用于加法运算,减号“-”用于减法运算,等号“=”用于比较操作等。这些操作符帮助我们在编写程序时进行各种运算和判断。 然后,在ABAP语法中,我们使用各种语句来实现不同的功能。例如,我们可以使用“IF”语句来实现条件判断,根据条件的结果执行不同的操作。我们还可以使用“DO”语句来实现循环操作,重复执行一段代码。此外,还有其他语句,例如“CASE”语句、 “LOOP”语句等,用于不同的编程需求。 最后,在ABAP语法中,我们还可以创建和使用类来组织和管理代码。类是一种封装了数据和方法的数据结构,可以实现面向对象的编程。通过创建类和使用类的方法,我们可以更好地管理代码,并实现可重用的功能。 综上所述,ABAP是一种用于开发SAP软件解决方案的编程语言,它有着丰富的语法规则,包括关键字、数据类型、操作符、语句和类等。了解和掌握ABAP语法对于开发高效、可靠的SAP应用程序至关重要。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值