Skip to Content
Product Information

Getting started with SAP Cloud Platform Functions (beta) in a serverless environment

As announced at TechEd in Las Vegas on October 2, 2018, SAP Cloud Platform now includes fully-managed services which run in a serverless environment.

You can use these services standalone, or in combination, to build responsive applications, which are equipped to react to business changes in real-time. These services are designed to facilitate the development of microservices and help you build responsive (event-driven) applications and customer-specific extensions.

This blog provides a basic introduction to the new SAP Cloud Platform Functions (beta) service and explains the preliminary steps required to enable beta features in your subaccount, maintain entitlements, and create a service instance. Once everything is set up as outlined in this blog, you can follow the documentation and start developing your first functions in programming language Node.js.

New serverless offering on SAP Cloud Platform

These services run in a serverless environment, meaning it is SAP as cloud provider (not you), who is responsible for managing and dynamically scaling the resources required for your applications. Resource utilization is closely monitored and caters for micro-billing meaning you pay only for the resources your applications use. Pay-per-use details are published with global availability of each service and do not apply to beta releases.

For more information, see Serverless Computing on SAP Cloud Platform

SAP Cloud Platform Functions (beta)

SAP Cloud Platform Functions is a fully-managed cloud service for building, running, and managing ephemeral application functions. You can use functions to build new applications and extensions that react to triggers across clouds and landscapes in a serverless environment. By developing atomic functions, you can deploy additional business logic on demand in response to defined triggers (e.g. events, HTTP calls, and timers) without changing underlying business processes.

You can use functions to support the following use cases:

  • Develop microservices: write loosely couple atomic logic that is quick to build and scale automatically.
  • Support IoT/Big Data scenarios: automatically invoke functions to process, transform, and store data from thousands of sensors to the cloud.
  • Enable responsive, event-driven applications: use functions to listen and respond to events across the Cloud platform and external events to validate data, process files, and send notifications.
  • Streamline processes: create time-based triggers to schedule recurring activities such as reporting and clean-up jobs.

Using SAP Cloud Platform Functions (beta) with other services

You can use SAP Cloud Platform Functions (beta) with other services such as SAP Cloud Platform Enterprise Messaging and SAP Cloud Platform Backend service (beta) to extend SAP applications.

If you want to develop responsive, event-driven applications, use with SAP Cloud Platform Enterprise Messaging to transport events from SAP S/4HANA and SAP C/4HANA, for example, that trigger functions and deploy additional business logic. Further event sources are planned.

Use SAP Cloud Platform Functions (beta) together with SAP Cloud Platform Backend service (beta) when your application extensions need to manage or access data and you require a fully-functional backend with data persistence and caching on the fly.

Getting started with SAP Cloud Platform Functions (beta)

Ensure beta features are enabled for your subaccount

(Global) Administrators can enable beta features in your subaccount on SAP Cloud Platform, Cloud Foundry so you can view all available beta features, including SAP Cloud Platform Functions. From within your subaccount, you won’t see beta features automatically, but an administrator can set this up for you.

To find out if beta features are enabled for your subaccount, choose the Information icon in your subaccount for more information. If beta features are currently disabled in your subaccount, contact your administrator.

To enable beta features in your subaccount, administrators can choose the Edit icon in the subaccount and select Enable beta features and choose Save.

Maintain entitlements for your subaccount

  1. Administrators need to select the global account and choose Entitlements from the menu.
  2. Select Functions from the drop-down menu and choose Edit.
  3. Use the Addition icon to add the entitlement for your subaccount, which then changes the display from 0 to 1.
  4. Choose Save to update the entitlement for your subaccount so you can access the Functions tile from the Service Marketplace.

Create a service instances for Functions

