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

Hi Gurus

Former Member
0 Likes
913

I would like to know , is there any FUNCTION MODULE to remove special characters in the text. or ANY code.

Ex : GV_TEXT = 'FINA#N#CIAL S#TATUS'.

but i want to display "FINANCIAL STATUS'..

please help me in this, it would be great help full and gr8 rewrdable.

Krisna

I would like to know , is there any FUNCTION MODULE to remove special characters in the text. or ANY code.

Ex : GV_TEXT = 'FINA#N#CIAL S#TATUS'.

but i want to display "FINANCIAL STATUS'..

please help me in this, it would be great help full and gr8 rewrdable.

Krisna

6 REPLIES 6
Read only

Former Member
0 Likes
887

Hi,

Please try this.


TRANSLATE GV_TEXT USING '# '.
CONDENSE GV_TEXT NO-GAPS.

Regards.

Ferry Lianto

Read only

Former Member
0 Likes
887

HI,

TRANSLATE GV_TEXT USING ' _'.

TRANSLATE GV_TEXT USING '# '.

CONDENSE GV_TEXT NO-GAPS.

TRANSLATE GV_TEXT USING '_ '.

Ferry: it seems it becomes FINANCIALSTATUS.

Regards

SAB

Read only

Former Member
0 Likes
887

Another method:

replace all occurences of '#' in gv_text with ''.

Regards,

ravi

Read only

Former Member
0 Likes
887

There is no function module to do that. This may be the tab special character that you are seeing as a #. So use a combination of REPLACE and CONDENSE.

[code]

REPLACE ALL OCCURRENCES OF space IN gv_text WITH '$'.

REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>HORIZONTAL_TAB IN gv_text WITH space.

CONDENSE gv_text NO-GAPS.

REPLACE ALL OCCURRENCES OF '$' IN gv_text WITH space.[/code]

Read only

Former Member
0 Likes
887

Hi krisna,

U can do this as follows

Sample Code 1:

DATA:

w_char(30) TYPE c, Provide the string here

w_key(30) TYPE c,

w_len TYPE i,

w_ind TYPE i.

w_key = '~!@#$%^&*()_+|}{":?><,/;[]\=-'.

w_len = STRLEN( w_key ).

DO w_len TIMES.

w_ind = sy-index - 1.

REPLACE ALL OCCURRENCES OF w_key+w_ind(1) IN w_char WITH ''.

ENDDO.

WRITE:/ w_char.

Sample code2:

DATA:

w_char(20) TYPE c, Provide the string here

w_char1(20) TYPE c,

w_len TYPE i,

w_ind type i.

w_char = 'A@Cd*K!()A'.

w_len = STRLEN( w_char ).

DO w_len TIMES.

w_ind = sy-index - 1.

IF w_char+w_ind(1) CO sy-abcde.

concatenate w_char1 w_char+w_ind(1) into w_char1.

ENDIF.

ENDDO.

WRITE:/ w_char1.

Restriction for the sample code 2 is that the numeric values is not possible.

Read only

Former Member
0 Likes
887

hi krisna,

REPLACE ALL OCCURRENCES OF ' # ' IN gv_text WITH no-space.

if helpful reward some points.

with regards,