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: 

Records not getting updated properly

Former Member
0 Kudos

Hi Experts,

We are facing a peculiar problem with correct updation of records in a custom Z-table.

Let me explain the situation in detail:

This is a KPI Picture Report.

We have a table called Picture Table where we are capturing order related entries.There is another table called Confirmation Table which contains the details of the confirmations done against the orders.

The program logic checks the confirmations done against each order and then updates the Net Confirmation Quantity field of the order in the Picture table.

For a particular order,confirmations can be done on different days of a week.Say for Order 1 (Order Qty = 100),confirmations were done on two consecutive days with quantities,say 10 and 30. When the program runs for all orders created in a week, it misses some confirmations,say 30 in this case.This gives a wrong picture to us. On the other hand,if we identify such orders and run the same program for these orders,the confirmations are correctly captured.

Hence,my question to you is:

Is there any chance that the update is not happening when the program is run for a bulk of orders?

If not,then how is it that when i run the same program for a week,some confirmations are not captured,but when the orders are identified and the same program is run,we get the correct picture?

5 REPLIES 5

Former Member
0 Kudos

hi Debashis,

it sometimes happens that database update may not be completely done and the abap program may actually try the next update. to be sure of this, you can try updating the records in an update task....(create a function module to update the records and call it in update task). this way, all updates will be deferred till the commit hapenns...

this is assuming that your code is correct....may be if you can post that too then it can aid the analysis of the same better.

0 Kudos

Hi Priyank,

Thanks for your reply. The pseudocode used is as follows:

LOOP AT ipic.

wk_index = sy-tabix.

MOVE-CORRESPONDING ipic TO zeppds_kpi_pict.

MODIFY zeppds_kpi_pict.

IF sy-subrc <> 0.

ipic-status = 'EE'. " Error detected

ENDIF.

ENDLOOP.

Here ipic contains the correct recods as per the program logic.

Hope this helps.

Thanks,

Debasish

vinod_vemuru2
Active Contributor
0 Kudos

Hi Debashish,

Are u updating it in BULK or record by record.

If it is record by record the use COMMIT WORK after each update statement. Ideally this should solve ur problem.

Also u can debug the batch job and see whether that order has been selected or not.

Another reason could be at the time of execution of ur report some one might be editing this order. So order header table will be locked for this entry. So ur program might not picked that order. To avoid this use locking concepts.

Also is ur Ztable is updated only by this program or any other program as well. If yes then u have to create the lock object for ur ztable and use it all the programs which updates this tabel.

Hope u got some inputs.

Thanks,

Vinod.

0 Kudos

Hi,

As already said by Vinod, i would like to add that its better that you lock your table when you start executing the report and unlock before you complete the execution... Make sure you have an EXCLUSIVE lock and not Shared Lock.....

Also, Try checking the total value in the internal table just before the Update / Modify statement..

Might be, your calc logic must be failing some where - Just pointing at the possibility.

Hope this solves your problem.

Regards,

Kunjal

0 Kudos

Hi Vinod,

I am updating it record by record.

I have already debugged the batch job and the orders gets selected correctly.

Another reason could be at the time of execution of ur report some one might be editing this order. So order header table will be locked for this entry. So ur program might not picked that order. To avoid this use locking concepts. --> I see very minimal possibility for this because the job runs at a time when there are ideally no users operating the system.

Also is ur Ztable is updated only by this program or any other program as well. If yes then u have to create the lock object for ur ztable and use it all the programs which updates this table

--> yes, the Ztable gets updated by one more program,may be lock object would work.

Thanks for your inputs.

Debasish