‎2006 Sep 25 4:20 PM
Hi All,
Can anyone help me to increment an alphanumeric sequence.
For eq: 12B345A, should become 12B345B,12B345C...,12B345Z after Z it should take the second last character and inceremnt it, say 12B346A,12B346B,12B346C.........
Please let me know whether we can use some Function Modules for this operation or can anyone please help me with a pseudocode for the same.
Thanks in Advance,
Rijish
‎2006 Sep 25 4:24 PM
‎2006 Sep 25 4:24 PM
‎2006 Sep 25 4:36 PM
Thanks Rich! (For ur quick reply).
Not necessary .The alphabets can be at any position.The sequence is less or equal to 18 !
‎2006 Sep 25 5:49 PM
Try this Code:
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'.
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.Regards
Sridhar
‎2006 Sep 26 6:58 AM
Hi Sridhar,
Thanks for the code, itz working perfect.....
Once again thanks for your help...
regards
rijish
‎2006 Sep 26 7:32 AM
‎2006 Sep 25 4:55 PM
Hi,
use below pseudo code logic
lv_data = strlen( string ).
lv_data1 = sy-abcde.
case string+0(lv_data)
when 'A'.
string+0(lv_data) = 'B'.
.....
when 'Z'.
lv_data = lv_data - 1.
string0(lv_data)= string0(lv_data) + 1.
endcase.
Regards
Amole
‎2006 Sep 25 5:37 PM
Rijish
What should happen when it reaches ...
12B346Z....
12B349Z...should the next be 12B350A or 12B34AA ?
Also in the case 12B999Z it should be followed by 12C000A or something else ???
Message was edited by: Anurag Bankley