cancel
Showing results for 
Search instead for 
Did you mean: 

missing a single space in html output

Thilo
Explorer
0 Kudos

Hello to all,

take a look at the following code copied from a View

<% DATA: eins TYPE STRING VALUE 'ClassEins',
         zwei TYPE STRING VALUE 'ClassZwei'. %>
<span id="Test1" class="<%=eins%> ClassZwei">test it</span>
<span id="Test2" class="ClassEins <%=zwei%>">test it</span>

it works fine if compression is set to NONE, but if compression is set to 1 (remove spaces) or 2 (remove spaces, CR, LF) the html output looks like this:

<span id="Test1" class="ClassEinsClassZwei">test it</span>
<span id="Test2" class="ClassEins ClassZwei">test it</span>

Where is the single space? What’s wrong? Why is the first space removed, but the second isn’t?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181879
Active Contributor
0 Kudos

hallo Thilo,

I searched high and low tonight. You are right. The one space character went AWOL. Really not acceptable. You have my permission to open an OSS trouble ticket and complain bitterly. Or if it is to much work, just trust that we will sent out a search party and bring it back within the next many service packs.

brian

Thilo
Explorer
0 Kudos

Hi Brian,

thanks for confirming and your permission. I opened a OSS Ticket (No. 012002523100001955612005).

Thilo

Thilo
Explorer
0 Kudos

And here we have the SAP official answer:

-


8<----


Dear customer,

Thank you for the simple and clear example. It has been very usefull.

The problem is caused by the kernel error. We cannot fix this for the

moment.

Please use the following workaround:

<% DATA: eins TYPE STRING VALUE 'ClassEins',

zwei TYPE STRING VALUE 'ClassZwei',

sp TYPE STRING VALUE ` `.

%>

<span id="Test1" class="<%=eins%><%=sp%>ClassZwei">test it</span>

<span id="Test2" class="ClassEins <%=zwei%>">test it</span>

Pay attension that the sp variable is defined with ` ` (not ' ').

With best regards,

Artem Gratchev.

BSP Support.

-


8<----


I must admit that I never paid much attention to the backquote string delimiter - looks very interesting.

Nevertheless waiting for a kernel patch...

Thilo

former_member181879
Active Contributor
0 Kudos

Thilo,

At this stage we are not planning a kernel patch, unless your business case is really pressing. (In which case update OSS message so that rethink why nein is the right answer.) We have actually spend a number of hours to find where this is stripped (by accident), and see that the price to fix this, is very high for us. The truth is that this is a minor problem that only happens when you active the additional compression, where our first suggestion would be to just skip the compression for this page. (All of this been said, we will keep it on the toDo list, and see if can get the resources at same stage to dive into kernel development again.)

(Just for interest, not even myself could remember where some of this code is executed. Your problem provided a nice trip down memory lane!)

As for the back tics, they are string literals, and are space sensitive in ABAP. An example:


  CONCATENATE 'a ' 'b ' 'c ' INTO s. --> s = "abc".
  CONCATENATE `a ` `b ` `c ` INTO s. --> s = "a b c ".

The nice thing about this is that it is now possible to write in ABAP strings that contain <b>both</b> HTML and JavaScript all in one:


  s = `<body onload="myFunc('JSparm');">`.

We use " and ' for the HTML and JavaScript, and the ` to build the ABAP string. Makes the Java colleagues just jealous of our writing style:)

brian