‎2011 Oct 24 2:23 PM
I encountered a tricky issue on customer's system as described below:
In order to insert multiple records into database, we have a statement to trigger:
MODIFY DB FROM itab.
No commit work continued ***
The above command cannot trigger database commit until explicitly calling 'COMMIT WORK' via debugging.
But there would be not this issue on our system.
My question is: Can this behvarior be configured in SAP R/3 system? or depend on database?
Thanks a lot,
Boer
‎2011 Oct 25 10:03 AM
Hi Boer,
As I understand, in standard R/3, if your sy-subrc return value is 0, then, the DATABASE COMMIT will happen at the end of your LUW (Logical Unit of Work). In case of an Explicit COMMIT WORK requirement, the same be added.
Regards,
Pranav.
‎2011 Oct 25 10:09 AM
- COMMIT WORK will trigger a database commit but not only this -> [COMMIT WORK|http://help.sap.com/abapdocu_70/en/ABAPCOMMIT.htm]
- Other events will trigger a database commit -> [Implicit Database Commits|http://help.sap.com/abapdocu_70/en/ABENDB_COMMIT.htm]
- You can execute an explicit database commit via function module [DB_COMMIT|http://www.sdn.sap.com/irj/scn/advancedsearch?query=db_commit]
Regards,
Raymond
‎2011 Oct 25 12:36 PM
Should be:
modify database_table from *table* itab
without the table addition, SAP expects a single row work area....
No explicit commit work required.
Edited by: DaveL on Oct 25, 2011 1:37 PM
‎2011 Oct 25 12:50 PM
Hi Boer,
If the Data base table contains zero records then the first time MODIFY statement will fail.
There must be atleast one record in the table to work MODIFY statement on database table.
Check this once.
‎2011 Oct 26 7:52 AM
Actually this clause doesn't work well on customer's system. The following describe more details about my question by logic:
1. Call FM to insert new records into database like:
MODIFY DB FROM itab --> sy-subrc =0
2. Execute the above FM again:
MODIFY DB FROM itab2 --> sy-subrc =0
Both FM calls are carried out successfully, but the related data aren't written into database immediately. More tricky issue occur here that is about 'itab2' data is to be lost.
Thanks,
Boer
‎2011 Oct 26 8:31 AM
Without COMMIT WORK (or end of transaction which does it for you, and a few other places), the database will not be updated. There is no general configuration for the SAP system to carry out database operations immediately. You must put a COMMIT WORK after the SQL statement.
You can open seperate database connections if you need to decouple updates from other updates.
You may be able to configure your database to update immediately - but that is a question for a DBA, not the ABAP forums.
There does exists a function module for DB2 that switches the system to "dirty mode", which means, if I remember correctly, that after that call, all updates will be done immediately.
Perhaps if you explained why you have the requirement, we'd be able to advise another solution?
matt
‎2011 Oct 27 2:58 AM
Hi Matt,
In fact, we haven't encountered this issue, the data would be written into database immediately in our system for the same implementation. That's why I ask this question.
On the above logic, we can see the new data via SE16 after calling FM to insert data.
But it doesn't happen in customer's system as I described above.
Thanks,
‎2011 Oct 27 8:20 AM
>My question is: Can this behvarior be configured in SAP R/3 system? or depend on database?
The answer is: no and no (except if explicitly switched on via a FM call with DB2). In my view something else is going on. Probably data related.
‎2011 Oct 27 8:28 AM