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_get_next

former_member211992
Active Participant
0 Likes
2,002

Dear all

I have used 'number_get_next' fm to generate sno. in snro i have defined number range with 10 digits ..but in the output im getting only first 7 digits after ecxecuting the program.how to resolve this

Thanks

1 ACCEPTED SOLUTION
Read only

former_member209120
Active Contributor
0 Likes
1,911

Hi Karthick

I tried like this i am getting

DATA:
NUMBER TYPE I.

CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
    nr_range_nr = '01'
    object = 'ZDEMO'
IMPORTING
   NUMBER = 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.

Write 😕 'Next available number is: ', Number.


Dear all

I have used 'number_get_next' fm to generate sno. in snro i have defined number range with 10 digits ..but in the output im getting only first 7 digits after ecxecuting the program.how to resolve this

Thanks

8 REPLIES 8
Read only

Former Member
0 Likes
1,911

Hi,

IMPORTING

    number = <snro>

snro must be defined as numeric 10 which you have already done. Can you please write the code?

Regards

Purnand

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,911

Which domain did you use for "Number Length Domain", check actual lengyth, also check you range definition and parameter definition in the FM call.

Regards,

Raymon

Read only

0 Likes
1,911

Hi karthik,

Check your variable length if you have given LENGTH 10.

Also when you assign the variable as NUM format if it has '0's in front of it it will vomit it and display.

for eg: if your sno is "0001234567" you will get only '1234567'

if you still want to display '0's use CHAR format.

DATA number(10) type c.

IMPORTING

         number                  = number

Thanks

Askar.

Read only

0 Likes
1,911

Have you got your solution??

Read only

0 Likes
1,911

Thanks for all ur replies,

I m am passing 10 digit number into FM not prefixed with '0' s , but at out im getting 7 digits,,i have debugged  that FM  , ther variable has been declared with 7 , will any issue happen if i  change length in  standard FM

Read only

former_member209120
Active Contributor
0 Likes
1,912

Hi Karthick

I tried like this i am getting

DATA:
NUMBER TYPE I.

CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
    nr_range_nr = '01'
    object = 'ZDEMO'
IMPORTING
   NUMBER = 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.

Write 😕 'Next available number is: ', Number.


Read only

0 Likes
1,911

hi karthik,

"the variable has been declared with 7"

thats the reason!!!


Step 1- Check that the object in snro has a type of num length of 10

Step 2- then check where you are calling the num_next function the value returning should also be 10 length.

Step 3- if none above then are you calling the right object make sure...

There shouldnt be other reason apart from these.

Read only

Former Member
0 Likes
1,911

Hi Karthik

Please try the below code

data : w_head type mseg-mblnr.


call function 'NUMBER_GET_NEXT'
    exporting
      nr_range_nr                  = 'CR'
      object                          = 'ZDEMO'
      quantity                       = '1'
    importing
      number                       = w_head-docno
    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
               .

Hope it helps..

Regards

Suganya