关于BAPI
2007-12-14 11:15
337 查看
2006年11月17日 14:07:00
1 BAPI的优点
bapi是面向对象的设计;
bapi是固定的,一般不能修改;
bapi可以被sap内部部件和非sap程序使用;
bapi的成功和错误信息始终通过RETURN返回;
bapi可以被许多开发平台使用;
2 何时该考虑使用BAPI设计程序用VB/JAVA?C++等语言编写非SAPGUI程序访问和处理sap数据;
SAP不同部件之间通讯;
与非sap程序或者老系统交换数据:
使用异步通信分发数据如:ALE
可以通过SAP Business Connector or Internet Application Components 与因特网程序集成;3 关于RETURNRETURN用于BAPI返回错误和成功的消息,它可以是BAPIRETURN,BAPIRETURN,BAPIRET1,BAPIRET2和BAPIRET2_FIX中的一种类型.这些结构一般都包括以下字段:
4 BAPI的程序框架Log on
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Log off5 相关函数'BALW_BAPIRETURN_GET2':取生成返回消息
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = 'E'
CL = 'BC_BOR'
NUMBER = 163
PAR1 = MSG1_HLP
PAR2 = MSG2_HLP
IMPORTING
RETURN = RETURN.
BAPI_TRANSACTION_COMMIT 和 API_TRANSACTION_ROLLBACK: BAPI事务函数
BUFFER_SUBSCRIBE_FOR_REFRESH和BUFFER_REFRESH_ALL: 缓冲区处理函数
'TRANSACTION_BEGIN ,'TRANSACTION_STATUS' 和'TRANSACTION_END' 的调用示例
call function 'TRANSACTION_BEGIN' "94702/KB
importing "94702/KB
transaction_id = transaction_id "94702/KB
exceptions "94702/KB
others = 1. "94702/KB
call function 'BAPI_PO_CREATE' "94702/KB
exporting "94702/KB
po_header = po_head "94702/KB
importing "94702/KB
purchaseorder = h_ebeln "94702/KB
tables "94702/KB
po_items = po_item "94702/KB
po_item_schedules = po_sched "94702/KB
po_item_account_assignment = po_acct "94702/KB
po_item_text = po_text "94702/KB
return = return "94702/KB
exceptions "94702/KB
others = 0. "94702/KB
call function 'TRANSACTION_STATUS' "94702/KB
importing "94702/KB
status = status_of_transaction "94702/KB
exceptions "94702/KB
others = 1. "94702/KB
if status_of_transaction = commit_work. "94702/KB
commit work and wait. "94702/KB
endif. "94702/KB
call function 'TRANSACTION_END' "94702/KB
exporting "94702/KB
transaction_id = transaction_id "94702/KB
exceptions "94702/KB
others = 1. "94702/KB
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1392359
1 BAPI的优点
bapi是面向对象的设计;
bapi是固定的,一般不能修改;
bapi可以被sap内部部件和非sap程序使用;
bapi的成功和错误信息始终通过RETURN返回;
bapi可以被许多开发平台使用;
2 何时该考虑使用BAPI设计程序用VB/JAVA?C++等语言编写非SAPGUI程序访问和处理sap数据;
SAP不同部件之间通讯;
与非sap程序或者老系统交换数据:
使用异步通信分发数据如:ALE
可以通过SAP Business Connector or Internet Application Components 与因特网程序集成;3 关于RETURNRETURN用于BAPI返回错误和成功的消息,它可以是BAPIRETURN,BAPIRETURN,BAPIRET1,BAPIRET2和BAPIRET2_FIX中的一种类型.这些结构一般都包括以下字段:
TYPE | CHAR 1 | S = success message E = error message W = warning message I = information message A = termination message (abort) |
ID | CHAR 20 | Message ID The structure BAPIRET2 takes into account the name space extension for the message class as of Release 4.0. If you want messages to be compatible with earlier R/3 Releases, use the message classes before Release 4.0. |
NUMBER | NUMC 3 | Message number |
MESSAGE | CHAR 220 | Full message text from the message table. All variables (in fields Message_V1 to Message_V4) have been replaced with text. |
MESSAGE_V1 MESSAGE_V2 MESSAGE_V3 MESSAGE_V4 | CHAR 50 | Fields for the variable texts of the message |
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Call BAPI
(Source code)
Call BAPI
(Source code)
Call BAPI BapiService.TransactionCommit()
(Source code)
Log off5 相关函数'BALW_BAPIRETURN_GET2':取生成返回消息
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = 'E'
CL = 'BC_BOR'
NUMBER = 163
PAR1 = MSG1_HLP
PAR2 = MSG2_HLP
IMPORTING
RETURN = RETURN.
BAPI_TRANSACTION_COMMIT 和 API_TRANSACTION_ROLLBACK: BAPI事务函数
BUFFER_SUBSCRIBE_FOR_REFRESH和BUFFER_REFRESH_ALL: 缓冲区处理函数
'TRANSACTION_BEGIN ,'TRANSACTION_STATUS' 和'TRANSACTION_END' 的调用示例
call function 'TRANSACTION_BEGIN' "94702/KB
importing "94702/KB
transaction_id = transaction_id "94702/KB
exceptions "94702/KB
others = 1. "94702/KB
call function 'BAPI_PO_CREATE' "94702/KB
exporting "94702/KB
po_header = po_head "94702/KB
importing "94702/KB
purchaseorder = h_ebeln "94702/KB
tables "94702/KB
po_items = po_item "94702/KB
po_item_schedules = po_sched "94702/KB
po_item_account_assignment = po_acct "94702/KB
po_item_text = po_text "94702/KB
return = return "94702/KB
exceptions "94702/KB
others = 0. "94702/KB
call function 'TRANSACTION_STATUS' "94702/KB
importing "94702/KB
status = status_of_transaction "94702/KB
exceptions "94702/KB
others = 1. "94702/KB
if status_of_transaction = commit_work. "94702/KB
commit work and wait. "94702/KB
endif. "94702/KB
call function 'TRANSACTION_END' "94702/KB
exporting "94702/KB
transaction_id = transaction_id "94702/KB
exceptions "94702/KB
others = 1. "94702/KB
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1392359
相关文章推荐
- 关于库存 &库存BAPI
- 关于通过使用BAPI创建销售订单(抬头信息中:含增强字段)
- 关于BAPI_PO_CREATE1
- 关于库存 &库存BAPI
- 关于BAPI
- 关于通过使用BAPI创建销售订单(抬头信息中:含增强字段)
- 关于BAPI
- 关于BAPI
- 关于BAPI
- ABAP 关于BAPI的EXTENSIONIN 一点解释
- 关于库存 &库存BAPI
- 关于BAPI_PATIENT_CREATE(病患主数据创建)
- 关于MB1A过帐BAPI的应用
- 关于sap sd模块的常用bapi
- 关于BAPI创建FI凭证时 原因代码等字段的传入
- 关于BAPI_TRANSACTION_COMMIT一点说明
- 关于库存 &库存BAPI
- 关于BAPI
- 关于BAPI 的作用
- 关于通过使用BAPI创建销售订单(抬头信息中:含增强字段)