2008 Sep 02 10:53 AM
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
2008 Sep 02 11:30 AM
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
2008 Sep 02 11:00 AM
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.
2008 Sep 02 11:06 AM
2008 Sep 02 11:22 AM
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
2008 Sep 02 11:30 AM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |