Application Development 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: 

Write Spaces

Former Member
0 Kudos

Hi guys i m using titles to print any title but i need to put some spaces in both sides of the message , i was thinking in something like that :

concatenate  space(20) 'welcome to' space(12) into tit 
write tit.

but it doesnt work , how can i achive this ?

thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
data: car type char50.
car+20(20) = 'Welcome'.
car+40(10) = '             '.
write car.

This is tried and it gives you spaces just adjust according to your need...

Regards,

Lalit Mohan Gupta.

14 REPLIES 14

Former Member
0 Kudos

Hi:

Simply do like this

1.

concatenate ' welcome to ' into tit

write tit.

2.

write : / (20) tit.

Regards

Shashi

Former Member
0 Kudos

Hi,

Simplest would be:

Clear tit.

tit+20 = 'Welcome to'.

Regards

Raju Chitale

0 Kudos

yes but i need spaces in both sides.

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

I donot know about the spaces on the RH of the string.

DATA: tit TYPE char120.

tit+20 = 'Welcome to SAP'.

WRITE: tit.

BR,

Suhas

Former Member
0 Kudos

Hi,

This issue exist when we try to give some space along with concatenate statement.

But i tried with some logic as following,

As You need to print Welcome TO

So you take a work feild wf1 and assingn text "welcome" to it

And then SHIFT wf1 RIGHT BY 20 PLACES.

And take wf2 and assign text "To " to it.

And then SHIFT wa_temp LEFT BY 20 PLACES.

and then Concatenate wf1 and wf2

Hope this will work.

Regards,

Nitin.

Former Member
0 Kudos

Hi Jose,

Try this:

Tit = '  Welcome to  '.

write 😕 Tit.

Copy in your editor and execute.

Regards,

Swapna.

Former Member
0 Kudos

hello,

declare two variables

data: lv_space(20) type c,

lv_space(20) type c.

concatenate lv_space your message lv_space into lv_var.

sorry!..its not working .

Edited by: BrightSide on Apr 6, 2009 11:39 AM

Former Member
0 Kudos

Hi All,

We can't concatenate SPACES with Concatinate statement. It will automatically removes the extra space.

So here we need to shift space on the left and right side and then concatenate the work fields way i have given above.

Regards,

Nitin.

0 Kudos

>

> Hi All,

>

> We can't concatenate SPACES with Concatinate statement. It will automatically removes the extra space.

> So here we need to shift space on the left and right side and then concatenate the work fields way i have given above.

>

> Regards,

>

> Nitin.

Actually we can concatenate spaces using the following;

 CONCATENATE ld_one ld_two ld_three INTO ld_four RESPECTING BLANKS.

Regards,

Simon

Former Member
0 Kudos
data: car type char50.
car+20(20) = 'Welcome'.
car+40(10) = '             '.
write car.

This is tried and it gives you spaces just adjust according to your need...

Regards,

Lalit Mohan Gupta.

former_member222860
Active Contributor
0 Kudos

Use the logic like this:

data: v_str type string.

CONCATENATE  '#####' 'welcome to' '#####' INTO v_str.
TRANSLATE v_str USING '# '.

write:/ v_str.

In the above '#' replaces with space.

Former Member
0 Kudos

Hi Simon,

Actually, you try with this statement , we can not insert more then 1 space using this statement.

Regards,

Nitin.

Former Member
0 Kudos

But in SAP 4.6 only and lower . Respecting blanks is only valid with versions next from 4.6.

0 Kudos

OK. Well assuming he is using v4.6 or higher, this would be the perfect solution in my opinion.