title: How to perform OData read with date as entity primary keys
body: <p>I am confused on the date format to be used while invoking OData read operation where parameters are mentioned within entityset brackets. Would be great if you can paste your answer against each</p>
  
  
  
  <ol>
  <li><p>How to use ODataModel's <code>read()</code> method if we have values to be passed within the entity set parameters?</p>
  
  <pre class="lang-js prettyprint-override"><code>var sPath ="/EMP_DETAILSSet(Empid='50160458'/*, ...*/)";
  oBackEndModel.read(sPath, {
    success: this._fGetDetailsSuccess.bind(this),
    error: this._fBackEndInvocationError.bind(this)
  });
  </code></pre>
  
  <p>Is this the approach to be followed? Or do we have any other approach?</p></li>
  <li><p>How to set date as entity set key parameter with OData? Please correct the below code snippet (which gives me bad request error at runtime) where <code>dBegDate</code> and <code>dEndDate</code> are JS standard date objects.</p>
  
  <pre class="lang-js prettyprint-override"><code>var sPath ="/EMP_DETAILSSet(Empid='50160458',Begdate="+ dBegDate.toJSON() + ",Enddate=" + dEndDate.toJSON() + ",HAFId=' ')";
  oBackEndModel.read(sPath, {
    success: this._fGetDetailsSuccess.bind(this),
    error: this._fBackEndInvocationError.bind(this)
  });
  </code></pre></li>
  <li><p>How to execute multiple expand operation along with the entityset parameters mentioned above? Please fix the error in the below code as it is not working for me.</p>
  
  <pre class="lang-js prettyprint-override"><code>var sPath ="/EMP_DETAILSSet(Empid='50160458',Begdate="+ dBegDate.toJSON() + ",Enddate=" + dEndDate.toJSON() + ",HAFId=' ')";
  oBackEndModel.read(sPath, {
    urlParameters: {
      $expand: "NAVTODETAIL,NAVTOPROFILE,NAVTOREPORTEES"
    },
    success: this._fGetDetailsSuccess.bind(this),
    error: this._fBackEndInvocationError.bind(this)
  });
  </code></pre></li>
  </ol>
  
  <hr>
  
  <h3>Further updates</h3>
  
  <p>I have followed the suggestion b Sunil. <code>sPath</code> looked as follows at runtime:</p>
  
  <pre class="lang-js prettyprint-override"><code>"/EMP_DETAILSSet(Empid='50160458',Begdate=datetime'2014-03-11T14:49:52',Enddate=datetime'9999-12-31T14:49:52',HAFId=' ')"
  </code></pre>
  
  <p>When I tried this, it gave me the following error:</p>
  
  <blockquote>
    <p>2018-06-13 10:56:31.872300 The following problem occurred: HTTP request failed404,Not Found,{"error":{"code":"005056A509B11EE1B9A8FEC11C21D78E","message":{"lang":"en","value":"Resource not found for the segment '49:52',Enddate=datetime'9999-12-31T14:49:52',HAFId=''."},"innererror":{"transactionid":"5B20F78A93457852E10000000ACD4014","timestamp":"20180613052610.2725590","Error_Resolution":{"SAP_Transaction":"Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details","SAP_Note":"See SAP Note 1797736 for error analysis ..."}}}}</p>
  </blockquote>
  
  <p>Do you know why?</p>
  
  <p>Please note that the following URL works fine and returned the result when executed from SAP Gateway Client: 
      /sap/opu/odata/XXX/YYYY_SRV/EMP_DETAILSSet(Empid='50160458',Begdate=datetime'2014-03-11T14:49:52',Enddate=datetime'9999-12-31T14:49:52',HAFId=' ')?$expandNAVTODETAIL,NAVTOPROFILE,NAVTOREPORTEES&amp;$format=json</p>