Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

No save data into database immediately after executing SQL 'MODIFY'

Former Member
0 Kudos
866

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

9 REPLIES 9

former_member222709
Contributor
0 Kudos
177

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.

raymond_giuseppi
Active Contributor
0 Kudos
177

- 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

Former Member
0 Kudos
177

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

former_member206439
Contributor
0 Kudos
177

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.

0 Kudos
177

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

0 Kudos
177

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

0 Kudos
177

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,

matt
Active Contributor
0 Kudos
177

>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.

Former Member
0 Kudos
177

Hi Matt,

Got it, thanks a lot.