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: 

How to write final blanks using WRITE statement?

Former Member
0 Kudos
346

Hi all,

I have a character variable of size 284, which I want to print out with size 284 no matter how many "non space" characters there are in the variable.

What happens now is that only the characters up the first final blan are printed and not the final blanks.

E.g.:

DATA: line(284) TYPE c .

line = '26547 kjhkji ' .

WRITE / line .

What is then printed is:

26547 kjhkji

The final blanks are not printed. What can I do to write also these final blanks??

Thanks in advance for all the helpful answers!

BR,

Armin

1 ACCEPTED SOLUTION

Former Member
0 Kudos
216

hi,

set blanks on.

write the above statement before the write statement.

Plzz reward points if it helps.

7 REPLIES 7

Former Member
0 Kudos
217

hi,

set blanks on.

write the above statement before the write statement.

Plzz reward points if it helps.

Former Member
0 Kudos
216

hi

how do u know that the spaces r not printed,

bcoz after 26547 kjhkji

the remaining will be spaces only....

Former Member
0 Kudos
216

Hi,

empty spaces are printing

DATA: line(284) TYPE c .

line = '26547 kjhkji ' .

WRITE: line,line .

output:

26547 kjhkji

26547 kjhkji

no / used even then two line bcoz it is printing empty spaces

try this

DATA: line(14) TYPE c .

line = '26547 kjhkji ' .

WRITE: line,line .

cheers,

Will.

Former Member
0 Kudos
216

Hi Armin

Spaces are printed but not visible to you

to make it visble

just print another Write statement as i did

check this code :

REPORT ZSBK_DOWNLOAD_IT.

DATA: line(70) TYPE c value 'santosh'.

WRITE line(70) .

write : 'india'.

your code is also working but problem is that when 180 characters exceeded it goes to new line

hope this is helpful for you..

Edited by: Abap-fresher on Jan 31, 2008 11:20 AM

Former Member
0 Kudos
216

Thanks for your answer Mandjari! However there is no statement set blanks on in ABAP. There is statement set blank lines on, but that statement only dictates weather or not blank lines should be printed and not weather or not final blanks on one line shoud be printed!

Former Member
0 Kudos
216

Hi Armin,

Basically u hv given 284 characters length. while displaying it display's all 284 characters.

Have a look on the following code.

DATA: line(284) TYPE c.

data: ln(10).

line = '26547 kjhkji '.

ln = '1234567890'.

WRITE: line color 5.

write:/ ln color 4.

reward points,if it is useful.

Thanks,

chandu

Former Member
0 Kudos
216

Hi all,

Thanks a lot for all the helpful answers.

I understand now that all the lines were printed with final blanks.

What confused me was that I looked at the extraced file (List->Save/Send->File ) and in that the final blanks were removed.

Is there a way yo get the final blanks in the extracted file as well?

BR,

Armin

p.s. I have awarded ya'll with 2P for the helpful answers! Thanks!