Application Development and Automation 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: 
Read only

number range problem

Former Member
0 Likes
1,841

Dear all,

Have program that need to used number range. Currently I have a number range ZX.

new program I use the same number range(ZX) but I create new interval with defferent "TO year".

The problem is the new range is not work, the system still getting the old interval. Any I dea to solved it?

Hengky

6 REPLIES 6
Read only

Former Member
0 Likes
1,140

hi,

can you post your code, so that we can have a look and come out with a solution.

thanks,

anupama.

Read only

0 Likes
1,140

Actually noting wrong with the coding. In my coding I just used the function module NUMBER_GET_NEXT, the input parameter is ok. but the result still getting the old number range, not the new one.

I've tried to run single test FM NUMBER_GET_NEXT via tcode SE37. the result still wrong.

The I did debuging the FM.

I found in line

CALL 'ThNoRead' ID 'BNRIV' FIELD BNRIV.

the value BNRIV-TOYEAR is change into the wrong number.

before the codding above the value BNRIV-TOYEAR is 3301.

after the coding above execute the value change into 3600.

So this is the cause of problem. Any idea to how fix it?

Read only

Former Member
0 Likes
1,140

Hi Hengky Irawan,

data: wnorange like INRI-NRRANGENR, " number range, Which should be ZX / TO before You 
                                                           " Pass to "FM NUMBER_GET_NEXT"
                  wdocno(12).

" Before You pass wnorange = 'TO' , this could solve your problem
      
call function 'NUMBER_GET_NEXT'
  exporting
    nr_range_nr = wnorange
    object = 'ZOWNNO'
  importing
    number = wdocno "Number generated by SAP
  exceptions

Regards,

Suneel G

Read only

0 Likes
1,140

Dear Suneel and all,

I have used the same FM like your.

The problem happen inside the function module NUMBER_GET_NEXT.

my input parameter are

NR_RANGE_NR = '01'

OBJECT = 'ZX'

TOYEAR = '3301'

but inside FM at PERFORM READ_NRIV. there is codding

BNRIV-TOYEAR = P_TOYEAR. " the value still 3301

  • Intervall im Puffer lesen

CALL 'ThNoRead' ID 'BNRIV' FIELD BNRIV.

CASE SY-SUBRC. " The value change into 3600

after this logic the value of TOYEAR is changed

Read only

0 Likes
1,140

This my coding

if ztffakt002-idmirror is not initial and ztffakt002-idmirror ne '000'

and ztffakt002-idmirror ne ' '.

ccode = ztffakt002-idmirror.

else.

ccode = p_bukrs.

endif.

*---- At this point the value CCODE is 3301

CALL FUNCTION 'NUMBER_GET_NEXT'

EXPORTING

nr_range_nr = '01'

object = 'ZX'

toyear = ccode

IMPORTING

number = nofaktur

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.

retcode = 99.

ROLLBACK WORK.

ENDIF.

*---- at this point the result os number range is taken from TOYEAR 3600 not 3301

vnofaktur = nofaktur.

found = ''.

ENDIF.

Read only

0 Likes
1,140

Hi Hengky Irawan,

I have created two intervals :

1 3301 50000000 50009999 50000003

1 3600 60000000 60009999 0

DATA :  CCODE  TYPE INRI-TOYEAR. " I doubt how did you declare your CCODE, Check once

CCODE = '3301'.

call function 'NUMBER_GET_NEXT'
  exporting
    nr_range_nr = wnorange
    object      = 'ZOWNNO'
    subobject   = ' '
    TOYEAR      = CCODE
  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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* message e086 with 'Number Range' sy-subrc.
endif.

All the time I am getting 3301 Intervals only.

Regards,

Suneel G