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

delete char from string

Former Member
0 Likes
739

hi,

i have field like that 12-3456

and i wont to delete '-' to have 123456

what is the best way to do that?

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
709

REPLACE

ALL OCCURRENCES OF

' -'

IN w_var

WITH space.

condense w_var no-gaps.

it will replace all occurance of '_'

regards

Sheeba

7 REPLIES 7
Read only

Former Member
0 Likes
709

Hi,


TRANSLATE field USING '- '.
CONDENSE field NO-GAPS.

The TRANSLATE command replaces al '-' with blanks and the CONDENSE, NO-GAPS compresses the string to remove all spaces/blanks.

Cheers,

Aditya

Read only

Former Member
0 Likes
709

Hi

I dont think we can delete same but split at '-' into var1 var2 and concatanate the var1 and var2 again

regards

Shiva

Read only

Former Member
0 Likes
709

v_val = '12-345'.

search v_val for '-'.

if sy-subrc eq 0.

clear v_val+sy-fdpos(1).

condense v_val.

endif.

Read only

Former Member
0 Likes
709

Hi,

First replace unwanted character with space and condense the string.

Regards,

Aparna.

Read only

Former Member
0 Likes
709

Hi,

Use this logic

split w_char at '-' into char1

char2.

concatenate char1 char2 into w_char.

Read only

Former Member
0 Likes
709

Hi,

Use this logic

split w_char at '-' into char1

char2.

concatenate char1 char2 into w_char.

Read only

Former Member
0 Likes
710

REPLACE

ALL OCCURRENCES OF

' -'

IN w_var

WITH space.

condense w_var no-gaps.

it will replace all occurance of '_'

regards

Sheeba