cancel
Showing results for 
Search instead for 
Did you mean: 

Using Applet in View/Controller in SAP MII 15.1

Former Member
0 Kudos

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
      ]
    });
  }
});

Accepted Solutions (1)

Accepted Solutions (1)

nickstannage
Explorer

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

Former Member
0 Kudos

Thanks Nick, your solution seems to work. But I still got some issues when using i5SPCChart as you suggested.

This is the error I got:

java.lang.NullPointerException: while trying to invoke the method 
java.lang.String.trim() of a null object loaded from local variable 'in'<br>

I debugged, and this is the modelURL:

http://server:port/XMII/Illuminator?service=i5SPCService&QueryTemplate=Operator/RecordsByMatNumForSP... 1.00000&UpperLCL=---&UpperCL=---&UpperUCL=0.8&UpperMinRange=---&UpperMaxRange=1.1

How can I know where does the error come from to fix this?

Another thing, in old applet, I have these params:

<PARAM NAME="IllumLoginName" VALUE=""/>
<PARAM NAME="IllumLoginPassword" VALUE=""/>
<PARAM NAME="HighlightAttributeName" VALUE=""/>
<PARAM NAME="HighlightAttributeValue" VALUE=""/>

when I set them in i5SPCChart they cause error. The chart doesn't have these methods:

chart.setIllumLoginName("");
chart.setIllumLoginPassword("");
chart.setHighlightAttributeName('');
chart.setHighlightAttributeValue('');

How can I set them?

nickstannage
Explorer
0 Kudos

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", "")

Answers (1)

Answers (1)

former_member185280
Active Contributor
0 Kudos

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