2006 Nov 25 8:20 AM
hi
Is there is any trim function for the string ?
want to remove the starting and ending spaces of string
thanks
2006 Nov 25 9:19 AM
DATA: ld_field(50) type c.
P_field type ld_field.
p_field = ' Welcome '.
ld_field = p_field.
CONDENSE ld_field .
write ld_field .
It is displying the like 'Welcome '
Is it because that i have specify the ld_field(50) so it is thinking that it is 50 char length and
just appeding the spaces after 'Wlecome '
2006 Nov 25 8:24 AM
hi,
just use
<b>CONDENSE</b>
eg:
*Code to demonstrate CONDENSE command
DATA: ld_field(50) type c.
p_field = ' Welcome '.
CONDENSE p_field. "P_field must be of type character
*Result of p_field would be: 'Welcome'
rgds
Anver
<b><i>if hlped pls mark points</i></b>
<i>if your issue solved , kindly close the thread</i>
2006 Nov 25 9:01 AM
Hi,
did your issue solve.
if not kindly revert back.
Rgds
Anver
2006 Nov 25 9:04 AM
use CONDENSE
or
u can use SHIFT command also
shift v_var left deleting leading space.
shift v_var right deleting tailing pace.
2006 Nov 25 9:19 AM
DATA: ld_field(50) type c.
P_field type ld_field.
p_field = ' Welcome '.
ld_field = p_field.
CONDENSE ld_field .
write ld_field .
It is displying the like 'Welcome '
Is it because that i have specify the ld_field(50) so it is thinking that it is 50 char length and
just appeding the spaces after 'Wlecome '
2006 Nov 25 9:21 AM
hi,
use <b>NO-GAPS</b>
DATA: ld_field(50) type c.
P_field type ld_field.
p_field = ' Welcome '.
ld_field = p_field.
CONDENSE ld_field <b>NO-GAPS</b>.
write ld_field .
rgds
Anver
2006 Nov 25 9:26 AM
2006 Nov 25 9:28 AM
thanks for the quick reply
I have tried NO-GAPS It works.. but it is removeing all the spaces in the string and i want to remove only the
left side sapces and right side sapces .
e.g
DATA: ld_field(50) type c.
P_field type ld_field.
p_field = ' Welcome To SAP '.
ld_field = p_field.
CONDENSE ld_field NO-GAPS.
write ld_field .
The out put is
'WlecomeToSAP'
Regards
mahya
2006 Nov 25 9:32 AM
hi,
then use this.
<b>
SHIFT ld_field RIGHT DELETING TRAILING SPACE.
SHIFT ld_field LEFT DELETING LEADING SPACE.</b>
DATA: ld_field(50) type c.
P_field type ld_field.
p_field = ' Welcome To SAP '.
ld_field = p_field.
SHIFT ld_field RIGHT DELETING TRAILING SPACE.
SHIFT ld_field LEFT DELETING LEADING SPACE.
write ld_field .
rgds
Anver
2006 Nov 25 9:33 AM
there is no trim function as java in ABAP.
use the condense statement to remove the spaces.
2006 Nov 25 9:34 AM
<b>I have posted the solution exactly what you wanted already. Please check that.</b>
Regards
Kathirvel
2006 Nov 25 9:49 AM