`
Jack Wu
  • 浏览: 891549 次
  • 来自: ...
社区版块
存档分类
最新评论

关于SAP的事务提交和回滚(LUW)

阅读更多
From the point of view of database programming, a database LUW is an inseparable sequence of database operations that ends with a database commit. The database LUW is either fully executed by the database system or not at all. Once a database LUW has been successfully executed, the database will be in a consistent state. If an error occurs within a database LUW, all of the database changes since the beginning of the database LUW are reversed. This leaves the database in the state it was in before the transaction started.
 
The database changes that occur within a database LUW are not actually written to the database until after the database commit. Until this happens, you can use a database rollback to reverse the changes. In the SAP System, database commits and rollbacks can be triggered either implicitly or using explicit commands.
隐式事务提交(自动提交事务)Implicit Database Commits
A work process can only execute a single database LUW. The consequence of this is that a work process must always end a database LUW when it finishes its work for a user or an external call. Work processes trigger an implicit database commit in the following situations:
·        When a dialog step is completed
Control changes from the work process back to the SAP GUI.
·        When a function module is called in another work process (RFC).
Control passes to the other work process.
·        When the called function module (RFC) in the other work process ends.
Control returns to the calling work process.
·        When a WAIT statement interrupts the work process.
Control passes to another work process.
·        Error dialogs (information, warning, or error messages) in dialog steps.
Control passes from the work process to the SAP GUI.
显式提交事务Explicit Database Commits
There are two ways to trigger an explicit database commit in your application programs:
·        Call the function module DB_COMMIT
The sole task of this function module is to start a database commit.
·        Use the ABAP statement COMMIT WORK
This statement starts a database commit, but also performs other tasks (refer to the keyword documentation for COMMIT WORK).
隐式事务回滚(自动回滚事务)(Implicit Database Rollbacks)
The following cases lead to an implicit database rollback:
·        Runtime error in an application program
This occurs whenever an application program has to terminate because of an unforeseen situation (for example, trying to divide by zero).
·        Termination message
Termination messages are generated using the ABAP statement MESSAGE with the message type A or X. In certain cases (updates), they are also generated with message types I, W, and E. These messages end the current application program.
显式回滚事务(Explicit Database Rollbacks)
You can trigger a database rollback explicitly using the ABAP statement ROLLBACK WORK. This statement starts a database rollback, but also performs other tasks (refer to the keyword documentation for ROLLBACK WORK).
From the above, we can draw up the following list of points at which database LUWs begin and end.
开始数据库事务A Database LUW Begins
·        Each time a dialog step starts (when the dialog step is sent to the work process).
·        Whenever the previous database LUW ends in a database commit.
·        Whenever the previous database LUW ends in a database rollback.
结束数据库事务A Database LUW Ends
·        Each time a database commit occurs. This writes all of the changes to the database.
·        Each time a database rollback occurs. This reverses all of the changes made during the LUW.
Database LUWs and Database Locks
As well as the database changes made within it, a database LUW also consists of database locks. The database system uses locks to ensure that two or more users cannot change the same data simultaneously, since this could lead to inconsistent data being written to the database. A database lock can only be active for the duration of a database LUW. They are automatically released when the database LUW ends. In order to program SAP LUWs, we need a lock mechanism within the R/3 System that allows us to create locks with a longer lifetime (refer to The SAP Locking Concept).
 相关连接http://blog.csdn.net/CompassButton/archive/2006/12/15/1444415.aspx 
分享到:
评论

相关推荐

    基于GrégoireCachet的优秀要点的Django事务的提交和回滚信号。_Python_下载.zip

    Grégoire Cachet的优秀要点深入探讨了Django中的事务处理,特别是关于事务的提交和回滚信号。这些信号使得开发者能够更精细地控制数据库操作,并在特定条件下触发事务的提交或回滚,确保数据的正确保存或撤销。 1....

    PostgreSQL 10 基础课程第五章 高级知识事务提交及回滚

    PostgreSQL 10 基础课程第五章 高级知识事务提交及回滚

    简单的c#事务回滚实例代码

    在.NET框架中,C#语言提供了对事务处理的强大支持,特别是在数据库操作中,事务回滚是确保数据一致性的重要机制。本实例将详细讲解如何在C#中实现简单的事务回滚功能,以应对在执行多条SQL语句时可能出现的错误。 ...

    SQL 事务回滚解决 回滚无效的情况

    SQL 事务回滚解决回滚无效的情况 BEGIN TRY END TRY CAHTH

    JAVA设置手动提交事务,回滚事务,提交事务的操作

    本文主要介绍了JAVA设置手动提交事务、回滚事务、提交事务的操作,涉及到事务的自动提交、手动提交、回滚和提交等操作。以下是对这些操作的详细解释和示例代码。 一、事务的自动提交 在JAVA中,默认情况下,数据库...

    NET 2.0中的事务处理、回滚处理

    显式事务管理是另一种常见的事务处理方式,它允许开发者对事务的开始、提交和回滚进行更精确的控制。`TransactionScope`类是实现显式事务的关键,通常配合`CommittableTransaction`类一起使用。开发者可以手动开启...

    mysql实现事务的提交和回滚实例

    本实例将深入探讨如何在MySQL中实现事务的提交和回滚。 首先,MySQL提供了开始事务、提交事务和回滚事务的命令。`START TRANSACTION` 或 `BEGIN` 用于开启一个事务,`COMMIT` 用于提交事务,而 `ROLLBACK` 则用于...

    mysql实现事务的提交与回滚的实例详解

    在MySQL中,事务是用于管理数据库操作序列的一种机制,它确保了数据的一致性和完整性。在上述描述中,作者提出了如何使用事务来控制...通过学习如何控制事务的提交和回滚,我们可以更有效地管理和保护数据库中的数据。

    oracle 在java中的事务处理和异常回滚。

    手动事务管理通常通过`Connection`对象的`setAutoCommit(false)`方法来关闭自动提交,然后通过`commit()`和`rollback()`方法来控制事务的提交和回滚。下面是一个简单的示例: ```java try (Connection conn = ...

    Spring Boot多数据源(支持Spring声明式事务切换和回滚).pdf

    《Spring Boot多数据源(支持Spring声明式事务切换和回滚)》 Spring Boot多数据源技术是构建高效、灵活的多租户SaaS架构的关键。在本文中,我们将深入探讨如何实现动态数据源切换,支持Spring声明式事务管理,并讨论...

    Spring/SpringMVC/MyBatis整合+事务回滚

    配置事务管理器后,可以通过@Transactional注解在方法级别控制事务的开始、提交或回滚。 7. **实现事务回滚**:当在@Transactional注解的方法中发生异常时,Spring会自动回滚事务。例如,如果在保存数据时发生错误...

    SpringBoot的事务使用和回滚功能讲解.docx

    以下是对Spring Boot事务使用和回滚功能的详细讲解: 1. **启用事务管理**: 开启事务管理可以通过在启动类上添加`@EnableTransactionManagement`注解来完成。然而,需要注意的是,Spring Boot通常默认已经开启了...

    spring 简单实例 事务回滚

    这会告诉Spring在调用此方法时启动一个新的事务,并在方法正常结束时提交事务,或者在遇到异常时回滚事务。 4. 异常处理:为了触发事务回滚,方法内通常会抛出未检查异常(继承自`RuntimeException`的异常)或显式...

    数据库试验,关于事务的创建撤销,事务的回滚等基本操作练习

    在事务中,如果发生错误,可以回滚到事务开始前的状态,而在非事务模式下,错误可能导致部分操作被提交,导致数据不一致。 如果在执行事务过程中遇到断电情况,数据库系统通常会使用日志记录事务的状态,以便在重启...

    Spring+Mybatis整合事务回滚

    花了一晚上时间终于搞出来了Spring整合Mybatis事务回滚(Mysql数据库),控制Service层中的多次插入操作,多次操作整体是一个事务。 里面有缘嘛和jar包,资源为war包,导入即可。运行Test类中的测试代码即可。 建表...

    oracle 事务 回滚 存储过程

    特别是关于事务嵌套、`ROLLBACK`和`COMMIT`的使用,以及错误处理机制(如`BEGIN TRY`和`BEGIN CATCH`块),这些都是跨数据库系统普遍适用的。 ### 实践中的应用 在实践中,存储过程与事务的结合主要用于以下场景:...

    详解Java的JDBC API中事务的提交和回滚

    本篇将深入探讨JDBC API中关于事务的提交和回滚的细节。 在默认情况下,JDBC连接处于自动提交模式,这意味着每执行一个SQL语句,如果执行成功,该操作就会立即提交到数据库。这种模式适合于简单的应用,但在以下几...

    事物例子(构件,开始,提交,回滚) c#

    在IT行业中,事务是数据库操作的基本单位,它确保了数据的一致性和完整性。尤其是在C#编程中,处理事务是常见的任务,特别是...通过掌握开始、提交和回滚事务的方法,可以确保在多步骤操作中维持数据的完整性和一致性。

    嵌套事务的回滚与提交.pdf

    本文主要讨论了嵌套事务的回滚与提交,以及事务保存点的使用。 首先,我们要明白在嵌套事务中,如果内部事务出错,通常会引发外部事务的回滚。这是因为内部事务的失败被视为整个事务链的失败。例如,如果外部事务...

Global site tag (gtag.js) - Google Analytics