‎2012 Feb 23 5:57 AM
Hi Experts,
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 NUMBER_GET_NEXT. This FM taking more time for execution. How to handle this or advice me to use other logic. Please help me.
Thanks
‎2012 Feb 23 7:28 AM
Hope this helps!
DATA: wa_nriv TYPE nriv,
w_number(8) TYPE c.
SELECT SINGLE * FROM nriv INTO wa_nriv WHERE object = <object name>.
*-Number Range in t-code SNRO
CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'
EXPORTING
object = <object name>
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 = <object name>
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 = <object name>
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
Edited by: Ajoy Chakraborty on Feb 23, 2012 12:59 PM
‎2012 Feb 23 6:08 AM
Find the Number range object used in FM NUMBER_GET_NEXT,
After that go to tcode SNRO and maintain the the range.
‎2012 Feb 23 7:22 AM
Hi ,
I checked for the particular object, the number ranges are maintained in SNRO. I am gettin a problem with the FM 'NUMBER_GET_NEXT'.
In this bit of code;
CALL 'ThNoGet' ID 'BNRIV' FIELD BNRIV
ID 'NO' FIELD G_NOIVBUFFER
ID 'QUAN' FIELD P_QUANTITY
ID 'PERCENT' FIELD TNRO-PERCENTAGE
ID 'NONRSWAP' FIELD TNRO-NONRSWAP.
It is returning sy-subrc as 12, can someone tell me what this call statement does and why is the sy-subrc coming as 12 and not 0?
What can be the possible reasons for this sy-subrc failure?
Thanks
‎2012 Feb 23 7:28 AM
Hope this helps!
DATA: wa_nriv TYPE nriv,
w_number(8) TYPE c.
SELECT SINGLE * FROM nriv INTO wa_nriv WHERE object = <object name>.
*-Number Range in t-code SNRO
CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'
EXPORTING
object = <object name>
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 = <object name>
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 = <object name>
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
Edited by: Ajoy Chakraborty on Feb 23, 2012 12:59 PM
‎2012 Feb 23 7:49 AM
Hi,
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'.
In this bit of code;
CALL 'ThNoGet' ID 'BNRIV' FIELD BNRIV
ID 'NO' FIELD G_NOIVBUFFER
ID 'QUAN' FIELD P_QUANTITY
ID 'PERCENT' FIELD TNRO-PERCENTAGE
ID 'NONRSWAP' FIELD TNRO-NONRSWAP.
It is returning sy-subrc as 12..How to solve it...Is there any other way to generate unique numbers.
‎2012 Feb 28 12:28 PM
Hi,
it's not easy to tell, why you got any error in this place. So just some general thoughts.
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).
If this takes some time (e.g. exits with lot of coding in update task), there might be a time-out error.
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).
Maybe higher number of buffered numbers can help -> 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).
BR,
Christian