2006 Oct 16 3:47 PM
hi to all,
help me in this issue,
i need a auto genrated S.no which needs to be updated in
a table how tro get S.no and update to table.for example
when we select particular set of invoices its serail nos
of invoices should be updated as 1 100000(invoice nos)
1 100001
1 100002 like this
thanks in advance.
kiran kumar.
Message was edited by: kiran kumar
2006 Oct 16 3:51 PM
Hi,
Create a number range object in the transaction SNRO and and use the function module NUMBER_GET_NEXT to get the serial no..
Thanks,
Naren
2006 Oct 16 3:51 PM
Hi,
Create a number range object in the transaction SNRO and and use the function module NUMBER_GET_NEXT to get the serial no..
Thanks,
Naren
2006 Oct 16 3:51 PM
hi,
chk this how to create number range.
General - Number Range Generation
use SNRO to create the number range object
call function 'NUMBER_RANGE_ENQUEUE'
exporting
object = 'ZOWNNO' "Create with SNUM
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 = '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.
<b>refer the links als0
http://www.sap-img.com/ge003.htm
http://www.sap-basis-abap.com/sapmm009.htm
http://www.erpgenie.com/abap/code/abap33.htm
http://www.kabai.com/abaps/z26.htm</b>;
rgds
anver
if hlped pls mark points
Message was edited by: Anversha s
2006 Oct 16 4:01 PM
Serial Number is like u maintain a sequence of number range defined in a Object using t-code SNRO
Now in order to have a number system generated u need to call this object in ur program ...
suppose say now ur range is 0000000001 -0000000005
that u have generated and stored in ur table ..
now next time when u want the number to be 0000000006 ,
the object should be referred to the table with the last count of max number which is ur 0000000005 and then the next number 0000000006 is generated by adding one to the count which the object takes care ..
the code will be like
-
LOOP AT IT_Tab.
IF IT_tb IS NOT INITIAL.
READ TABLE IT_tab1 WITH KEY f1 = IT_tb-f1.
IF SY-SUBRC <> 0.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'ZRECNO'
QUANTITY = '1'
SUBOBJECT = Ztab-num
TOYEAR = '0000'
IGNORE_BUFFER = ' '
IMPORTING
NUMBER = IT_tb-f1
QUANTITY =
RETURNCODE =
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
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
-
first create the obj in snro and define the range...
it_tab contains the sequence of (1-5) from the ztable,
it_tab1 contains new entries of ztable ..if there are entries say now 6 , now u have to understand that 1-5 sequence is already present now system has to generate number 6 this is done by the fm as shown when the entries are not matched ...
hope this helps ,
Regards,
Vijay
u will updating the Dbs with a Module pool programs ..
so in future u can change some of the details to the invoices for ex 1000002 in ur case , so in this case u cannot create a new number but changes to the existing one should take place , so
when declaring ur number remember that u need to maintain a primary key for this number in the table u r trying to add this ...
Message was edited by: Vijay
2006 Oct 16 5:08 PM
hi to all
thanks for responsees but i need
like the below to be updated in database
for many invoices one serial no
1 100001
1 100002
1 100003
it should update same as above in database.
when it is executed again the next series like
2 100004
2 100005
like that
thanks in advance
kiran kumar