- 浏览: 174274 次
- 性别:
- 来自: 成都
文章分类
转自:http://wiki.sdn.sap.com/wiki/display/ABAP/BAPI_TRANSACTION_COMMIT+versus+COMMIT+WORK
Many people continue using (or advising to use) COMMIT WORK after a call to a BAPI function module.
You must always call BAPI_TRANSACTION_COMMIT (not COMMIT WORK) if you have called at least one BAPI function module within the current LUW.
Here's why (inspired from this SDN thread):
By simply looking at BAPI_TRANSACTION_COMMIT code, we see quickly what is different from COMMIT WORK. It calls BUFFER_REFRESH_ALL function module right after COMMIT WORK.
So BAPI_TRANSACTION_COMMIT additionally refreshes a "BAPI buffer".
Here is what BAPI buffer is for:
Assuming your program calls BAPIs consecutively and use a COMMIT WORK/BAPI_TRANSACTION_COMMIT only at the end so that to commit all BAPI updates once (better performance).
As you know, BAPIs need to check errors like data missing in database. For example, the second BAPI may have to check the existence of data written by the previously called BAPI. The data doesn't exist in database yet, but as it knows it will be written later at COMMIT WORK time, it uses a buffer (memory) to store this information, so that no error is raised.
Let's suppose the update during the COMMIT WORK fails (for any reason), the data is not written to database. If you have not refreshed the buffer using BAPI_TRANSACTION_COMMIT, the next BAPI calls will consider that some data will exist later, that is wrong.
The same kind of logic applies to the rollback: you must call BAPI_TRANSACTION_ROLLBACK instead of ROLLBACK WORK. It will empty the BAPI buffer too. Here's why:
If you rollback the first BAPI using ROLLBACK WORK statement, you must absolutely refresh the buffer, otherwise the next BAPI could think that the data will exist and would attempt erroneously to write data.
All that is probably better explained in SAP Library documentation about BAPI buffer
To test a BAPI, you need to use a test sequence in SE37, for calling BAPI_TRANSACTION_COMMIT. See SDN wiki - Function Module Test Sequence.
For information:
SAP library documentation about BAPI template code shows why buffers were initially required at an older time: as only PERFORM ON COMMIT was available (CALL FUNCTION IN UPDATE TASK did not exist yet), all data had to be retained in memory (because the form is called once though registered several times).
Now, as only CALL FUNCTION IN UPDATE TASK should be used, it makes obsolete this documentation and the need for storing data in memory. But buffer is still in use as I explained above.
Many people continue using (or advising to use) COMMIT WORK after a call to a BAPI function module.
You must always call BAPI_TRANSACTION_COMMIT (not COMMIT WORK) if you have called at least one BAPI function module within the current LUW.
Here's why (inspired from this SDN thread):
By simply looking at BAPI_TRANSACTION_COMMIT code, we see quickly what is different from COMMIT WORK. It calls BUFFER_REFRESH_ALL function module right after COMMIT WORK.
So BAPI_TRANSACTION_COMMIT additionally refreshes a "BAPI buffer".
Here is what BAPI buffer is for:
Assuming your program calls BAPIs consecutively and use a COMMIT WORK/BAPI_TRANSACTION_COMMIT only at the end so that to commit all BAPI updates once (better performance).
As you know, BAPIs need to check errors like data missing in database. For example, the second BAPI may have to check the existence of data written by the previously called BAPI. The data doesn't exist in database yet, but as it knows it will be written later at COMMIT WORK time, it uses a buffer (memory) to store this information, so that no error is raised.
Let's suppose the update during the COMMIT WORK fails (for any reason), the data is not written to database. If you have not refreshed the buffer using BAPI_TRANSACTION_COMMIT, the next BAPI calls will consider that some data will exist later, that is wrong.
The same kind of logic applies to the rollback: you must call BAPI_TRANSACTION_ROLLBACK instead of ROLLBACK WORK. It will empty the BAPI buffer too. Here's why:
If you rollback the first BAPI using ROLLBACK WORK statement, you must absolutely refresh the buffer, otherwise the next BAPI could think that the data will exist and would attempt erroneously to write data.
All that is probably better explained in SAP Library documentation about BAPI buffer
To test a BAPI, you need to use a test sequence in SE37, for calling BAPI_TRANSACTION_COMMIT. See SDN wiki - Function Module Test Sequence.
For information:
SAP library documentation about BAPI template code shows why buffers were initially required at an older time: as only PERFORM ON COMMIT was available (CALL FUNCTION IN UPDATE TASK did not exist yet), all data had to be retained in memory (because the form is called once though registered several times).
Now, as only CALL FUNCTION IN UPDATE TASK should be used, it makes obsolete this documentation and the need for storing data in memory. But buffer is still in use as I explained above.
发表评论
-
DISABLE button(FCODE) from the GUI-Status
2014-08-04 15:54 6321. Goto-> Attributes->Pus ... -
Handy SAP function module to automate user events
2013-11-28 09:49 751*Begin-Auto triggers ENTER comm ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 819FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 744FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
Unpermitted combination of business object BUS2032 and sales doc. category H
2013-01-25 14:20 4135Q: create New Sales Order using ... -
Function Module: get all users who have specific role
2013-01-25 14:16 679CALL FUNCTION 'RSRA_USERS_O ... -
Create a SELECT-OPTIONS in a module pool screen
2012-03-07 15:35 1026source:http://abap-explorer.blo ... -
Converting OTF data from script to Spool Request
2012-03-06 17:25 0source:http://forums.sdn.sap.co ... -
Calculate the days, months and years between 2 dates.
2012-02-21 16:14 835FORM compute_2date_diff. DAT ... -
Retrieving Domain fixed values
2012-02-16 11:13 811source:http://www.saptechnical. ... -
If 1 equals 2, what’s the purpose?
2012-02-16 10:59 836source:http://sapport.blogspot. ... -
get status name for batch input session
2012-01-31 14:47 922Line 601 in program SAPMSBDC_CC ... -
create zip folder with cl_abap_zip
2011-12-05 18:11 1208REPORT ztest. DATA: gv_file ... -
MIRO
2011-11-29 10:39 2064from: http://help-sap.blogspot. ... -
Create Vendor or Customer_master Data
2011-11-23 16:22 2920To Create or Change Vendor_mast ... -
Pay attention to the following points when using append structures
2011-10-27 13:43 1310You cannot create append str ... -
Help Views
2011-10-20 10:46 737source:http://help.sap.com/saph ... -
What is the Different Types and Usage of Views
2011-10-19 23:06 847source:http://www.sap-img.com/a ... -
Upload a Comma Delimited CSV file that contains commas in data
2011-09-23 17:22 2234source:http://wiki.sdn.sap.com/ ... -
What is the difference between SET SCREEN and CALL SCREEN ?
2011-09-19 21:50 763source:http://www.saptechies.co ...
相关推荐
- 如果没有错误,调用事务提交函数`BAPI_TRANSACTION_COMMIT`完成修改操作。 - 最后,更新项目网络组件的批准数量。 #### 核心知识点解析 - **BAPI接口调用**:通过上述步骤可以看到,BAPI接口提供了标准化的...
- 如果没有错误并且不是测试模式,则提交事务(`BAPI_TRANSACTION_COMMIT`)。 5. **清理工作**: - 清除所有使用的临时表和变量。 #### 四、注意事项 - 在使用`BAPI_PO_CHANGE`修改PO时,需要确保有足够的权限,...
本文将详细介绍如何使用BAPI_TRANSACTION_COMMIT创建及修改物料主数据,包括物料主数据的创建和修改、物料描述的设置、客户端层次物料数据的设置、物料类型的设置等。 物料主数据的创建 在SAP系统中,物料主数据是...
assign component 'POSNR' of structure <l_struc> to <l_field>. read table c_accit with key posnr = <l_field> into wa_accit. if sy-subrc is initial. move-corresponding <l_struc> to wa_accit. ...
标题与描述中的“凭证导入 BAPI_ACC_DOCUMENT_POST”指向了一个特定的SAP系统功能,用于自动化导入财务凭证,尤其在银行流水与企业财务系统间建立接口时至关重要。此过程不仅涉及标准参数的传递,还触及了如何处理和...
在SAP系统中,BAPI(Business Application Programming Interface)是一种标准接口,允许外部应用程序与SAP系统进行交互,包括创建、更改和查询业务数据。在本案例中,我们需要利用BAPI_SALESORDER_CHANGE来修改销售...
<x_ci_ekkodb> = <x_im_container>. lf_done = cl_mmpur_constants=>yes. ELSEIF im_name = 'CI_EKKODBX'. l_ci_ekkodbx = im_container. lf_done = cl_mmpur_constants=>yes. ELSEIF im_name = 'CI_EKPODB'. ...
### BAPI_NETWORK_MAINTAIN:下达项目网络的BAPI #### 概述 在SAP系统中,**BAPI_NETWORK_MAINTAIN** 是一个用于维护和管理项目网络的业务应用程序接口(Business Application Programming Interface,简称BAPI)...
6. BAPI_CHARACT_CREATE/BAPI_CHARACT_CHANGE/BAPI_CHARACT_DELETE/BAPI_CHARACT_RENAME/BAPI_CHARACT_GETDETAIL/BAPI_CHARACT_ADDLONGTEXT/BAPI_CHARACT_REMOVELONGTEXT/BAPI_CHARACT_GETLONGTEXT/CARD_...
这个是存储数据的,只有在调用完该函数后,工艺路线才真正创建,然后再加上 COMMIT WORK,如果成功,return 则不会返回信息。 我们可以使用 CP_CC_S_IMPORT_DATA 函数来解决 BAPI_ROUTING_CREATE 不可以创建定额...
ASSIGN COMPONENT 'ITEMNO_ACC' OF STRUCTURE <l_struc> TO <l_field>. READ TABLE c_accit WITH KEY posnr = <l_field> INTO wa_accit. IF sy-subrc IS INITIAL. MOVE-CORRESPONDING <l_struc> TO wa_accit. ...
通过JCo接口利用BAPI函数创建PO订单
BAPI_SALESORDER_CREATEFROMDAT2是SAP系统中创建销售订单的API接口,通过调用这个接口,可以快速创建销售订单。 在创建销售订单时,需要设置订单的头信息、项目信息、伙伴信息和计划信息等。头信息包括订单类型、...
在SAP系统中,BAPI(Business Application Programming Interface)是一种预定义的函数模块,用于在不同组件之间进行集成和自动化业务流程。本示例中的"实用BAPI做内部调拨"是指使用BAPI_GOODSMVT_CREATE来执行物料...
- BAPI表扩展的命名规范是<namespace>BAPI_TE_<table_name>,其中<namespace>是用户自定义的命名空间,<table_name>是原SAP表的名字。 - 由于结构名称长度限制,可能需要缩短名称,但应保持名称的可读性。 - 每个...
LSMW_BAPI_MM02_CS01
调用BAPI函数:BAPI_INCOMINGINVOICE_POST实现批量MIR4功能。
这是SAP ABAP 中BAPI GOODS的函数说明,有利于用户进行更深入的了解
SAP中很多情况下客户提出增强的需求时,我们通常会用到BAPI或者BADI。虽然你可以在SAP中直接输入TCd:BAPI来查找。但是并不是所有的BAPI都能查得到的。希望这个清单能够帮到你。
《BAPI用户指南》 本指南旨在为SAP开发者提供有关BAPI(Business Application Programming Interface)的详尽信息,帮助他们更好地理解和运用这些接口。BAPI是SAP系统中的核心组件,它允许外部应用程序与SAP系统...