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: 

Multiple Background jobs - creating duplicate entries

Former Member
0 Kudos

Hi Experts,

We have a scenario where the confirmation and GR of the production orders are done by a background job. The production orders reaches SAP from third party interface via XI. Whenever the order reaches XI, an event triggered job will run and post confirmation & GR and create Transfer orders automatically.

In our case, for the same order duplicate transfer orders are getting created. We found that the issue is because of selecting the same orders multiple times in multiple jobs. When a job is started it selects all the unprocessed orders and while it is in progress if the another job is triggered, the second job will select all the unprocessed orders again. Say, first job has selected 10 orders and currently 5th order is in progress, second job will select from 6th to rest of all the unprocessed orders and both the jobs processes 6th pallet to 10th pallet and multiple postings happen. 

while selection the order’s status is unprocessed, but once a session is complete system will update the pallet information in the custom table and  duplicate confirmation and GR information won’t be updated as it is a duplicate entry.  Mostly the duplicate confirmation will be cancelled along
with the GR as per the design process, but at times, the order cancellation may fail because the order is already being processed. Whenever the cancellation fails we have duplicate entries.

We are working on how to stop multiple selection of same pallets in multiple job sessions. Kindly provide your suggestions on the same.

Thanks in Advance,

V.S.Sabitha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

It feels like you need some sort of locking mechanism in the job.  In your example when the first job reads the 10 unprocessed orders it locks each of these.  When the second job reads the 6th to 10th orders it first checks it can lock them before making the posting, if it can't get the lock it doesn't make the posting.

Alternatively, you could request this ticket is moved to an XI forum as there may be functionality in XI to better queue the production orders and avoid parallel jobs running in SAP.

Regards,

Nick

5 REPLIES 5

raymond_giuseppi
Active Contributor
0 Kudos

Classic solution is usage of a lock object, is this a customer program ?

Regards,

Raymond

0 Kudos

Yes this is a custom program. actually till confirmation, both the jobs are processing the same order. when the first job completes the confirmation and the table entry is done,then the second job will try to cancel the confirmation. when this cancellation fails in some scenario,(eg. the order is being processed) the duplicate entries are created.

Thanks in Advance,

V.S.Sabitha

Former Member
0 Kudos

Hi,

It feels like you need some sort of locking mechanism in the job.  In your example when the first job reads the 10 unprocessed orders it locks each of these.  When the second job reads the 6th to 10th orders it first checks it can lock them before making the posting, if it can't get the lock it doesn't make the posting.

Alternatively, you could request this ticket is moved to an XI forum as there may be functionality in XI to better queue the production orders and avoid parallel jobs running in SAP.

Regards,

Nick

0 Kudos

Hi,

Thanks very much for your suggestion. I will check with our abapers for the locking mechanism and get back to you.

Thanks & Regards,

V.S.Sabitha

0 Kudos

Hi,

The same program is iused by 2 plants. in one plant we are not facing this issue. in the other plant we are getting duplicate entries. That plant is seasonal and we receive PO's only for 2-3 months a year.

could anyone give some pointers on why this is behaving like this.?

Thanks in advance

V.S.Sabitha