After an administrator has enabled beta features for your subaccount and set up the entitlement for your subaccount, you can create a service instance for Functions.

  1. Navigate to your dev subspace in your subaccount.
  2. Choose Services –> Service Marketplace from the menu.
  3. Enter Functions in the search field to display the Functions service tile.
  4. Click on the Functions tile and choose Instances.
  5. To create a new service instance for Functions, choose New Instance.
  6. In the Create Instance dialog box, simply choose Next. Since this is a beta release, the only plan available is beta and this is displayed by default.
  7. In the Specify Parameters dialog box, specify the Functions service instance name you’d like to create in JSON format
    {"name": "<Function service instance name>"}
    
  8. Choose Next again in the subsequent dialog box because assigning an application is optional.
  9. In the subsequent dialog box, enter the name for your newly created instance, which you specified in the Specify Parameters dialog box:
  10. The newly created service instance is listed on the Instances screen together with its Name, Plan (beta), Last Operation (Created), and Available Actions.

After you have set up SAP Cloud Platform Functions (beta), refer to the documentation for further details about how to start developing functions.

Summary

This blog provided you with a basic introduction to the new beta service and explained the initial setup. Start working with this beta release to get a feel for working with functions and provide us with feedback so the service can be improved before it becomes generally available in 2019. Please note that since it is a beta version, there is no maintenance guarantee. In case of errors, we request you delete and recreate the service instance.

This blog is the first of a series to explain how to start working with this new service, which is part of the SAP Cloud Platform serverless offering. We will be publishing further blogs to explain how to take advantage of the full functional scope as a standalone service and in conjunction with other services like SAP Cloud Platform Enterprise Messaging and SAP Cloud Platform Backend service (beta).

More information:

Serverless Computing on SAP Cloud Platform

TechEd Las Vegas Keynote: Extend Your Digital Core with Enterprise-Ready Serverless and Event-Driven Computing on SAP Cloud Platform

 

