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

condense a string

Former Member
0 Likes
3,305

experts,

ex : data var1 type string.

var1 =

' string content '.

while output how to supress leading and trailing spaces so that

i can get output as

'string content'.

thanks in advance.

12 REPLIES 12
Read only

bpawanchand
Active Contributor
0 Likes
1,336

Hi

USe CONDENSE var1

data :
   w_string type string value '    jksafhsdjkf     '.


 write :
   w_string.

condense w_string.

 write /:
   w_string.

Regards

Pavan

Read only

Former Member
0 Likes
1,336

Hi,

Use CONDENSE var1

for further detail in syntax , check

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb33e6358411d1829f0000e829fbfe/content.htm

Regards,

anirban

Read only

Former Member
0 Likes
1,336

CONDENSE var1

Read only

Former Member
0 Likes
1,336

hi,

CONDENSE

Reagrds

Sumit Agarwal

Read only

Former Member
0 Likes
1,336

Hi,

CONDENSE var1.

Read only

0 Likes
1,336

if i use condense even the gaps between the words get deleted , which should not happen.

Read only

0 Likes
1,336

Hi

CONDENSE vari NO-GAPS.

Regards

Pavan

Read only

0 Likes
1,336

data str type string.

str = ' abc def '.

shift str left deleting leading space.

shift str right deleting trailing space.

write 😕 str.

Read only

0 Likes
1,336

Hi Ramesh,

Use

SHIFT STRING LEFT DELETING LEADING SPACE.

SHIFT STRING RIGHT DELETING TRAILING SPACE.

Regrds,

Chandra Sekhar

Read only

Former Member
0 Likes
1,336

Hi,

data var1 type string.

var1 =

' string content '.

condense var1.

write:/ var1.

hope this helps.

Read only

Former Member
0 Likes
1,336

Hi Ramesh,

As also told by others use CONDENSE statement.

data var1 type string.

var1 = ' string content '.

CONDENSE var1.

write: var1.

With luck,

Pritam.

Read only

Former Member
0 Likes
1,336

Hi Ramesh,

try the following code.


shift var1 LEFT DELETING LEADING space.
shift var1 RIGHT DELETING TRAILING space.

Cheers,

Vishnu