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

se16

Former Member
0 Likes
424

All,

Have an issue where special characters you can't see via se16 are at the end of a character field. I need a way to strip them off via abap. Is there a good way to do this? New to abap, so be gentle. Have tried about everything including shift. Is there a trim command that can be used?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
382

hi,

The VB "trim" sentence is CONDENSE in ABAP. But CONDENSE drops all spaces before and after the string. I think you are looking for something like mid$, Left$ or Right$ (in VB again).

You can use substrings to do that, like

Code:

DATA: chars TYPE I.

chars = strlen( yourstring ) - 1.

IF yourstring+chars = yourspecialchar.

yourstring = yourstring(chars).

ENDIF.That mini-code sample takes the lenght of your string (minus the last character), and checks that last character. If that last one is the special one you are trying to drop, the sentence between IF-ENDIF drops it.

Substrings are used like

Code:

string+pos1(pos2)where pos1 is the amount of characters displaced from the beguinning and pos2 the number of characters taken.

IE: string+pos1(pos2) would be the same than VB's Mid$(string, pos1, pos2)

Wish it helps,

siva

1 REPLY 1
Read only

Former Member
0 Likes
383

hi,

The VB "trim" sentence is CONDENSE in ABAP. But CONDENSE drops all spaces before and after the string. I think you are looking for something like mid$, Left$ or Right$ (in VB again).

You can use substrings to do that, like

Code:

DATA: chars TYPE I.

chars = strlen( yourstring ) - 1.

IF yourstring+chars = yourspecialchar.

yourstring = yourstring(chars).

ENDIF.That mini-code sample takes the lenght of your string (minus the last character), and checks that last character. If that last one is the special one you are trying to drop, the sentence between IF-ENDIF drops it.

Substrings are used like

Code:

string+pos1(pos2)where pos1 is the amount of characters displaced from the beguinning and pos2 the number of characters taken.

IE: string+pos1(pos2) would be the same than VB's Mid$(string, pos1, pos2)

Wish it helps,

siva