Skip to Content

ODataModel.callFunction not triggering the odata call to backend

Hi,

I am trying to call the function import in the UI5 application.

Below is the metadata of the function import.

<EntityContainer Name="ZOD_EMPLOYEE_SRV" m:IsDefaultEntityContainer="true">

<EntitySet Name="ET_EmployeeSet" EntityType="ZOD_EMPLOYEE_SRV.ET_Employee" sap:pageable="false" sap:content-version="1"/>

<FunctionImport Name="createEmpId" ReturnType="ZOD_EMPLOYEE_SRV.ET_Employee" EntitySet="ET_EmployeeSet" m:HttpMethod="GET"/>

</EntityContainer>


I have tried to access the function import by direct URL and it works as expected.

<domain>/sap/opu/odata/sap/ZOD_EMPLOYEE_SRV/createEmpId


But in the ui5 application, I am trying to access it. It does not trigger the call. I am not able to see any odata call

at 'network' tab.


debugger;

var oUrlParams = {};

oDataModel.callFunction("/createEmpId", {

method: "GET",

urlParameters: oUrlParams,

success: fnS,

error: fnE });

function fnS(data,response){

debugger;

console.log(response);

}

function fnE(oError){

alert("Error in read"+oError.message);

}

please help here to resolve this issue.

Thanks & Regards,

Vignesh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jun 28, 2016 at 09:06 PM

    Hi,

    I used the callFunction statement as below and it started working as expected.

    oDataModel.callFunction("createEmpId", "GET", null, null, fnS, fnE);

    function fnS(data, response){

    debugger;

    }

    function fnE(oError){

    alert("Error in read"+oError.message);

    }

    Thanks,

    Vignesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 20, 2016 at 11:21 PM

    oDataModel.callFunction("createEmpId", {

    try without the /.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      @sandip

      I am using the below odata control,

      var oModel = new sap.ui.model.odata.ODataModel("<domain>/sap/opu/odata/sap/ZOD_EMPLOYEE_SRV");

      Added to that i don't have any imporing parameter to the function parameter.

      @Jun

      I don't see any error log at console tab and there is no odata call under network tab.

      Below is the screen shot of debugger at the line of callFunction used,

      Thanks & Regards,

      Vignesh

      Debugger.PNG (36.5 kB)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.