How to coding to achieve 'Alphanumreic increasement' uFF1FuFF1F
Currently i need to develop an program which function like 'number range'...It requires an start value and end value like below shows:
Start value '0001' to End value 'ZZZZ'
In other words, we want all combinations of four character alphanumerics, from 0000 to ZZZZ. Everytime this program excuted, an initial number will be passed in, then after program excuted, program will pass the latest next number out...
I have tested to write below piece of code...But it only generate the sequence like '0001-9999';'A001-A999'...Z001-Z999'....While this is not what i wanted...
FORM test_next_number CHANGING P_nextnumber. data: l_exidv type vekp-exidv, l_num(10) type c value '0123456789', l_seq(26) type c VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', l_letter(1) type c, l_number(3) type n, l_counter(4) type n, g_counter(4) type n, l_pointer type i. g_counter = '0001'. "initial number passed in if g_counter co l_num. l_counter = g_counter. if l_counter < 9999. add 1 to l_counter. g_counter = l_counter. else. g_counter = 'A000'. endif. else. "last 4 digits are alphanumeric l_number = g_counter+1(3). if l_number < 999. add 1 to l_number. g_counter+1(3) = l_number. else. l_number = 0. l_letter = g_counter(1). search l_seq for l_letter. if sy-subrc = 0. l_pointer = sy-fdpos + 1. else. clear l_pointer. endif. if l_pointer < 26. l_letter = l_seq+l_pointer(1). else. l_letter = '0'. endif. g_counter(1) = l_letter. g_counter+1(3) = l_number. endif. endif. concatenate 'Next numer is:' g_counter into p_nextnumber. write: p_nextnumber. ENDFORM. " test
What i wanted is the sequence for all combinations of four character alphanumerics...from 0001 to ZZZZ
How to code to achieve this...
Thank you very much.