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

number generation

Former Member
0 Likes
327

hi

i have a logic prob in sap abap.

from serial 279360 to .....

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.

IF U FIND TIME PLSE TRY THIS.

WITH REGARDS

AARYAA.

1 REPLY 1
Read only

suresh_datti
Active Contributor
0 Likes
300

Hi Madhu,

Pl try the following code..


*&---------------------------------------------------------------------*
*& Report  ZGETNEXT                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  zgetnext                                .

data: w_text(4) value 'AAAA',
      offset type i.
write:/ w_text.
while w_text+3(1) ne 'Z'.
  search sy-abcde for w_text+3(1) and mark.
  offset = sy-fdpos + 1.
  w_text+3(1) = sy-abcde+offset(1).
  write:/ w_text.
endwhile.

while w_text+2(1) ne 'Z'.
  search sy-abcde for w_text+2(1) and mark.
  offset = sy-fdpos + 1.
  w_text+2(1) = sy-abcde+offset(1).
  write:/ w_text.
endwhile.

while w_text+1(1) ne 'Z'.
  search sy-abcde for w_text+1(1) and mark.
  offset = sy-fdpos + 1.
  w_text+1(1) = sy-abcde+offset(1).
  write:/ w_text.
endwhile.

while w_text+0(1) ne 'Z'.
  search sy-abcde for w_text+0(1) and mark.
  offset = sy-fdpos + 1.
  w_text+0(1) = sy-abcde+offset(1).
  write:/ w_text.
endwhile.

Regards,

Suresh Datti