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

Read only Number

Former Member
0 Likes
915

hi everybody

i have a problem. a field with letters and numbers, now i would read only

number from this field. how i can do that, with CA.....?

Or it has for function for this?

example ROH000001 only 000001

regards anujit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
765

hii

use following code

data: wa_str(100) type c.
data: wa_str1 type string.
data: wa_str2 type string.
data: wa_str3 type string.


data: len type i.
data: ofset type i.

wa_str = 'ABCD4356K'.
len = strlen( wa_str ).

translate wa_str to upper case.

do.
  if ofset = len.
    exit.
  endif.

 if wa_str+ofset(1) co sy-abcde  .
      concatenate wa_str2 wa_str+ofset(1) into wa_str2.
else.
    concatenate wa_str3 wa_str+ofset(1) into wa_str3.
  endif.

  ofset = ofset + 1.

enddo.

write:/ wa_str.
write:/ 'alphabatic char', 20 wa_str2.
write:/ 'numbers', 20 wa_str3.

regards

twinkal

hi everybody

i have a problem. a field with letters and numbers, now i would read only

number from this field. how i can do that, with CA.....?

Or it has for function for this?

example ROH000001 only 000001

regards anujit

4 REPLIES 4
Read only

Former Member
0 Likes
765

Hi Marty,

Try this :

Data :
  w_char(9) type c value 'ROH000001',
  w_num(6) type n.

w_num = w_char.

write :/ w_num.

Now w_num contains only numbers. This will solve the issue.

Regards,

Swapna.

Read only

Former Member
0 Likes
765

Hi,

Check Ferry Lianto answer in this link, you will get the solution.

Regards

Adil

Read only

Former Member
0 Likes
765

Hi,

data: f1(10) type c value 'ROH10002'.

DATA: OUTPUT(10) TYPE C,

F2(10) TYPE C,

F3 TYPE C.

*LOOP INTO F2..

DATA: LEN TYPE N,

I TYPE N.

LEN = strlen( F1 ).

DO LEN TIMES.

F3 = F1+I(1).

IF F3 CA '0123456789'.

CONCATENATE F2 F3 INTO F2.

LEN = LEN - 1.

ENDIF.

I = I + 1.

ENDDO.

I think it will be useful for you

thanks & regards

Deepika

Read only

Former Member
0 Likes
766

hii

use following code

data: wa_str(100) type c.
data: wa_str1 type string.
data: wa_str2 type string.
data: wa_str3 type string.


data: len type i.
data: ofset type i.

wa_str = 'ABCD4356K'.
len = strlen( wa_str ).

translate wa_str to upper case.

do.
  if ofset = len.
    exit.
  endif.

 if wa_str+ofset(1) co sy-abcde  .
      concatenate wa_str2 wa_str+ofset(1) into wa_str2.
else.
    concatenate wa_str3 wa_str+ofset(1) into wa_str3.
  endif.

  ofset = ofset + 1.

enddo.

write:/ wa_str.
write:/ 'alphabatic char', 20 wa_str2.
write:/ 'numbers', 20 wa_str3.

regards

twinkal