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: 

Commit/rollback after insert?

Former Member
0 Kudos

Hi guys,

I have two questons please:

1. Do I need to do commit/rollback after I insert/update record in internal table? does this depends on loop...endloop

2. Do I need to do commit/rollback after I insert/update record from abap into remote oracle db?

Thanks,

Nihad

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi;

suppose you are updating a table and if you

comit it then the document is updated in the database.

ROOL BACK: If suppose some error occured during updation

and you have not commited then the entire ata is not

updated in the table and that is known as roll back.

For details, have a look

[Link|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3b64358411d1829f0000e829fbfe/content.htm]

Regards

Shashi

6 REPLIES 6

Former Member
0 Kudos

Hi;

suppose you are updating a table and if you

comit it then the document is updated in the database.

ROOL BACK: If suppose some error occured during updation

and you have not commited then the entire ata is not

updated in the table and that is known as roll back.

For details, have a look

[Link|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3b64358411d1829f0000e829fbfe/content.htm]

Regards

Shashi

Former Member
0 Kudos

Hi,

You need not do any commit or rollback in internal tables... as its not affecting the data base tables....

but when you are updating the database tables let it be oracle DB or any other that time its mandatory to write commit or rollback depending on the situation...

Regards,

Siddarth

Former Member
0 Kudos

Hi,

1. Do I need to do commit/rollback after I insert/update record in internal table? does this depends on loop...endloop

The puropse of Internal table is only for temporary storage.There is no need for commit/rollback in this case.

2. Do I need to do commit/rollback after I insert/update record from abap into remote oracle db?

I case of database table you have to commit for update or rollback if no need.

Thanks,

Karthik

Former Member
0 Kudos

hi,

no need in Internal table..

and use COMMIT WORK when doing mass changes

please refer to this link

Former Member
0 Kudos

Thanks for answers,

I mean when insert or update in custom z table (not internal temporary, I said wrong). This table will be storage table..,so I need to do it right?

is this enough after insert line? how to add some message to this, if insert is not sucessful?

IF SY-SUBRC = 0.

COMMIT WORK.

ELSE.

ROLLBACK WORK.

ENDIF.

Thanks,

Nihad

0 Kudos

Hi ,

Commit will save the updates into ur database.

But Rollback will do the undo from the point whare it is not ommited.

Note: oNce commit u canot rollback that,