Skip to Content

Using Applet in View/Controller in SAP MII 15.1

Hi,

I have a task to upgrade SAP MII 12.1 to SAP MII 15.1. And I got problem with applet + View/Controller need your help.

In old app, I have an applet in .irpt file:

<applet WIDTH="705" NAME="mySPCChart" MAYSCRIPT="true" HEIGHT="250" CODEBASE="/XMII/Classes" CODE="iSPCChart" ARCHIVE="illum8.zip">
    <PARAM NAME="QueryTemplate" VALUE="Operator/RecordsByMatNumForSPCQuery"/>
    <PARAM NAME="DisplayTemplate" VALUE="Operator/RecordsByMatNumSPCChart"/>
    ...
    <PARAM NAME="CreationEvent" VALUE="CreateSpcApplet"/>
    <PARAM NAME="UpperChartSelectionEvent" VALUE="getSelectedApplet"/>
</applet>

<script>
function CreateSpcApplet() {
...
}
function getSelectedApplet() {
...
}
</script>


In new app, I'm using SAPUI5 with View and Controller to handle the page. I don't know how to show the applet and how to handle the CreationEvent and UpperChartSelectionEvent in my controller.

I tried to use JSView to show the applet. But I don't know where to implement/write function CreateSpcApplet/CreationEvent and getSelectedApplet/UpperChartSelectionEvent

sap.ui.jsview("OperatorUI.InspLotCharInputFormItem", { 
  getControllerName : function() {
    return "OperatorUI.InspLotCharInputFormItem";
  },
  createContent : function(oController) {  
    var chartHTML = new sap.ui.core.HTML({
      content: '<applet name="mySPCChart" codebase="/XMII/Classes" code="iSPCChart" archive="illum8.zip" width="705px" height="250px" mayscript="true">' +
      '<param name="QueryTemplate" value="Operator/RecordsByMatNumForSPCQuery"/>' +
      '<PARAM NAME="DisplayTemplate" VALUE="Operator/RecordsByMatNumSPCChart"/>' +
      ...
      '<PARAM NAME="CreationEvent" VALUE="CreateSpcApplet"/>' +
      '<PARAM NAME="UpperChartSelectionEvent" VALUE="getSelectedApplet"/>' +
      '</applet>'
    });
    return new sap.m.Page({
      title: "{/Name}",
      content: [
        chartHTML
      ]
    });
  }
});

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    May 10 at 03:05 PM

    You might have some success switching to an i5spcchart, so you would have something like this : (I've left in some setting variables just so you can see how it's done, the help screens can be a bit unclear)

    //IN CONTROLLER FILE
    
    onInit: function() {
    
    var i5SPC = new com.sap.xmii.chart.hchart.i5SPCChart("myproject/my_display_template", "myproject/myQry");
    i5SPC.setChartWidth("1220px");
    i5SPC.setChartHeight("800px");
    var qry = i5SPC.getQueryObject();
    var chart = i5SPC.getChartObject();
    chart.setChartName("SPCTEST");
    chart.setChartType("XBAR");
    qry.setParameter("Param.1", "whatever");
    chart.setUpperWESpecificationLimitAlarmEnabled(true);
    chart.setYAxisNumberFormat("0.00");
    i5SPC.registerUpperChartSelectionEventHandler(this.myFunction);
    i5SPC.draw(this.getView().byId("chartPanel"));
    },
    
    myFunction: function(oEvent) {
    // do something
    },
    

    and in your view file simply (I am using XML View, I'm not sure what the JS equivalent is)

    <core:View xmlns:core="sap.ui.core" xmlns="sap.m" controllerName="myProject.controllerFile">
    <Panel id="chartPanel" />
    </core:View>

    Hope this helps

    Nick

    Add comment
    10|10000 characters needed characters exceeded

    • At first glance it looks like something odd between the Title and the groupSize?

      Looks like the Highlighted Attribute Name & Value have been dropped from the UI5SPCChart, they are not in the template design. Have you seen the data dictionary? http://server:port/XMII/JSDOC/ChartComponent.html

      My guess for the IllumLoginName & Password would be to try adding them like this

      qry.setParam("IllumLoginName", "")

  • May 10 at 02:13 PM

    I don't recommend using the applets. I don't think they are being supported going forward and most browsers are moving away from the java plugin anyway. Use the i5 charts instead.

    Regards,
    Christian

    Add comment
    10|10000 characters needed characters exceeded