03-04-2020 6:38 PM
Hi Friends,
I am using Number Range(Numbers) in Z table. When 2 threads are reading same SELECT Query at same time, same number is assigned to required Variable. Can you help me to fix the issue ?
Thanks,
Balaji.T.
03-04-2020 7:12 PM
Your Problem ist the complience to the ACID-principles (https://en.wikipedia.org/wiki/ACID).
From the point of view of thread 2 the database behaves as if thread 1 was not there. Therefor these two accesses need to be serialized. Thread 2 is allowed to pick a number only after thread 1 is finished picking a number. If you need to ensure that there is no missing number in your Z table (thread 1 takes a number but fails to complete) you need to serialize even further.
What parts of your threads need to be serialized highly depends on the needs of your function.
03-08-2020 3:54 PM
Hi Michael,
Thank you for your quick reply. I am new to Serializing Concept in SAP ABAP. Please help me to serialize below Select Query(Z Table: ZMAT_XYZ which is having Number Range Values). This below is my Select Query I am using in ABAP code.
SELECT ean_category sequence prefix threshold status
INTO CORRESPONDING FIELDS OF TABLE lt_ean_data
FROM ZMAT_XYZ
WHERE ean_category = 'UC'.
As you understood, 2nd Thread is using same data of Internal table ( LT_EAN_DATA) existed in 1st Thread. Hence 2nd Thread is failing finally.
Thanks,
Balaji.T.
03-09-2020 4:45 PM
Can you try creating number range object and use that instead of select ??
03-10-2020 7:22 AM
I guess then u will have to put a lock on the table before reading and release imeediately once done. Try to check for lock in loop like 3 times else give error message.
03-10-2020 7:38 AM
Dear Balaji
If you are not using number range objects.....
Try to use lock after the select statement.
select * FROM ZMAT_XYZ FOR UPDATE ......
Make sure you issue commit statement to release locks
Regards,
Venkat
03-09-2020 5:16 PM
Hi Jyothir,
No , I can't create Number range object as an alternative of ZMAT_XYZ table. ZMAT_XYZ table is having many EAN categories, which is flexible to the Business.
Thanks,
Balaji.T.
03-10-2020 12:37 AM
As Jelena said: "Please use Comment button to reply to the answers. "Submit your Answer" is meant to add a new answer to the original question. Read "Before answering"."
03-09-2020 5:42 PM
HI
BADI of MM01 to be used based on material type, number range to be picked.
03-09-2020 8:18 PM
Sorry but how is this relevant to OP's question? This is about assigning a number in a Z table. I've read all the comments and fail to understand how it was deducted that this has anything to do with MM01.
03-09-2020 8:15 PM
SAP provides standard number range functionality exactly for this purpose, this blog can get you started: https://blogs.sap.com/2015/05/29/number-ranges-things-to-keep-in-mind/
Number range is not an alternative to Z table, it allows to simplify generation of new numbers to be used with your Z table.
P.S. Please use Comment button to reply to the answers. "Submit your Answer" is meant to add a new answer to the original question. Read "Before answering".