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: 

quasi-simultaneous events while updating ztable.

339

Hello Guru's,

I have a function module having update statement, and i tried to execute the same FM from 2 sessions by keeping breakpoint at update statement.

In first session record updated in table, for second session sy-subrc = 4, since there is same record available in table.

for second session also record should be inserted into table with count increasing(we have count field in table as keyfield)

Actually i have taken two sessions as example, in real time there are N number of sessions...

Could any one give effective solution.... i dont want to miss any record.

Many Thanks,

Praneeth Ch.

5 REPLIES 5

dev_parbutteea
Active Contributor
0 Kudos
243

Hi,

is the table being locked for editing in your first session? This might explain why the second session is not able to create new data.

0 Kudos
243

Hello Mahesh,

I have time stamp as well. At particular time i.e., assume 11:00:00 around 10 records are inserting some time, and yes i have requirement to make count as key field.

Thank you for response.

243

Praneeth Chintapalli, I still don't recommed to use the count as the key field. another best option for you is to use the number range:

https://wiki.scn.sap.com/wiki/display/ABAP/How+to+Create+you+own+Number+Range++SNRO

Tip: You can click on comment and reply to answers instead of posting a new answer.

Thanks,
Mahesh

0 Kudos
243

Can we achieve this with Table locks??

maheshpalavalli
Active Contributor
243

I would suggest you to use the GUID as the key fields to do this. you don't need to worry anymore about the count of these records and anyways you wil have the timestamp to find out which is the latest inserted data. Even most of the SAP applications follow this, using count is not very reliable in these parallel session scenarios.

Or you have any business requirement to have count as the key?

Update:

Praneeth Chintapalli, I still don't recommed to use the count as the key field. another best option for you is to use the number range:

https://wiki.scn.sap.com/wiki/display/ABAP/How+to+Create+you+own+Number+Range++SNRO

Thanks,
Mahesh