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: 

Database Commit

Former Member
0 Kudos

Hi,

I have a program which is running every 10 minutes in batch mode.

The program would update a Z table with the last record timestamp. The same timestamp would be used for next run of the program as starting time and the end time would be current time.

During at some instancs, the time does not seem to be updated properly and is fetching the same set of records. It is difficult to debug since we dont know when this is happening.

I have used the following function to update my table. Let me know whether i can do anything to make sure it updates.

I think 10 minutes is more than enough for a database update to happen.

CALL FUNCTION 'ENQUEUE_E_TABLE'

EXPORTING

mode_rstable = c_lock_write

tabname = c_table_zut

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

UPDATE zut_enhanceval FROM TABLE t_defaults.

CALL FUNCTION 'DEQUEUE_E_TABLE'

EXPORTING

tabname = c_table_zut.

Do i need to put commit work at ends of this to make it immediate or is there any issue with my enqueue and dequeue functionality. Please advise as this is causing big production problem

1 ACCEPTED SOLUTION

former_member182670
Contributor
0 Kudos

I don't see you're handling the situation when ENQUEUE fails. It means you can have all sort of concurrency issues.

6 REPLIES 6

former_member182670
Contributor
0 Kudos

I don't see you're handling the situation when ENQUEUE fails. It means you can have all sort of concurrency issues.

0 Kudos

Hi Tom,

I didnt paste the entire code.

I am checking whether the value of sy-subrc eq 0 after the enqueue. Then I am updating the table.

The table is used by various program for reading data and not for updating. Only my program uses that for updating the table.

Regards

Krish

0 Kudos

Hi,

Can anybody give more insight on this?

Regards

Krish

0 Kudos

Hi,

Can you provide some more details?

What are the key fields for your DB table, what is the logic for filling t_defaults, do you check sy-subrc and sy-dbcnt after update?

krishnendu_laha
Active Contributor
0 Kudos

I agree with Tomek, please add a check after ENQUEUE and write a message if check fails...

another thing please check that table is used by another program and previous job finished before starting for current one..

Thanks

MariaJoãoRocha
Contributor
0 Kudos

Hi,

the lock mode is 'X'? (c_lock_write)

Best regards,

Maria João Rocha