Quantcast
Channel: SCN : All Content - SAP Manufacturing Integration and Intelligence (SAP MII)
Viewing all articles
Browse latest Browse all 1775

Error when using MII with SAPUI5

$
0
0

I get the following error - "Unable to get value of the property 'getElementsByTagName':object is null or undefined

 

<!DOCTYPE HTML>
<HTML>
<HEAD>

<meta name="description" content="UI5 table example with local JSON model" />
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

<META http-equiv="X-UA-Compatible" content="IE=edge">
<META http-equiv='cache-control' content='no-cache'>
<META http-equiv='expires' content='0'>
<META http-equiv='pragma' content='no-cache'>

<TITLE>SAPUI5 Projects Status - Applications</TITLE>

<SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js" data-libs="i5Chart,i5Grid"
    type="text/javascript" src="/sapui5/resources/sap-ui-core.js" data-sap-ui-theme="sap_goldreflection"
                  data-sap-ui-libs="sap.ui.core,sap.ui.commons,sap.ui.commons,sap.ui.table">
 
</SCRIPT>

<script>

var xmlHttp = new XMLHttpRequest();
var xmlDOM;
  xmlHttp.open("GET","ProjectsStatus/Transactions/ProjectsStatus", false);
  xmlHttp.send();
  xmlDOM = xmlHttp.responseXML.documentElement;
var opElement = xmlDOM.getElementsByTagName("Row")[0].firstChild;    <<<<<< I get error here- 'getElementsByTagName':object is null or undefined
var aData = eval(opElement.firstChild.data); 
  /* Define the table, with toolbar controls, update button */ 
var oTable = new sap.ui.table.DataTable("table", {  
  editable : true, 
  visibleRowCount :5
  }); 
oTable.setSelectionMode(sap.ui.table.SelectionMode.Multi); 
oTable.setToolbar(new sap.ui.commons.Toolbar({items: [ 
new sap.ui.commons.Button({text: "Update Data", press: updateData}), 
new sap.ui.commons.Label({text: "First Visible Row"}), 
new sap.ui.commons.TextField({tooltip: "First Visible Row", width: "30px", change: function(oEvent) { oTable.setFirstVisibleRow(parseInt(oEvent.getParameter("newValue"))); }}),  
new sap.ui.commons.Label({text: "Visible Row Count"}), 
new sap.ui.commons.TextField({tooltip: "Visible Row Count", width: "30px", change: function(oEvent) { oTable.setVisibleRowCount(parseInt(oEvent.getParameter("newValue"))); }}) 
]})); 

/* Define the table columns */  

var oControl = new sap.ui.commons.TextView({text:"{Applications}"}); // short binding notation
oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Applications"}), template: oControl, sortProperty: "lastName", filterProperty: "lastName", width: "100px"}));
oControl = new sap.ui.commons.TextField().bindProperty("value", "PercentComplete"); // more verbose binding notationt
oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "PercentComplete"}), template: oControl, sortProperty: "name", filterProperty: "name", width: "80px"}));
oControl = new sap.ui.commons.TextField().bindProperty("value", "Date_Due"); // more verbose binding notationt
oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Date_Due"}), template: oControl, sortProperty: "name", filterProperty: "name", width: "80px"}));
oControl = new sap.ui.commons.TextField().bindProperty("value", "Testing_Due"); // more verbose binding notationt
oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Testing_Due"}), template: oControl, sortProperty: "name", filterProperty: "name", width: "80px"}));

/* Define the JSON model */ 
var oModel = new sap.ui.model.json.JSONModel(); 
oModel.setData({modelData: aData}); 
/* Connect the data table to the JSON model */ 
oTable.setModel(oModel); 
oTable.bindRows("modelData");     
oTable.placeAt("content"); 

/* Function to save the updated data in the grid.*/
function updateData() { 
/* get the selected row context  and using the context read the required values from the selected row*/ 
var selRowContext = oTable.getContextByIndex(oTable.getSelectedIndex());  
var selectedId = oModel.getProperty("giid", selRowContext); 
var selectedApp = oModel.getProperty("application", selRowContext); 
var selectedDate = oModel.getProperty("datedue", selRowContext); 
document.icmd_common.setQueryTemplate("ProjectsStatus/MDO_Transactions/Projects_MDO_Select"); 
var commCommandQueryTemplate =  document.icmd_common.getQueryObject(); 
commCommandQueryTemplate.setParam(1, selectedApplications); 
commCommandQueryTemplate.setParam(2,selectedPercentComplete); 
commCommandQueryTemplate.setParam(3, selectedDate_Due); 
commCommandQueryTemplate.setParam(4, selectedTesting_Due); 
document.icmd_common.executeCommand(); 
/* Display a success message */ 
sap.ui.commons.MessageBox.alert("Actual quantity updated successfully.");  } 

</script>


</head>
<body class='sapUiBody'>
<h><b>Applications</b></h><br><br>
<table style="width:100%">
  <div id='content1'></div>
</table> <br><br><br>
</body>
<body class='sapUiBody'>
<h><b>Applications Changes</b></h><br><br>
<table style="width:100%">
  <div id='content2'></div>
</table><br><br><br>
</body>
<body class='sapUiBody'>
<h><b>Infrastructure Changes</b></h><br><br>
<table style="width:100%">
  <div id='content3'></div>
</table><br><br><br>

</body>

</html>


Viewing all articles
Browse latest Browse all 1775

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>