Application Development and Automation 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: 
Read only

Multiple users executing the same program at same time and multiple equipment's getting created

jonna_pavan
Explorer
0 Likes
4,269

Hello,

The program accepts a excel file and creates equipment.My issue is when multiple users execute the program at the same time,it creates multiple equipment's for the same record combination.

Let's say file has 2 records and 2 users are running the program at same time.

Now program will create 2 equipment's for 1st record and 2 equipment's for 2nd record.A total of 4 equipment's are getting created instead of 2.

I do not want this to happen and do not want to lock the program. I still want to allow multiple users to run the program at the same time and if first record is already processed by one user it should be skipped in another processing and should continue with other record.Please help me in solving this issue.

1 ACCEPTED SOLUTION
Read only

former_member400468
Active Participant
3,381

Hi!

Do you use lock objects in the processing? If you use INDX table, you can also lock it by FM ENQUEUE_ESINDX so this will prevent other users from processing the entry.

Hope it's helpful

14 REPLIES 14
Read only

jonna_pavan
Explorer
0 Likes
3,381

Can some one throw some light on using 'INDX' table during run time to check whether record is processed in another session or not?

Read only

former_member400468
Active Participant
3,382

Hi!

Do you use lock objects in the processing? If you use INDX table, you can also lock it by FM ENQUEUE_ESINDX so this will prevent other users from processing the entry.

Hope it's helpful

Read only

0 Likes
3,381

Hi,

I haven't used any lock objects.Could you please let me know, how can I make use of 'INDX' table?

My plan is to check whether entry exists in INDX table and if exists skip the record but not sure on what basis should I check the records from INDX table.What values to be passed in the key fields in order to check a particular record exists in INDX table?

Read only

3,381

Your plan is effectively replicating what enqueue does for you. Create your own lock object with approprirate keys so the same equipment cannot be created twice.

Read only

0 Likes
3,381

Yes Mike.Locking works.Thank you.

Read only

matt
Active Contributor
0 Likes
3,381

What happens if user one runs the program and then user two runs the program? You'll still get 2 equipments for the first record and 2 equipments for the second, won't you?

Why are two users loading the same excel at the same time anyway.

Your scenario is somewhat strange.

Read only

matt
Active Contributor
0 Likes
3,381

I think you'd be well advised to read up again on the SAP locking concept and lock objects.

Read only

jonna_pavan
Explorer
0 Likes
3,381

2 equipment's are created for the first record only when both the users start execution at same time. Yes,scenario is strange.This situation is not frequent though but when this situation arises program should be in a position to process as explained.

Read only

former_member564522
Active Participant
3,381

Hi Pavan,

I assume from your query that you are Migrating the data and creating equipment in bulk.

As you said it created 2 different equipment if run in parallel ,I assume you are using the internal number range.

To fix it , you can create a Z table that can hold the record of identification from excel file. if that record is present then any other program with same set of record won't process it.

Regards

Himanshu

Read only

0 Likes
3,381

There is an issue with this solution as well Himanshu.

What if the same program running in parallel sessions try to insert the same record in the table at same time?

Read only

3,381

There is no Z-table needed. Follow Matthew's advice and familiarise yourself with locking. This is one of the fundamental concepts of data processing since databases were invented.

Read only

3,381

Hi Sai,

For that the key field would be your identification number . As it is key field you cannot insert two value at the same time. This way it won't create an issue.

Creating a table will also help you identify the total record that has been proceed successfully and you may not need to rectify or create new delta file to rerun.

if you are using External number then obviously you don't need any solution .

Read only

0 Likes
3,381

Hi Himanshu,

Thank you for your thoughts.

Read only

jonna_pavan
Explorer
0 Likes
3,381

Hi Matthew,

Thank you and locking works.