2008 Sep 27 7:08 AM
I have abcc345. i need to replace all the charachters by spaces.
incase i have asdfghj00001 again all charachters by spaces.
but number remains the same.
in all cases i just need to replace the charachters numbere remaining the same
2008 Sep 27 8:28 AM
HI,
See if one variable has value like abc456.
simply declare one variable with type N.
example ..
data:
w_var1(20) type c value 'ABC1101',
w_var2(20) type N.
w_var2 = w_var1.
write : / w_var2.
Then simply it writes .... 1101.
hope u got it..
this is the concept of type conversion...................
Regards
Sunil Kumar Mutyala.
HI,
See if one variable has value like abc456.
simply declare one variable with type N.
example ..
data:
w_var1(20) type c value 'ABC1101',
w_var2(20) type N.
w_var2 = w_var1.
write : / w_var2.
Then simply it writes .... 1101.
hope u got it..
this is the concept of type conversion...................
Regards
Sunil Kumar Mutyala.
2008 Sep 27 7:11 AM
2008 Sep 27 7:15 AM
hi,
str = abcc3345.
str1 = str+4(1).
str2 = str+4(4) = 3345. then take it in anather variable
same for below one with some modification
2008 Sep 27 8:03 AM
Hi,
Use this....
DATA : lv_field type char20 value 'asdfghj00001',
moff type i,
lv_strlen type i,
lv_length type i.
find first occurrence of regex '\d' in lv_field match offset moff.
lv_strlen = strlen( lv_field ).
lv_length = lv_strlen - moff.
write : / lv_field+moff(lv_length).
Hope it will helps
2008 Sep 27 8:28 AM
HI,
See if one variable has value like abc456.
simply declare one variable with type N.
example ..
data:
w_var1(20) type c value 'ABC1101',
w_var2(20) type N.
w_var2 = w_var1.
write : / w_var2.
Then simply it writes .... 1101.
hope u got it..
this is the concept of type conversion...................
Regards
Sunil Kumar Mutyala.
2008 Sep 27 8:32 AM
Hi,
Use Replace as follows;
DATA lv_text TYPE string VALUE 'ab000cdeSDFf34534gh1ASDF234ijk5abc0'.
WRITE : /,'Before Replace :',lv_text.
REPLACE ALL OCCURRENCES OF REGEX '[A-Za-z]' IN lv_text WITH ''.
WRITE : /,'After Replace :',lv_text.
Output:
Before Replace : ab000cdeSDFf34534gh1ASDF234ijk5abc0
After Replace : 00034534123450Remember that there is no space between the single quotes in the WITH clause of the REPLACE statement.
Regards
KArthik D
2008 Sep 27 8:35 AM
Hi,
You can also use;
REPLACE ALL OCCURRENCES OF REGEX '[[:alpha:]]' IN lv_text WITH ''.Regards
Karthik D
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |