2008 Jan 08 9:35 AM
Hello all,
I have an object zpalnum and have defined number range for the object.
Now when the user prints the number(barcode), the current number(in tcode SNRO) should get updated by the last printed number. For this i need to update table NRIV-NRLEVEL .
I used a function module NUMBER_RANGE_INTERVAL_UPDATE.
But the NRIV table is not getting updated.
How can i do it?
Hello all,
I have an object zpalnum and have defined number range for the object.
Now when the user prints the number(barcode), the current number(in tcode SNRO) should get updated by the last printed number. For this i need to update table NRIV-NRLEVEL .
I used a function module NUMBER_RANGE_INTERVAL_UPDATE.
But the NRIV table is not getting updated.
How can i do it?
2008 Jan 08 9:38 AM
Hi,
see the belwo sample code and try
Example ABAP program to update number range
&----
*& Report Z0RANGENO *
*& *
&----
*& *
*& *
&----
REPORT z0rangeno.
DATA: wnorange LIKE inri-nrrangenr, "number range,
wobject LIKE inri-object, "object
wsubobj LIKE inri-subobject, "sub object
wtoyear LIKE inri-toyear,
wdocno(12).
wnorange = '01'.
wobject = 'Z0TEST'.
wtoyear = '2006'.
CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'
EXPORTING
object = wobject
EXCEPTIONS
foreign_lock = 1
object_not_found = 2
system_failure = 3
OTHERS = 4.
IF sy-subrc NE 0.
message e086 with 'Lock error' sy-subrc.
ENDIF.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = wnorange
object = wobject
subobject = wsubobj
toyear = wtoyear
IMPORTING
number = wdocno "Number generated by SAP
EXCEPTIONS
interval_not_found = 1
number_range_not_intern = 2
object_not_found = 3
quantity_is_0 = 4
quantity_is_not_1 = 5
internal_overflow = 6
OTHERS = 7.
IF sy-subrc NE 0.
message e086 with 'Number Range' sy-subrc.
ENDIF.
CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'
EXPORTING
object = wobject.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Nagaraj
2008 Jan 08 9:53 AM
Thanks for the prompt reply.
Actually i dont need to generate the next number. I have the number to be updated in the current number field of tcode snro.
I have to update NRIV table(field NRLEVEL).
2008 Jan 08 10:00 AM
Hi,
Check the FM "NUMBER_RANGE_OBJECT_UPDATE".
Regards,
Nagaraj
2008 Jan 09 5:01 AM
To update the number range interval or "currently used" number in tcode SNRO I used the function module NUMBER_RANGE_INTERVAL_UPDATE.
The changes are not written directly
to the database but included in local memory first. By calling up the function module NUMBER_RANGE_UPDATE_CLOSE, the contents of the local memory is written to the database.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |