Skip to Content

From time to time a question like “Is the SAP Portal W3C compliant?” arises in the portal forums. As I have gotten asked by clients the same question several times, I will try to shed light on this topic. The following was tested on EP 7.00 and EP 7.01 and takes only consideres the HTML part, not the CSS and Javascript.

The short answer is: no

The explanation:

For those of you that don’t know what W3C compliance means: nowadays it means that the HTML code sent to the browser is at least HTML 4.01 compliant, but in most cases it means that the code has to be XHTML 1.0 compliant.

This means that the browser is expecting the page to include some content and to follows some standards, like:

       DTD  http://en.wikipedia.org/wiki/Document_Type_Declaration
   
  •  validate the xhtml document
   Root element  http://en.wikipedia.org/wiki/XHTML#Root_element
   
  • must be html
  • must contain an xmlns attribute
   XML declaration  http://en.wikipedia.org/wiki/XHTML#XML_declaration
   
  •  character encoding
       Closing (non-)empty elements
   Improperly nesting elements
   Quotation marks around attribute values
   XHTML elements and attributes are case sensitive
   Using attribute minimization
   CDATA: refer all script and stylesheet information in the head element.

 

To simplify XHTML creation, there are 3 types of XHTML available:

  • XHTML 1.0 Strict: “includes elements and attributes that have not been marked deprecated in the HTML 4.01 specification”
  • XHTML 1.0 Transitional: “includes the presentational elements (such as center, font and strike) excluded from the strict version”
  • XHTML 1.0 Frameset: “allows for the definition of frameset documents”

*Source: http://en.wikipedia.org/wiki/XHTML

For every HTML page you should aim to be at least XHTML 1.0 Transitional compliance.

You might think: As long as the browser is showing the information correctly, why be W3C compliant? Once, you can put the W3C compliant image on your site: http://www.w3.org/QA/Tools/Icons. But more important is the fact that W3C compliant means that the same HTML code will get interpreted correctly by all relevant browsers (portability). Upgrading from Firefox 3.5 to 4.0 or from IE7 to IE9 won’t be such a high a risk anymore.

The SAP Portal is accessed by browsers that interpret the generated HTML code from the Portal to show the data to the user. If the portal HTML code is XHTML compliant, it doesn’t matter if the user is using IE7, Opera, Chrome, Safari or Firefox. As a definition for portal HTML code: the code the portal is generating, not integrated Web Dynpro ABAP, BSP, etc code. As the SAP Portal is also making heavy use of Javascript, being (X)HTML doesn’t automatically mean that the functionality will also work across different browsers.

The W3C is offering a validator (http://validator.w3.org/) that check the HTML code of a site and gives you an error report. You can also use web developer plugins for Firefox to analyze the HTML code. I usually use Firebug and HTML validator.

Let’s analyze the portal. After an initial log in the user sees the typical default portal:

  • Masthead
  • Tool Area
  • Top Level Navigation
  • Detailed Navigation
  • Content Area (empty)

The W3C Validator is giving me: Failed validation, 151 Errors

The warnings:

  • Unable to Determine Parse Mode!
  • No DOCTYPE found! Attempting validation with HTML 4.01 Transitiona
  • Rare or unregistered character encoding detected (utf-8)

The errors:

  • no document type declaration
  • required attribute “TYPE” not specified. (several times, especially for wrong Javascript inclusion: .pagebuilder/scripts/pagesupport.js” >)
  • Wrong usage of HTML:
  •   end tag for “XYZ” which is not finished.
  •   end tag for element “DIV” which is not open.
  •   document type does not allow element “TABLE” here; missing one of “TH”, “TD” start-tag
  •   there is no attribute “XYZ”
  •   Images: required attribute “ALT” not specified.
  • Besides this, there are also a lot of bad Javascript errors. As an example, look at this:

This goes on and on. Most part of this is caused by the iViews SAP is providing. So you can get rid of these error messages when you develop you own portal applications for TLN, Masthead, etc. Doing so, you will still get the basic HTML errors the portal is always producing. I’ve written a small example code:

 public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
 {
   response.write(“”);
 }

This application only writes a standard portal page. Calling this application (http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.example.default) gives me 3 errors:

  1. No DOCTYPE implementation
  2. Required attribute TYPE not specified:
  3. Required attribute TYPE not specified

As this is standard code, you’ll always end up in creating non-XHTML compliant code. Curious about this, I checked also the SCN and SAP.com page. I wanted to know if SAP is taking W3C compliance serious or not.

SCN (http://www.sdn.sap.com/irj/sdn): 201 Errors, 130 warning(s)

But at least they are providing the DOCTYPE: SAP.com (http://www.sap.com/usa/index.epx): 103 Errors, 4 warning(s)

  • “there is not attribute: XYZ”
  • “ID ‘img’ already defined”
  • “element “H3″ undefined”
  • Etc.

Conclusion:

With the standard portal HTML code generation you won’t be able to have a W3C compliant portal. As the framework is already producing incompatible code, there is no easy workaround available.

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Sascha Wenninger
    Thanks for the good, detailed analysis of the most common validation errors in HTML. In addition to that, there are also tons of invalid CSS statements delivered in the stylesheets, so the list could actually be much longer…

    In any case, I think the real question here is whether there are plans to achieve W3C compliance at any point in time? One should not underestimate the importance of this, with proliferation of iPads, etc. in the work environment…

    (0) 
    1. Tobias Hofmann Post author
      Sascha,

      the portal CSS is another tragedy. I have the feeling that the portal theme editor started as a good idea, but than someone realized that it is a complex task and delivered a half finished product.

      About the W3C compliance: I think it’s almost impossible to achieve. Even when the portal is 100% compliant, there are still Web Dynpro ABAP, Java, BSP, BI reports, VC, and other applications that won’t be compliant. For mobile devices, the direction is to develop special apps and not to use the portal. I would be happy if the PRT would at last deliver a XHTML Strict HTML code.

      br, Tobias

      (0) 
      1. Sascha Wenninger
        Hi Tobias,

        No arguments about the themes… 🙂

        In my opinion, it is very possible to achieve full W3C compliance with BSP applications and VC also shouldn’t pose big problems (when rendered in Flash). I agree that WDA/WDJ is another issue but if the Portal itself was compliant, then it is possible to achieve full compliance under certain circumstances.

        For example, we are currently building quite a few BSPs for use from point of sale systems in stores – they are standards-compliant already but the portal they are exposed through are not…

        I think we agree here, so let’s hope someone from product management listens and agrees it’s worthwhile… 🙂

        (0) 
        1. Tobias Hofmann Post author
          Hi Sascha,

          your BSP pages are using HTMLB? Looking at some standard BSPs from SAP that use HTMLB, they create errors in the W3C validator.

          How did you achieve that your BSP pages are compliant? I guess that you’ll have to create almost all HTML code or did you use HTMLB?

          br, Tobias

          (0) 
          1. Sascha Wenninger
            Hi Tobias,

            our BSPs are all hand-coded HTML, so are taking a similar approach to PHP programming. This way, creating elegant cross-browser HTML is possible but requires a bit more work.

            Sascha

            (0) 
  2. Martin Voros
    Hi,

    I don’t agree with the following definition.

    For those of you that don’t know what W3C compliance means: nowadays it means that the HTML code sent to the browser is at least HTML 4.01 compliant, but in most cases it means that the code has to be XHTML 1.0 compliant.

    That’s not true. Compliance means that you use only elements from format which you decided to use. It can even be historic HTML 3.2. You mentioned that you got an error No DOCTYPE found and that’s the problem. The portal pages don’t even specify in format they are written.

    I quickly tested one simple web dynpro application with two ALV in two tabs and I got same error as you got: No DOCTYPE found. So I tried to validate against various doc types. It didn’t help and I always got over 30 errors. I guess the situation is same for portal. I agree with you that it would be nice if SAP portal generated HTML pages which are compliant to any doc type.

    It’s also questionable if you should aim for at least  XHTML 1.0 Transitional. You can decide to ignore whole XHTML standards and wait for HTML5 (not standard yet). SAP can’t even aim for XHTML 1.0 Strict because they are using frames in web dynpro applications. They can aim only for XHTML 1.0 Frameset.

    One more comment. Unfortunately, W3C compliance does not mean that a web page will be interpreted exactly same in each browser. There are still differences in implementations of standard.

    Cheers

    (0) 
    1. Tobias Hofmann Post author
      Hi,

      “Compliance means that you use only elements from format which you decided to use”.
      Because of this, I’ve limited the compliance to HTML 4.01 and XHTML 1.x. What HTML standard you are going for is your decision

      The missing DOCTYPE is a real problem. I don’t know why SAP isn’t including it. Rendering the pages in quirks mode makes it complicated to know what will happen when accessed by IE or FF.

      XHTML and HTML5: As you now, HTML 5 will be the successor of HTML 4 and XHTML(http://en.wikipedia.org/wiki/HTML5). As it will will enforce more the usage of CSS than HTML 4.01 does (and XHTML), aiming for at least XHTML 1.0 Transitional should ease the tranformation to HTML 5. XHTML also creates machine readable HTML code, so the content can be more easily processed.

      br, Tobias

      (0) 

Leave a Reply