Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HI regarding shipment exit number range

Former Member
0 Kudos

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.

3 REPLIES 3

Former Member
0 Kudos

As soon as you execute the function module "NUMBER_GET_NEXT", field NRLEVEL (Last number) in table NRIV will get updated with the next number (irrespective of whether you have used the number or not). Since you are calling this FM in the loop, for each call number is incremented in NRIV Table.

So instead of calling function module in the LOOP, extract the data from NRIV, and call the function module only when you want to use the Number.

Regards

Vinod

0 Kudos

I think NRIV will be updated only if we put the IGNORE_BUFFER parameter of the function module as X.

But here we are not using putting that as X.

So it is using some Buffer values irrespective of the last number that is used.

Am i correct?

Regards

Ramakrishna L

0 Kudos

Hi,

I dont think it will make any difference, I executed the function module with IGNORE_BUFFER = 'X' and IGNORE_BUFFER = ' '. In both cases, NRIV-NRLEVEL got updated with the next number.

See the documentation of the parameters "IGNORE_BUFFER"

The parameter IGNORE_BUFFER causes numbers to be taken directly from the
database.  Number range object buffering is ignored. The application
programs must prevent that numbers for a number range object are
procured both from the buffer and from the database during a LUW because
this may cause a deadlock situation

.

Regards

Vinod