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: 

How to read Infotype data updated in Buffer in a parallel Job?

former_member736380
Discoverer
0 Kudos

Hi Gurus,

I have a requirement where we are hiring Employees using Decoupled Framework. The data load is huge and parallel processing is implemented. The employee is hired when all the incoming infotypes are successfully updated in buffer before calling the flush method. Every Pernr is mapped to a unique Identification in PA0185. Single Identification number cannot be assigned to two pernrs. So i have to issue an error message if new employee is to be hired with already saved identification number. Issue is when updating data in parallel batches if the same data is present in two batches/tasks and both data get updated successfully because select query on PA0185 does not return any record for both of new hires till the database commit is done.

Any idea how to resolve the issue.

1 ACCEPTED SOLUTION

michael_piesche
Active Contributor
0 Kudos

You will need to move the (final) check of "whether to create a new record and the insert of that record" to an 'outer' function that knows it all. But it all might also depend on how you currently set up your parallel processes and how much you are willing to change those.

  • If you have 'loads' of new records, you might want to use an 'outer' function that can be called from within each parallel process, that governs the 'new records' buffer and also creates the new records if no hit can be found in the buffer. This outer function can be achieved for example by ABAP Channels or by Shared Objects.
  • If you have a 'few' new records, you might want to move the creation of new records to the end of the the entire process after all parallel processes are done. The parallel processes would pass all info about new records to the receiving main process that waits for all parallel processes. When all processes are finished, the main process would recheck thoses new records and create only the necessary new records.

So, there are at least these three options:

  1. Use ABAP Channels
  2. Use Shared Objects
  3. Rewrite your coding

If you want to find out more about the three options, read the following community threads, research the mentioned SAP functions and come back with further questions if you still have some:

3 REPLIES 3

Sandra_Rossi
Active Contributor

As soon as one batch does a commit, the other batch which reads the updated tables reads the committed data (the up-to-date data). Exceptions:

  • If the batch reads the whole table at the beginning, of course it will not be aware of ongoing updates by other batches. No other solution than reading again the database.
  • If the two batches access the data at the same time approximately, again you have the same issue. No other solution to use a lock mechanism to avoid the reading of tables at the same time.

michael_piesche
Active Contributor
0 Kudos

You will need to move the (final) check of "whether to create a new record and the insert of that record" to an 'outer' function that knows it all. But it all might also depend on how you currently set up your parallel processes and how much you are willing to change those.

  • If you have 'loads' of new records, you might want to use an 'outer' function that can be called from within each parallel process, that governs the 'new records' buffer and also creates the new records if no hit can be found in the buffer. This outer function can be achieved for example by ABAP Channels or by Shared Objects.
  • If you have a 'few' new records, you might want to move the creation of new records to the end of the the entire process after all parallel processes are done. The parallel processes would pass all info about new records to the receiving main process that waits for all parallel processes. When all processes are finished, the main process would recheck thoses new records and create only the necessary new records.

So, there are at least these three options:

  1. Use ABAP Channels
  2. Use Shared Objects
  3. Rewrite your coding

If you want to find out more about the three options, read the following community threads, research the mentioned SAP functions and come back with further questions if you still have some:

Thanks Michael. This is very helpful . Will try out these option and update the post