cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using Servlets in SAP MII

Former Member
0 Likes
451

Hi all,

     I need to use servlet instead of applets in SAP MII 12.1. Is it possible to use servlets in this version?  If so can anyone guide me to proceed the same in creating xsl from the generated xml?

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

It might be too late here 10 months later, but 53 page views and counting, i just share a quick demo we use in real life production.

The point of the demo (copy of real code) is turn a query result with ID numbers and textual names (of control charts) into a bulleted (unordered) HTML list of dynamical generated links to the irpt page that can renderer the charts only given this ID number

Point is it is very little code, very fast and done server side so no browser depedencies.

irpt file calls the servlet:

<html>

<head>

<meta http-equiv="Pragma" content="no-cache">

</head>

<body>

<div>
<servlet name="Illuminator">
  <param name="QueryTemplate" value="q_getSpecs" />
  <param name="Param.1" value="1" />
  <param name="Param.2" value="99999" />

  <param name="Stylesheet" value="/XMII/CM/DemoProject/Transforms/LinkList.xsl" />
  <param name="elementName" value="selChart" />
  <param name="idName" value="id" />
  <param name="fieldName" value="title" />
</servlet>
</div>

</body>

</html>

QT q_getSpecs returns (amongst others) id and name of control chart.

Notice the call to "stylesheet" "/XMII/CM/IM1/Kontrolkort/Transforms/LinkList.xsl"! the content is below here:

<?xml version="1.0" encoding="UTF-8"?>
<!--

  @param: elementName = name and id of the element

  @param: idName  = column name of the value column

  @param: fieldName = column name of the text column

 

  optional

  @param: className = name of the css class

  @param: multiple = multi select or single drop down box (true or false)

  @param: size  = number of items

  @param: onchange = function to call on select

-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" media-type="text/html" encoding="windows-1252"/>
  <xsl:param name="elementName"/>
  <xsl:param name="idName"/>
  <xsl:param name="fieldName"/>
  <xsl:param name="className"/>
  <xsl:param name="multiple"/>
  <xsl:param name="size"/>
  <xsl:param name="onchange"/>
  <xsl:template match="/">
    <xsl:element name="ul">
      <xsl:for-each select="//Row">
        <xsl:element name="li">
          <xsl:element name="a">
            <xsl:attribute name="href">
              <xsl:text>spc.irpt?id=</xsl:text>
              <xsl:if test="string-length(*[name()=$idName]) &lt; 4">
                <xsl:text>0</xsl:text>
              </xsl:if>
              <xsl:value-of select="*[name()=$idName]"/>
            </xsl:attribute>
            <xsl:if test="string-length(*[name()=$idName]) &lt; 4">
              <xsl:text>0</xsl:text>
            </xsl:if>
            <xsl:value-of select="*[name()=$idName]"/>
            <xsl:text> </xsl:text>
            <xsl:value-of select="*[name()=$fieldName]"/>
          </xsl:element>
        </xsl:element>
        <xsl:text>

        </xsl:text>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

Demo result (server side generated XHTML):

<html>

<head>

<meta http-equiv="Pragma" content="no-cache">

</head>

<body>

<div>

<ul>

(...)

<li>

<a href="spc.irpt?id=7024">7024 Batchrapport-tid FIN_IA_DRY_MIXER_RAP</a>

</li>

       

<li>

<a href="spc.irpt?id=7025">7025 LMES Receptfrigivelsesstid: FIN_IA_VASKM</a>

</li>

       

<li>

<a href="spc.irpt?id=7026">7026 LMES Receptfrigivelsesstid: CIP_SELVCIP_196C</a>

</li>

(...)

</ul>

</div>

</body>

</html>

You see, we get the expected <ul> and <a> tags with the dynamical inserted texts!

I found this syntax way ago using the spcchartservlet that generates some xhtml and xslt code (not very clever but it does) and just adjusted it for flexibility of the server side rendering of images. But the value and potential use is greatly underestimated IMO. I'm just a total XSLT newbie and debugging XSLT is very hard in the environemnt, that's the greatest barrier at the moment.

Answers (0)