Skip to Content

Sequential number generation for multiple plants - options?

we have 5 plants and we need to generate/print sequential numbers for some records identifiers such that plants are not duplicating the same number for a day..

Example, we will have 100 record identifies across 5 plants every the number range will be 20161011-01 to 99991231-99

for today when I run my custom transaction to print 10 sequential number for plant 1, system should generate 20161011-01 to 20161011-10

and when plant 2 uses the same transaction for printing 5 numbers, the logic should print 20161011-11 to 20161011-15

how do I do this? how will the 2nd plant know that plant 1 has printed first 10, so it should start with 11?

what if both the plants uses the transaction same time, how will the program assign numbers without duplicating?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 22, 2016 at 06:06 PM

    Hi Swati,

    I will not suggest to go with tables.creating one custom number range object in snro and

    Calling that to decide next number will be most correct solution. It will avoid duplication.

    Write custom program to reset the counter of this number range each day. And scedule a job at specific time u want.



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 16, 2016 at 02:42 PM

    Hello Swathi,

    You can create a custom table to store the latest sequence number, and use locking and unlocking concept.

    When plant 1 starts printing, it will fetch the latest sequence number, lock the entry, print and then update the latest sequence number back in the table. Post update the entry in the table can be unlocked.

    While plant 1 is printing, if any other plants tries to print they will get an entry locked error.

    There will not be any duplicates, but the downside is that only 1 plant can print at a time.

    Please check about the locking concepts in ABAP, your technical consultant can help you implement this,

    The SAP Lock Concept

    Best Regards,
    Ameya Beri

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 16, 2016 at 03:51 PM

    Ameya, Thanks for the reply.. our sequential number counter needs to be set back to 1 at the end of each day..

    we have plants across the world with different times. how can we set it to 1 at the end of each day? 00:00:00 for us can be 12:00:00 for japan etc..

    Add comment
    10|10000 characters needed characters exceeded