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

SNRO Number Range creation

0 Likes
4,512

Hi,

I need to generate number range automatically starting from AR00000000 to AR99999999. I tried using SNRO, but char values are not accepted..Please help..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,583

Hello Sooraj,

Try creating FM , which can give you the number .

internally you can append the chars (AR etc,,).. which you want to keep as part of number.

Thanks

~Raj

Hi,

I need to generate number range automatically starting from AR00000000 to AR99999999. I tried using SNRO, but char values are not accepted..Please help..

9 REPLIES 9
Read only

Former Member
0 Likes
3,584

Hello Sooraj,

Try creating FM , which can give you the number .

internally you can append the chars (AR etc,,).. which you want to keep as part of number.

Thanks

~Raj

Read only

Former Member
0 Likes
3,583

Hi

It's not possible with an alphanumeric range: it has to be numeric only.

So just as Raj says, you can create a numeric range and then you can insert AR

Max

Read only

0 Likes
3,583

Thanks Raju..I will try that...

Read only

Former Member
0 Likes
3,583

hi Sooraj,

try to use the below FM to get the number range

   DATA: w_range TYPE inri-nrrangenr VALUE '01',

         w_serial_no TYPE nriv-nrlevel.

   DATA: return TYPE inri-returncode.

     CALL FUNCTION 'NUMBER_GET_NEXT'

      EXPORTING

       nr_range_nr = w_range

         object      = 'SBUSPID'

      IMPORTING

        number      = w_serial_no

         returncode  = return.

     IF sy-subrc EQ 0.

** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

**         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

i hope this helps,

thank you,

kata.

Read only

Former Member
0 Likes
3,583

hi sooraj,

are you sorted if you have any issues get me back.

Read only

manish_shankar
Participant
0 Likes
3,581

Hi Sooraj,

Hope this will help you.

First create number range in SNRO as:

Then in SE38, write the following code:

REPORT  ZNRO .

DATA : inv_id TYPE i ,
        inv1(6) TYPE c VALUE 'AR' ,
        inv2(10) TYPE c ,
        invid(20) TYPE c .

CALL FUNCTION 'NUMBER_GET_NEXT'
   EXPORTING
     nr_range_nr                   '1'
     object                        = 'ZNRO'
*   QUANTITY                      = '1'
*   SUBOBJECT                     = ' '
*   TOYEAR                        = '0000'
*   IGNORE_BUFFER                 = ' '
  IMPORTING
    NUMBER                        = INV_ID
*   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.
* Implement suitable error handling here
ENDIF.

inv2 = inv_id.
     CONCATENATE inv1 inv2 INTO invid.
     CONDENSE invid NO-GAPS.
     WRITE : invid .

Execute it.

- Regards,

Manish Shankar.

Read only

Former Member
0 Likes
3,581

Hi

you cant create a number range with char in snro,  creation of alphanumeric number range is not allowed. try creating with numeric values.

Read only

Former Member
0 Likes
3,581

Hello So0,

You can do it like this

No     From number     To number          ext

2       AR00000000       AR99999999        X

Read only

former_member182465
Active Participant
0 Likes
3,581

Manish solution should work for you. If not you need to use external as Junhwan suggested.