01-31-2014 11:11 AM
can anyone tell me the code to remove special characters but not spaces from fields in a report program
01-31-2014 3:09 PM
Hi Rakesh,
Data : lv_field type string value 'ABC123a$'.
Replace REGEX '[A-Za-z0-9]' in lv_field with ''.
lv_field contains $'.
The above statement replaces letters A,B...Z or a,b,..z or numbers 0,1,..9 with Space.
To remove speacial characters include backslash character before special character, like to remove / symbol precede it with \/.
Regards,
Ravikiran.K
02-03-2014 5:01 AM
Hi ravi,
thanks for ur reply.but my question is like a field value is-Ravi@48,7Kiran.i want to remove special characters so the desire output should be-Ravi 48 7Kiran.
02-03-2014 5:31 AM
Hi Rakesh,
Data : lv_field type string value 'Ravi@48,7Kiran'.
OVERLAY lv_field WITH 'Ravi 48 7kiran' ONLY '@,'.
WRITE lv_field.
Regards,
Ravikiran.K
02-03-2014 5:41 AM
Hi Ravi,
thanks ravi for the reply.but here you are working on a single value.i am working on 100 diff values so its not possible to use overlay here.
Regards,
Rakesh
02-03-2014 5:50 AM
02-03-2014 5:52 AM
Hi ravi,
one more question suppose the value is Ravi#@* Kiran.
the output should be Ravi Kiran.means i dont want to replace special characters with spaces.
Regards,
Rakesh
02-03-2014 6:01 AM
HI.
Data : lv_field type string value ' Ravi#@* Kiran'.
REPLACE REGEX '[#]' IN lv_field WITH ''.
REPLACE REGEX '[@]' IN lv_field WITH ''.
REPLACE REGEX '[*]' IN lv_field WITH ''.
WRITE lv_field.
02-03-2014 6:31 AM
Hi Ravi,
the above code is helpful but this will replace the special characters with space.the space present in the field should be there but special characters should not be replaced with spaces.
Regards,
rakesh
02-03-2014 6:34 AM
Hi Rakesh,
Please be specific what exactly you want..
Above post is according to your desired output.
02-03-2014 6:42 AM
Hi Ravi,
actually m new in sap-abap.so its difficult to understand a few things.eg Ravi@#$ kiran.
output-Ravi Kiran.here @#$ should not be replaced by space.but there are two spaces, those two spaces should be kept as it is.
Regards,
Rakesh
02-03-2014 6:45 AM
Hi Rakesh,
In your output what happened to @#$. where did they go?
02-03-2014 6:49 AM
02-03-2014 6:51 AM
rakesh mandal Feb 3, 2014 7:42 AM (in response to Ravi Kiran K)
Hi Ravi,
actually m new in sap-abap.so its difficult to understand a few things.eg Ravi@#$ kiran.
output-Ravi Kiran.here @#$ should not be replaced by space.but there are two spaces, those two spaces should be kept as it is.
Regards,
Rakesh
you say should not replaced by space.Again you say replaced by space. please dont waste time.
02-03-2014 6:57 AM
Hi Ravi,
sorry ravi,actually here these fields are getting replaced by space in the code u mentioned but i dont want that to happen.
02-03-2014 8:32 AM
02-03-2014 8:36 AM
Hi Rakesh,
Mark the answers as correct and helpful, so that it will be helpful for others who look into the post.
Regards,
Ravikiran.K
02-03-2014 10:51 AM
Hi Rakesh,
Please mark answer as Helpful or correct .
Regards,
Ravikiran.K
02-03-2014 11:17 AM
Ravi, this is a discussion 'Correct Answer' option can't be there..
02-03-2014 11:20 AM
Hi Chandra,
Asking for marking Helpful answer. Some times you will have correct answer.
Regards,
Ravikiran.K
02-03-2014 11:22 AM
If the Question is 'Marked as a Question' then only correct answer option will come otherwise no. And this question is not marked as 'Question'.
02-03-2014 11:25 AM