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 table update issue

Former Member
0 Kudos

Hello experts, Need your Help...

I am trying to update database table using Update command. And I am doing COMMIT WORK AND WAIT. after the successful update.

But my code sometimes does not work and the table is not updated.

Sometimes the code works and sometimes not.. for the same data.

Can anybody think of any possible reason?

Thanks in advance,

--Kumail

1 ACCEPTED SOLUTION

satyajit_mohapatra
Active Contributor
0 Kudos

I'm not sure about the cause as the code has not been shared. The isssue may be due to incorrect usage of ABAP statements.

But, I've faced a similar situation in past, where none of the SAP updations were working. It was due to overflow of buffer for update tasks. There will be a specific amount of memory allocated for Dialog, Update, Background Tasks at particular period. If the number of update tasks cross a certain permisible limit, updation problems may occur.

Also, this problem will be across the system and not with a particular program or transaction. Whenever the updation fails in your program, try to update with some other program or transaction to make sure the problem is not specific to your program.

The issue was resolved by manually stopping the unnecessary update tasks in SM50. Hope this may solve your problem.

8 REPLIES 8

Former Member
0 Kudos

Hi,

Can you post your code and table structure?

Obvious reason can be duplicate data...COMMIT WORK does not gurantee it will update the table even with duplicate keys

Thanks,

Regards,

Mohaiyuddin

Edited by: Mohaiyuddin Soniwala on Feb 11, 2010 2:23 PM

Former Member
0 Kudos

Direct database table using update is not recommended .Cant comment unless the code is given.

Using update you need to check with the possible no of keys in the table on which you are performing the operation.

You need to use all the keys in the update statement. If you miss any then there can be no update assuming it to be

duplicate. Check sysubrc value in the update statement.

Br,

Vijay.

Former Member
0 Kudos

first thing, updation of sap standard table with update is not recommended

and if update is not working sometimes,this might be becase of your condition, which might be getting failed...

Former Member
0 Kudos

Hi Kumail,

I am also having a similar problem, Can you please tell me how solved this problem.

satyajit_mohapatra
Active Contributor
0 Kudos

I'm not sure about the cause as the code has not been shared. The isssue may be due to incorrect usage of ABAP statements.

But, I've faced a similar situation in past, where none of the SAP updations were working. It was due to overflow of buffer for update tasks. There will be a specific amount of memory allocated for Dialog, Update, Background Tasks at particular period. If the number of update tasks cross a certain permisible limit, updation problems may occur.

Also, this problem will be across the system and not with a particular program or transaction. Whenever the updation fails in your program, try to update with some other program or transaction to make sure the problem is not specific to your program.

The issue was resolved by manually stopping the unnecessary update tasks in SM50. Hope this may solve your problem.

0 Kudos

Hi Satyajit, Thanks for the reply, you can see the full issue here.

That should give you more insight into the issue.

Regards

-Kumar

Edited by: saplogs on Apr 8, 2010 11:43 AM Wrong Link

satyajit_mohapatra
Active Contributor
0 Kudos

Not sure of the exact issue...........But as mentioned the FM for updation is being called by the workflow numerous times and it's updating the same table numerous times as well. It may be a locking issue of the table. Please try using enqueue and dequeue to avoid locking issues or try to increase the time gap between two FM calls by increasing the wait period.

Faced a similar issue in a BDC program. The update was failing as the subsequent records as the transaction was locked by the previous record. It was solved introducing a time gap of 1 sec for each record.

Also the change master table is getting updated directly.........Is it possible to update with BDC/BAPI instead of updating it directly?

0 Kudos

Hello Guys,

Here is the code, here we have all the keys... as it updates correctly sometimes. But doesnt update sometimes... for same data...... I have added COMMITT and WAIT statements to solve this problem.... but no luck....

UPDATE zfxx_bsr_data

SET zfxxstatus_glr = zfxx_bsr_data-zfxxstatus_glr

zfxxstatus_issue = zfxx_bsr_data-zfxxstatus_issue

zfxxerdat_glr = sy-datum

zfxxuser_glr = sy-uname

zfxxremark_glr = zfxx_bsr_data-zfxxremark_glr

zfxxertime_glr = sy-uzeit

doc_ind = w_doc_ind

zfxx_attach_acc = w_zfxx_att_acc

WHERE bukrs EQ t001-bukrs

AND saknr EQ zfxx_bsr_data-saknr

AND zfxxperiod EQ zfxx_bsr_data-zfxxperiod

AND zfxxfield EQ c_ba

AND zfxxfieldval EQ tgsb-gsber.

IF sy-subrc EQ 0.

WAIT UP TO 3 SECONDS.

COMMIT WORK.

WAIT UP TO 3 SECONDS.

ENDIF.