Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to determine range of letters/characters

Hello,

In abap, if you know the first letter of a range, and the last letter of a range, how do you determine the letters in between? (or better yet, character values instead of letters of the alphabet).

For example, the first letter is A, the last letter is D. How do you determine that the range of letters is A B C D?

Thanks,

Dennis

Tags:
Former Member
replied

Hi,

You can use this code..

report  zrange                                  .
data:w_pos type i,
     w_pos1 type i,
     w_pos2 type i.
data: begin of t_char occurs 0,
       field,
      end of t_char.
parameters: p_1,p_2.
search sy-abcde for p_1 and mark.
w_pos1 = sy-fdpos.
search sy-abcde for p_2 and mark.
w_pos2 = sy-fdpos.
w_pos = w_pos1.
while w_pos le w_pos2.
  t_char-field = sy-abcde+w_pos(1).
  append t_char.
  w_pos = w_pos + 1.
endwhile.
loop at t_char.
  write:/ t_char-field.
endloop.

Regards,

Suresh Datti

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question