<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: How to bind SAP UI5 Model response with the handler f... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-bind-sap-ui5-model-response-with-the-handler-function/qaa-p/13708860#M4830248</link>
    <description>&lt;P&gt;Hi, you just need to add an additional parameter to your&amp;nbsp;&lt;FONT face="courier new,courier"&gt;_onSuccess&lt;/FONT&gt; function definition. Modify your&amp;nbsp;&lt;FONT face="courier new,courier"&gt;_onSuccess&lt;/FONT&gt; function definition on line 6 to following:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var oModel = this.getModel('action');
oModel.create(path, body, {
  success: this._onSuccess.bind(this),   //How to pass response along with the bind function
  error: this._onError.bind(this)
});
_onSuccess: function (data, response) {
  // Response is not having any headers
  //Show some success message
},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 07:02:44 GMT</pubDate>
    <dc:creator>sajid-khan</dc:creator>
    <dc:date>2024-05-22T07:02:44Z</dc:date>
    <item>
      <title>How to bind SAP UI5 Model response with the handler function</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-bind-sap-ui5-model-response-with-the-handler-function/qaq-p/13708853</link>
      <description>&lt;P&gt;I have a function which create an entry in backend when an button ( save button ) is pressed.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code for creating entry&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var oModel = this.getModel('action');
oModel.create(path, body, {
  success: this._onSuccess.bind(this),   //How to pass response along with the bind function
  error: this._onError.bind(this)
});
_onSuccess: function (response) {
  // Response is not having any headers
  //Show some success message
},&lt;/LI-CODE&gt;&lt;P&gt;Instead of directly calling the function, I have binded the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;_onSuccess&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;oModel.create's&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;success handler. From the backend I am sending some header parameters along the (POST) response, which I need to access inside the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;_onSuccess&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;message and display. When I directly include the function in success handler, I am able to see the response, but not sure how send it along the bind parameter&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is working&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;callCreate: function (path, body) {
  var oModel = this.getModel('action');
  oModel.create(path, body, {
    success: function (data, response) {
        //I am able to get the response headers here
    },
    error: this._onError.bind(this)
  });
},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 06:54:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-bind-sap-ui5-model-response-with-the-handler-function/qaq-p/13708853</guid>
      <dc:creator>akhthaaralibadhusha</dc:creator>
      <dc:date>2024-05-22T06:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to bind SAP UI5 Model response with the handler f...</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-bind-sap-ui5-model-response-with-the-handler-function/qaa-p/13708860#M4830248</link>
      <description>&lt;P&gt;Hi, you just need to add an additional parameter to your&amp;nbsp;&lt;FONT face="courier new,courier"&gt;_onSuccess&lt;/FONT&gt; function definition. Modify your&amp;nbsp;&lt;FONT face="courier new,courier"&gt;_onSuccess&lt;/FONT&gt; function definition on line 6 to following:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var oModel = this.getModel('action');
oModel.create(path, body, {
  success: this._onSuccess.bind(this),   //How to pass response along with the bind function
  error: this._onError.bind(this)
});
_onSuccess: function (data, response) {
  // Response is not having any headers
  //Show some success message
},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 07:02:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-bind-sap-ui5-model-response-with-the-handler-function/qaa-p/13708860#M4830248</guid>
      <dc:creator>sajid-khan</dc:creator>
      <dc:date>2024-05-22T07:02:44Z</dc:date>
    </item>
  </channel>
</rss>

