Skip to Content
author's profile photo Former Member
Former Member

SAPUI5 -> Gateway Service Function Import

Hi, I'm trying to learn how to interact with the Function Imports of a gateway service. I can't find any documentation about it. Does anyone have an example I can look at?

I've been playing around with CheckFlightAvailability on RMTSAMPLEFLIGHT.

If you have code on how to trigger it and retrieve the data, that would be great!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 20, 2013 at 07:47 AM

    Hi Ryan,

    here a simple example to trigger the action "GetAvailableFlights". In my example, this action has the HttpMethod GET attached. Therefore you have the possibility to test this simply in your browser by appending the following string to the service URL:

    GetAvailableFlights?fromdate=datetime'2012-03-01T00:00'&todate=datetime'2012-04-01T00:00'&cityfrom='NEW%20YORK'&cityto='SAN%20FRANCISCO'

    Alternatively you can use the read method of the model like this:

    searchFlights: function(oEvent){ sap.ui.getCore().getModel().read(   "GetAvailableFlights",   null,   [    "fromdate=datetime'"+oAvailableFlightsController.formatDateUrl(sap.ui.getCore().byId("inpFromDate").getYyyymmdd())+"T00:00'",    "todate=datetime'"+oAvailableFlightsController.formatDateUrl(sap.ui.getCore().byId("inpToDate").getYyyymmdd())+"T00:00'",    "cityfrom='"+sap.ui.getCore().byId("inpCityFrom").getValue()+"'",    "cityto='"+sap.ui.getCore().byId("inpCityTo").getValue()+"'"    ],   true,   function(oData, oResponse){    console.log("Success!");    console.log(oResponse);    console.log(oData);   },   function(oError){    console.log("Error!");    console.log(oError);   } );},

    And for the CheckFlightAvailability, the URL could look like:

    CheckFlightAvailability?airlineid='AA'&connectionid='0017'&flightdate=datetime'2012-02-22T00:00'

    Regards, Frank

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 19, 2013 at 02:54 PM

    Hello.

    You can use jQuery.ajax to perform a HTTP GET or POST.

    The only problem is that to call a Function Import in this way you must set a XCSFR token inside the HTTP header.

    Regards.

    Add a comment
    10|10000 characters needed characters exceeded

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.