Skip to Content
author's profile photo Former Member
Former Member

How to write final blanks using WRITE statement?

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:11 AM

    hi,

    set blanks on.

    write the above statement before the write statement.

    Plzz reward points if it helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:13 AM

    hi

    how do u know that the spaces r not printed,

    bcoz after 26547 kjhkji

    the remaining will be spaces only....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:14 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:15 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 12:06 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 10:17 AM

    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!

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 01:27 PM

    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!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.