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

External batch number assignment with multiple user sessions

Former Member
0 Likes
1,503

We are using EXIT_SAPLV01Z_002 exit to assign an external batch number in sequence for PO in Cor2.

This is triggered during the "create batch" button and also during the "release".

now suppose the next batch number to be assigned is ABCD20.

if i open two orders simultaneously in cor2 , both generates ABCD20.

The desired output is: if two orders are opened and batch is generated simultaneously, then one should generate ABCD20 and other ABCD30.

It is not necessary that the batch will be saved to the order at this moment.

I tried using import export of internal tables.but it is not working properly.

If i assign ABCD20 to PO1 and ABCD30 to PO2 in internal table, it always will generate ABCD30 for PO2, even if it is opened alone in cor2.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,375

Problem solved.

Used import export of internal table and FM ENQUEUE_READ to check the lock of other orders.

10 REPLIES 10
Read only

Former Member
0 Likes
1,375

Hi,

Have you tried using lock objects?

Regards -

Makarand

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,375

How are you assigning the external number bacth assignment..? How is this number ABCD20 generated?

Nabheet

Read only

0 Likes
1,375

EXIT_SAPLV01Z_002 is used to rename the batch which sap generates.

There is a  logic to get the first characters  then 20 is the sequence number

Read only

0 Likes
1,375

How do you decide the sequence..?  Are you reading it from database..? Please provide the logic

Read only

0 Likes
1,375

yes i check the last sequence for ABCD in mcha table.

if 10 is laready there i do a +10 which gives 20

Read only

0 Likes
1,375

Okie...Do one thing you should actually create a custom table with a lock object and update it with current number then it can work.

Nabheet

Read only

former_member201275
Active Contributor
0 Likes
1,375

Sorry not a very comprehensive answer as I haven't used this exit myself, but have you tried  EXIT_SAPLV01Z_001 as it looks to me more correct for assigning batch number?

Or maybe a combination, you can maybe supress the one number if it is selected by second user in 001?

Read only

Former Member
0 Likes
1,375

The exit i am using is correct. It works as expected. only I am not able to decide the next sequence of the batch for  order when there are multiple sessions.

Read only

0 Likes
1,375

Dear krishnapriya nair,

check the attached sample code ...hope it helps

Regards

Shravan

Read only

Former Member
0 Likes
1,376

Problem solved.

Used import export of internal table and FM ENQUEUE_READ to check the lock of other orders.