Application Development 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: 

need one abap program.....pls help

Former Member
0 Kudos
78

Hi all,

i have need one ABAP program , which can dispaly how many same number of charecter are there.

ex : my input is suresh.

output is,,,

2 - s

1 - u

1 - r

just like that..

pls help me..

thanks in advance.

indu

1 ACCEPTED SOLUTION

Former Member
0 Kudos
56

Hello

Try this:


data: string(100),
      length type i.
data: begin of itab occurs 0,
      chart,
      count type i,
      end of itab.
string = 'suresh'.
length = strlen( string ).
do length times.
  length = length - 1.
  clear itab.
  itab-chart = string+length(1).
  itab-count = 1.
  collect itab.
enddo.
loop at itab.
  write: itab-chart, itab-count. new-line.
endloop.

2 REPLIES 2

Former Member
0 Kudos
56

HI,

Data : Begin of Itab occurs 0,

txt type char2,

tot type i,

end of itab.

data: value type string value 'TEST PROGRAM'.

data :len type i.

translate value to uppercase.

len = strlen( value ).

do len times.

itab-txt = value+len(1).

tot = '1'.

collect itab.

clear itab.

enddo.

Former Member
0 Kudos
57

Hello

Try this:


data: string(100),
      length type i.
data: begin of itab occurs 0,
      chart,
      count type i,
      end of itab.
string = 'suresh'.
length = strlen( string ).
do length times.
  length = length - 1.
  clear itab.
  itab-chart = string+length(1).
  itab-count = 1.
  collect itab.
enddo.
loop at itab.
  write: itab-chart, itab-count. new-line.
endloop.