22 Comments
You must be Logged on to comment or reply to a post.
    • You can try it in CF-trial account.

      0. Go to your CF trial home.

      1. Create new subaccount (select the Enable Beta Features option).

      2. Configure the subaccount.(Setting “Service Plans”, “Application Runtime“, and “Functions”)

      Hope your help.

        • Addendum: After a lot of trial creation and deletion: this seems to be only be available in eu10 ie AWS Frankfurt but eu10 has currently problems with creating and deleting subaccounts/organisations

          • Hi Wolfgang,

            I can confirm that at present, you can use SAP Cloud Platform Functions in all CF accounts where “enable beta features” is available.

            This currently applies to EU10, but other regions will follow in due course. We’re working on this…

            Best regards,

            Elisabeth

          • Hi Elisabeth,

            well, I can enable beta features in all regions and most regions have other beta services available but not Functions(beta)….

            I was finally able to create a beta subaccount and a space in this subaccount in eu10.

            Regards,

            Wolfgang

  • thank you for the details .. one step that wasn’t very clear for me was the

    Maintain entitlements for your subaccount

    however, after reading the blog a couple times, i was able to find how to nav into the functions… Maximilian Streifeneder  also was helpful in letting me know to look into the right place. Thank you again for sharing

  • This is awesome!

    What isn’t so much fun, is trying to develop functions using SAP Web IDE Full Stack. I’ve spent the last couple of evenings following the guide, but am not able to get the deployment working. It’s returns a 500 – Internal Server Error. I have a feeling that there is something wrong in the connection between NEO and CF. Setting up trust is pretty straight forward, but I found the part “Configure Destinations” a bit confusing. Part 2-4 is ok I guess, but point 1 is pretty vague. The service key contains 3 URLs and no mention of authentication type. I also have to guess the “verificationkey” is to be used as “Client Key”. Is it me, or has anyone else also struggled with this. And more important; have anyone managed to use Web IDE with Functions, and could possibly give me some hints?

    Procedure

    1. From the service key you created in the cockpit, note the following values:

      • URL
      • Authentication type
      • clientID
      • Token service user (same value as clientID)
      • Token service password (clientsecret)
    2. Go to https://<SAP Cloud Platform subaccount>.authentication.<domain>/saml/metadata and obtain the XML file.

    3. Search for the element md:EntityDescriptor in the XML file and copy the value of the property entityID. Use this value for the property Audience in the destination.

    4. Search for element md:AssertionConsumerService in the XML file and copy the value of the property Location. Use this value for the property Token Service URL in the destination.

    Add the following properties to the destination:

    WebIDEEnabled = true

    WebIDEUsage = faas_api

     

     

    • Hi Ronnie,

      creating the destination from NEO to SAP Cloud Platform Functions is a bit tricky if you are doing it the first time. Maybe this might help you to solve your problem, going through the destination parameters from top to bottom:

      • URL: if you are on the factory/trial landscape it will be the following:
        https://functions-service.cfapps.eu10.hana.ondemand.com/faas/v1​

         If you are on any other landscape, just replace the EU10 part. Please note that the URL needs to end with /faas/v1, this is currently not part of the URL that you find in the service key.

      • Proxy Type: Internet
      • Authentication: OAuth2SAMLBearerAssertion
      • Audience:
        • Retrieve the metadata XML file via the following URL: 
          https://<SAP Cloud Platform Subaccount>.authentication.<domain>/saml/metadata

          the property entityID.
        • The entityID should look something like this for factory/trial:
          <Subaccount-name>.aws-live-eu10​
      • Client Key: clientid from the functions service key
      • Token Service URL:
        • Search for element md:AssertionConsumerService towards the end of the metadata XML file from where we already copied the Audience and copy the value of the property Location
        • If there are several entries, choose the one that contains /oauth/token in the path
        • The URL should look something like this for factory/trial:
          https://<Subaccount-name>.authentication.eu10.hana.ondemand.com/oauth/token/alias/<Subaccount-name>.aws-live-eu10​
      • Token Service User: clientid from the functions service key
      • Token Service Password: clientsecret from service key

      Click the button New Property two times to add the following properties:

      • WebIDEEnabled:  true
      • WebIDEUsage:  faas_api

      Once the destination was saved, click on Check Connection

      This should confirm that the connection could be established. The “401: Unauthorized” error is displayed, as in this case the test is done with a platform user, but when using this destination from within Web IDE this is done in a business user context.

      Changing a destination might take up to 5 minutes to be reflected in Web IDE. To be on the save side just create a clone of your destination, this is usually working right away. Refresh the Web IDE, as the destinations are cached during initial loading.

      If you still get an error 500 this either indicates, that something is wrong with the URL or with the credentials.

  • Hello,

    Thanks for this detailed blog.

    I should forget something because I can not activate functions extension in my WebIde.

    My destination seems to be ok, check connection is ok and I’ve added properties WebIDEEnabled & WebIDEUsage.

    But even after several hours, I can not see functions feature in WebIde.

    If you have any idea …

    Regards,

    Cyril

    • Hi Cyril,

      have you enabled beta features for your subaccount on NEO environment?

      Check the section called “Ensure beta features are enabled for your subaccount” in Elisabeth’s original blog post. This is valid for both CF and NEO environments.

  • Do we also have the possibility to connect to a HANA database in the functions? I’m trying this out on my trial account but I’m getting a connection timeout for some reason.

    Thanks,
    Bram

  • Hi Bram,

     

    i have different serverless offerings including openLambda and other opensource serverless distributions  other than SCP offers,  where i was able to connect HANA with GOlang and Mongodb in serverless platforms . FYI,  our offering is internal SAP projects and not for external customers, you can find the details in our jampage  i have mentioned Our serverless topic jam page link

    https://jam4.sapjam.com/groups/mo5MbFuX55o9fHIB6WwBjg/overview_page/lxnQ4ZbtEMaVnoMngGab9f

    Here is the link of the serverless slides https://jam4.sapjam.com/groups/mo5MbFuX55o9fHIB6WwBjg/documents/WOro4MUajxC61WOX0NlE5H/slide_viewer?_lightbox=true&label=Slide+1

    let me know .

     

    BR

    Rushi.