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

# sign logic

Former Member
0 Likes
678

Would anyone happen to have the logic to identify the position of the string that has a # sign?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
656

a = '27#'.

search a for '#'.

write : sy-fdpos.

Would anyone happen to have the logic to identify the position of the string that has a # sign?

4 REPLIES 4
Read only

Former Member
0 Likes
657

a = '27#'.

search a for '#'.

write : sy-fdpos.

Read only

Former Member
0 Likes
656

hi,

The below code helps you to identify the number of times the character is present

data:  var1(30)  type c value 'ghghj#ghjgjgh#ghjghjg#ghjg#'.
 
data : totcnt type i,
       cnt type i, 
       v type c,
       n type i.
 
cnt = strlen( var1 ).
 
 
do cnt times.
move var1+n(1) to v.
if v eq '#'.
totcnt = totcnt + 1.
endif.
n = n + 1.
if n = cnt .
exit.
endif.
enddo.
 
write:/ 'No of #s', totcnt .

Read only

amit_khare
Active Contributor
0 Likes
656

Check the link -

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
656

Hi,

Please try this.


search wa_string for '#'.
write: / 'Position # is', sy-fdpos.

Regards,

Ferry Lianto