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

Write Spaces

Former Member
0 Likes
1,792

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
Read only

Former Member
0 Likes
1,760
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
Read only

Former Member
0 Likes
1,760

Hi:

Simply do like this

1.

concatenate ' welcome to ' into tit

write tit.

2.

write : / (20) tit.

Regards

Shashi

Read only

Former Member
0 Likes
1,760

Hi,

Simplest would be:

Clear tit.

tit+20 = 'Welcome to'.

Regards

Raju Chitale

Read only

0 Likes
1,760

yes but i need spaces in both sides.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,760

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

Read only

Former Member
0 Likes
1,760

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.

Read only

Former Member
0 Likes
1,760

Hi Jose,

Try this:

Tit = '  Welcome to  '.

write :/ Tit.

Copy in your editor and execute.

Regards,

Swapna.

Read only

Former Member
0 Likes
1,760

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

Read only

Former Member
0 Likes
1,760

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.

Read only

0 Likes
1,760

>

> 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

Read only

Former Member
0 Likes
1,761
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.

Read only

former_member222860
Active Contributor
0 Likes
1,760

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.

Read only

Former Member
0 Likes
1,760

Hi Simon,

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

Regards,

Nitin.

Read only

Former Member
0 Likes
1,760

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

Read only

0 Likes
1,760

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