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

ABAP report output as preformatted text on BSP page ?


I am trying to create a BSP page which contains the output of an ABAP report. This output ( which should look similar to an old fashioned ABAP list ) should be pre-formatted, keeping the white spaces in the list lines as they are.

The data is contained in a table ( I_LIST ) with 1 field ( ZEILE ). Part of the layout section of the BSP looks like this :

<% DATA: blue TYPE I. %>

<PRE CLASS="list">


<% blue = SY-TABIX MOD 2. %>

<SPAN CLASS="r<%= blue %>"><%= W_LIST-ZEILE %></SPAN>



( The "blue" variable toggles between 0 & 1, which corresponds with 2 different shades of blue in a CSS type sheet. )

In order to ensure pre-formatting, , I use the <PRE> tags.

The side-effect of this, is, that a blank line is inserted after each list line.

I have tried using <TABLE> tags and placing a line in each table row, but this destroys the whitespaces.

Does anyone know a easy way to avoid the blank lines while keeping the pre-formatting ?

( I have only started with BSP, so I might be missing something very obvious )

Fred van de Langenberg

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jun 08, 2004 at 09:47 PM

    Hallo Fred,

    Now this is the type of question and the challange that I actually like to see in this forum.

    <u>First question: what does <pre> mean?</u> Effectively output every thing verbatim. So if there are CRLF (Carriage Return/Line Feed) sequences in that text, they are outputted as is.

    <u>Next question: From where does those extra CRLF comes?</u> This simple fact is that your wrote them! Let us look at your source again with my comments:

    <PRE CLASS="list">CRLF
    <% blue = SY-TABIX MOD 2. %>CRLF
    <SPAN CLASS="r<%= blue %>"><%= W_LIST-ZEILE %></SPAN>CRLF

    What I have added onto your code (just visualized for you!) are all the extra CRLF characters that you wrote but never see. They are there in the editor, and they are blasted out to the browser.

    <u>Idea 1:</u> The simplest solution would be to write just some of your code onto one line!

    <PRE CLASS="list">CRLF
    <% blue = SY-TABIX MOD 2. %><SPAN ...</SPAN>CRLF

    From my estimate, just having the blue calculations plus the span on one line should already do the trick. The loop/endloop just add additional CRLF before after the sequence.

    <u>Idea 2:</u> Why not look at the properties tab of your page. There are some compression options to actually strip CRLF completely from the output, to make it smaller. See also:

    BSP Performance: Compression


    <u>Problem with Idea 2:</u> Of course, this will also strip the CRLF from behind the span, rendering all your output on one line! So you have to manually render these also out. Just add the following:

    <SPAN CLASS="r<%= blue %>"><%= W_LIST-ZEILE %></SPAN>

    All of the above shot in the dark (it is night outside!), I leave the final tests for you to enjoy!


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hallo Brian,

      Thanks very much for your clear answer !

      The page works very nice now, and your tip gave me a deeper understanding of what actually happens with the code in the BSP layout sections.

      Thanks also for your page compression article ( very usefull indeed !)

      With regards,

      Fred van de Langenberg

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.