Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to call Function Import from SAP UI5 and get the return object in table?

HI,

      I am New to UI5 .i have created odata gateway service with function Import that will take single parameter as importing parameter and return the data in table.My problem is I am not getting how to consume data from function import in SAP UI5  and how i can display the returned data in ui5 table.

can Any Help me out regarding the issue.

Regards

LK

Tags:
Former Member
replied

Hello LK,

if you are using the service with an ODataModel you can use function "callFunction" of the ODataModel to call a Function Import.

The function has several parameters which allow you to specify the required information. For a detailed description of the parameters please have a look to the API reference.

https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.ui.model.odata.ODataModel.html#callFunction

Here is a simple example:

oDataModel.callFunction("TestFunctionImport", // function import name

                                        "POST", // http method

                                        {"parameter1" : "value1"  }, // function import parameters

                                        null,       

                                        function(oData, response) { }, // callback function for success

                                        function(oError){} ); // callback function for error

If the function import call was successful the "success callback function" is called. Within that you can access the returned data.

Regards,

Florian

4 View this answer in context
Not what you were looking for? View more on this topic or Ask a question