You are on page 1of 2

General - Number Range Generation * In the 4.

6x environment, SAP have included


number range generation
program just like those used for Purchase Order, Sales Order etc.

a
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

This SAP number range generation is an include program.


INCLUDE ZRANGENO.
Always have to be included in the main program data declaration
data: wnorange like INRI-NRRANGENR,
wsubobj like inri-SUBOBJECT,
wdocno(12).

"number range,
"sub object

Steps :1. Number range Sub Object must be maintain in table ZSGRP
You can used transaction SE16 to create a table entries.
2. Maintain number range and intervals in transaction code SNUM
Written by : SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

call function 'NUMBER_RANGE_ENQUEUE'


exporting
object
= 'ZOWNNO'
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.

"Create with SNUM

call function 'NUMBER_GET_NEXT'


exporting
nr_range_nr
= wnorange
object
= 'ZOWNNO'
subobject
= wsubobj
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

= 'ZOWNNO'.

if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

Get help for your ABAP problems


ABAP Forum - Do you have a ABAP Question?
ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Referen
ce Books
ABAP Functions Tips
ABAP Functions Examples

ABAP Tips
ABAP Forum for Discussion and Samples Program Codes for Abapers
Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com
All the site contents are Copyright www.erpgreat.com and the content authors. Al
l rights reserved.
All product names are trademarks of their respective companies. The site www.er
pgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity. Information used on this
site is at your own risk.
The content on this site may not be reproduced or redistributed without the exp

You might also like