<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Generate  unique batch numbers in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565477#M1659460</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  I can able to generate numbers usinng FM 'NUMBER_GET_NEXT'. But FM  took more time to execute as am getting a problem with the FM 'NUMBER_GET_NEXT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this bit of code;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL 'ThNoGet' ID 'BNRIV' FIELD BNRIV&lt;/P&gt;&lt;P&gt;ID 'NO' FIELD G_NOIVBUFFER&lt;/P&gt;&lt;P&gt;ID 'QUAN' FIELD P_QUANTITY&lt;/P&gt;&lt;P&gt;ID 'PERCENT' FIELD TNRO-PERCENTAGE&lt;/P&gt;&lt;P&gt;ID 'NONRSWAP' FIELD TNRO-NONRSWAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is returning sy-subrc as 12..How to solve it...Is there any other way to generate unique numbers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Feb 2012 07:49:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-02-23T07:49:30Z</dc:date>
    <item>
      <title>Generate  unique batch numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565473#M1659456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;        I want to generate  unique batch numbers for each execution. For this I used FM GET_JOB_NUMBER. This FM was taking much time while  calling inside the program. Then I did debugging on FM GET_JOB_NUMBER, inside this FM I found  one more FM &lt;STRONG&gt;NUMBER_GET_NEXT&lt;/STRONG&gt;. This FM taking more time for execution. How to handle this or advice me to use other logic. Please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 05:57:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565473#M1659456</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T05:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Generate  unique batch numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565474#M1659457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Find the Number range object used in FM NUMBER_GET_NEXT,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that go to tcode SNRO and maintain the the range.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 06:08:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565474#M1659457</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T06:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Generate  unique batch numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565475#M1659458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I checked for the particular object, the number ranges are maintained in SNRO.  I am gettin a problem with the FM 'NUMBER_GET_NEXT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this bit of code;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CALL 'ThNoGet' ID 'BNRIV' FIELD BNRIV&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID 'NO' FIELD G_NOIVBUFFER&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID 'QUAN' FIELD P_QUANTITY&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID 'PERCENT' FIELD TNRO-PERCENTAGE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID 'NONRSWAP' FIELD TNRO-NONRSWAP.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is returning &lt;STRONG&gt;sy-subrc as 12&lt;/STRONG&gt;, can someone tell me what this call statement does and why is the sy-subrc coming as 12 and not 0?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can be the possible reasons for this sy-subrc failure?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 07:22:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565475#M1659458</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T07:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Generate  unique batch numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565476#M1659459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: wa_nriv           TYPE nriv,
           w_number(8)   TYPE c.

 SELECT SINGLE * FROM nriv INTO wa_nriv WHERE object = &amp;lt;object name&amp;gt;.

*-Number Range in t-code SNRO
  CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'
    EXPORTING
      object           = &amp;lt;object name&amp;gt;
    EXCEPTIONS
      foreign_lock     = 1
      object_not_found = 2
      system_failure   = 3
      OTHERS           = 4.

  CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
      nr_range_nr             = wa_nriv-nrrangenr
      object                  = &amp;lt;object name&amp;gt;
      quantity                = '1'
    IMPORTING
      number                  = w_number
    EXCEPTIONS
      interval_not_found      = 1
      number_range_not_intern = 2
      object_not_found        = 3
      quantity_is_0           = 4
      quantity_is_not_1       = 5
      interval_overflow       = 6
      buffer_overflow         = 7
      OTHERS                  = 8.

CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'
    EXPORTING
      object           = &amp;lt;object name&amp;gt;
    EXCEPTIONS
      object_not_found = 1
      OTHERS           = 2.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ajoy Chakraborty on Feb 23, 2012 12:59 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 07:28:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565476#M1659459</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T07:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Generate  unique batch numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565477#M1659460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  I can able to generate numbers usinng FM 'NUMBER_GET_NEXT'. But FM  took more time to execute as am getting a problem with the FM 'NUMBER_GET_NEXT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this bit of code;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL 'ThNoGet' ID 'BNRIV' FIELD BNRIV&lt;/P&gt;&lt;P&gt;ID 'NO' FIELD G_NOIVBUFFER&lt;/P&gt;&lt;P&gt;ID 'QUAN' FIELD P_QUANTITY&lt;/P&gt;&lt;P&gt;ID 'PERCENT' FIELD TNRO-PERCENTAGE&lt;/P&gt;&lt;P&gt;ID 'NONRSWAP' FIELD TNRO-NONRSWAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is returning sy-subrc as 12..How to solve it...Is there any other way to generate unique numbers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2012 07:49:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565477#M1659460</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-23T07:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Generate  unique batch numbers</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565478#M1659461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it's not easy to tell, why you got any error in this place. So just some general thoughts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you run into a locking problem. If you use a buffered number range, sometimes the buffer has to be refilled from database. If several instances need to pull new numbers, 2nd and others have to wait until 1st releases the NRIV (waiting for commit work). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this takes some time (e.g. exits with lot of coding in update task), there might be a time-out error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So check, what's up and running in parallel in the system while you get this error (because in general you are able to get numbers).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe higher number of buffered numbers can help -&amp;gt; it's less likely to fetch new numbers from database. Number should be at least 2-3 times more than what is needed in one process step (mass execution of something might need a lot of numbers for one commit work).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 12:28:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/generate-unique-batch-numbers/m-p/8565478#M1659461</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2012-02-28T12:28:41Z</dc:date>
    </item>
  </channel>
</rss>

