Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Base 10 to Base 26 conversion

$
0
0

Recently I came across a requirement to convert base 10(decimal) value to base 26(more info can be found at http://en.wikipedia.org/wiki/Hexavigesimal)

 

Here is the small piece of code which does the job

 

 

data l_num type char20.

l_num = '90000052'.


data digit type char3.


data num typei.
data result type string.
while ( l_num > 0 ).
num = l_num mod26.
digit = num .
CONCATENATE digit result INTO result  .
CONDENSE result NO-GAPS.
l_num = ( l_num - num ) / 26.
endwhile.

 

Result will hold the base26 value

 

Thanks

Bala Duvvuri



Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>