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

batch number

Former Member
0 Likes
648

hi

i have a logic prob in sap abap.

convert the numbers to alpha sequences from serial number > 279360 like

279360 = AAAA.

279361 = AAAB

279362 = AAAC ....

the sequence of alpha code r like

AAAA -AAAZ, AABA- AABZ,... AZAA-AZZZ.

BAAA- BAAZ,BABA-BABZ,.....BZAA - BZZZ,

CAAA- CAAZ,CABA-CABZ,.....CZAA-CZZZ,.....

ZAAA-ZAAZ,ZABA-ZABZ,.......ZZAA-ZZZZ.

Plse help me

With Regards

AARYAA.

4 REPLIES 4
Read only

Former Member
0 Likes
574

Try this . It works.

PARAMETERS p_i TYPE i.
DATA d_i1 TYPE i.
DATA d_i2 TYPE i.
DATA d_i3 TYPE i.
DATA d_i4 TYPE i.

DATA code(4).

p_i = p_i - 279360.

   d_i4 = p_i MOD 26.
   p_i = p_i DIV 26.
   d_i3 = p_i MOD 26.
   p_i = p_i DIV 26.
   d_i2 = p_i MOD 26.
   p_i = p_i DIV 26.
   d_i1 = p_i MOD 26.

   code+0(1) = sy-abcde+d_i1(1).
   code+1(1) = sy-abcde+d_i2(1).
   code+2(1) = sy-abcde+d_i3(1).
   code+3(1) = sy-abcde+d_i4(1).

   WRITE code.

Ps: Reward points if helpful.

Read only

0 Likes
574

yes more helpful

Read only

0 Likes
574

Did the code work?

Reward points if helpful.

Read only

Former Member
0 Likes
574

Here is an idea..

convert the alpha sequence to ASCII sequence and increment the ASCII and convert back to Alpha. Am not sure how the code looks like...I'm trying it