Hi,
1.I have one customer exit , ZXV56U12(include),which is in Enhance ment V56UNUMB.
2.Here I can give number range or directly number , which comes for shipment.
3.I am giving the number , by executing functionmodule : check the beloe code which is written in Exit.
->for e_numki , i am giving one number range from which it givces u the next number to be allocated.
->this the below function module will give u the number w_number.
-> i have to check the whether with this number , there is invoice exists,If it exists then again i have to go for the next number
,That's y i kept in the loop.Please look at the code u will understand.
->it is working fine.;But it is missing so many numbers in the specified range .
->it has to miss only if there is invoice exists with that number.But even though invoice does not exists,it is missing some numbers some times.
->what might be the reason for this?
CODE :
DO.
CLEAR : w_number,w_vbeln.
*get the number that will be come for shipment
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = e_numki
object = c_rv_transpo
QUANTITY = '1'
SUBOBJECT = ' '
TOYEAR = '0000'
IGNORE_BUFFER = ' '
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
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*check whether there is already invoice number that is same as coming shipment number
*if there is no such invoice number ,then we can use this number as shipment number
*so pass this number to e_tknum (export parameter)
IF w_number IS NOT INITIAL.
SELECT SINGLE vbeln
FROM vbrk
INTO w_vbeln
WHERE vbeln = w_number.
IF sy-subrc NE 0. "if there is no invoice number with coming shipment number
e_tknum = w_number. "Propose this number as shipment number
EXIT.
ENDIF.
ENDIF. "w_number is not initial
ENDDO.