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

Alpha numeric serial No generator

Former Member
0 Likes
1,210

Hi Folks,

I want to know if there is any function module for generating Alpha Numeric serial Number for the specified range in SAP.

Thanks & Regards ,

Vikram

5 REPLIES 5
Read only

adrian_mejido
Contributor
0 Likes
931

This message was moderated.

Read only

Former Member
0 Likes
931

Hi adrian,

i need to generate for 5 digits..any other way of generating nos.

Read only

0 Likes
931

Hi vikram,

You can use that example code an modify it to your purpose.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
931

You can convert a numeric value, generated with NUMBER_GET_NEXT on a classic number range, to an alphanumeric range with a FM like TB_LIMIT_CONVERT_DEC_TO_36.

Regards,

Raymond

Read only

Former Member
0 Likes
931

Thanks all ....used the below code.

REPORT YALPHASERIAL.

data: v_str(7) type c,

       v_hx(1) type x,

       v_len type i,

       v_off type i.

field-symbols <fs>.

v_str = '12B345Z'.

*v_str = 'Z9Z99Z9'.

Do 10 TIMES.

write:/ 'Initial:', v_str.

v_len = strlen( v_str ).

v_off = v_len - 1.

do v_len times.

   if v_str+v_off(1) between 'A' and 'Z'.

     if v_str+v_off(1) lt 'Z'.

       assign v_str+v_off(1) to <fs> casting type x.

       add 1 to <fs>.

       exit.

     else.

       v_str+v_off(1) = 'A'.

     endif.

   elseif v_str+v_off(1) between '0' and '9'.

     if v_str+v_off(1) lt '9'.

       v_str+v_off(1) = v_str+v_off(1) + 1.

       exit.

     else.

       v_str+v_off(1) = '0'.

     endif.

   endif.

   v_off = v_off - 1.

enddo.

write:/ 'Final:', v_str.

ENDDO.