Browsing the history .. it looks like SAP had a Demo on MII 12.0 which was doing some calculations.
Considering that a form was being filled with what defined a formula, the JS code was as follows:
function doUpdate() {
var strExpr = document.frmMain.txtExpression.value;
if (strExpr != "") {
var myQuery = document.CalculatedChart.getQueryObject();
myQuery.setTagName(1,document.frmMain.Tag1.value);
myQuery.setTagName(2,document.frmMain.Tag2.value);
myQuery.setTagName(3,document.frmMain.Tag3.value);
myQuery.setTagName(4,document.frmMain.Tag4.value);
myQuery.setUserParameter("Expression",strExpr);
myQuery.setUserParameter("C1",document.frmMain.txtC1.value);
myQuery.setUserParameter("C2",document.frmMain.txtC2.value);
myQuery.setUserParameter("C3",document.frmMain.txtC3.value);
myQuery.setUserParameter("C4",document.frmMain.txtC4.value);
...
document.CalculatedChart.updateChart(true); |
}
}
The user parameters were defined to grab the expression itself and the coefficient values used in the formula (up to 10 coefficients, 4 in the example). Then a special XSL transform was applied on the tag query result (bringing the Tag1 to Tag4 values), namely IllumCalculator.xsl .. this is how it started ..
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:calc="http://www.lighthammer.com" extension-element-prefixes="calc" exclude-result-prefixes="xalan calc">
...
<lxslt:component prefix="calc"> | ||
<lxslt:script lang="javaclass" src="class:com.sap.xmii.Illuminator.ext.ExtFunctions"/> | ||
</lxslt:component> |
...
MII 12.1 (and after) does not have the setUserParameter() method anymore linked with the getQueryObject(). Now, The user parameters were practically pushing the "C1 .. C10" and "Expression" to the XSL, where xalan was called to evaluate the formula. Another component being used was the class mentioned above.
I'm thinking now .. can we replicate this with the tools at hand? If a transaction is used via xacute to generate all the "user defined parameters" in an xml result, one can apply the same XSL transform (or similar), providing that the javaclass can be still found ..
Cheers,
Paul.