title: How to pass a key field as variable instead of hard-coded key value to OData operation?
body: <p>I am calling the GetEntity OData <code>read</code> method from the SAP UI5 view controller and passing a key value in the request URL. I am getting the proper response from the back-end when I hardcode the key value. </p>
  
  <p>However, when I try to pass the key value dynamically in a variable by appending it to the URL, it doesn't work. I get the following error</p>
  
  <blockquote>
    <p>HTTP request failed 404</p>
  </blockquote>
  
  <p>In below code, <code>sGrant</code> is the variable and it doesn't work. But if I replace the variable name with its value hard-coded in below code, for example, in the read method like this: <code>"/GrantMasterSet('TY560003')"</code>, then it works: </p>
  
  <pre class="lang-js prettyprint-override"><code>var sGrant = this.byId("grantNbr").getValue();
  var oMod = this.getOwnerComponent().getModel();
  oMod.read("/GrantMasterSet('sGrant')", {
    success: function(oData) {
      var oJsonModel =  new JSONModel();
      oJsonModel.setData(oData);
      this.getView().setModel(oJsonModel);
    }.bind(this),
    error: function(oError) {
      MessageToast.show("Read Failed");
    }
  });
  </code></pre>