Giter Site home page Giter Site logo

power-platform-neptune-api-factory's Introduction

Power Platform and Neptune API Factory

This guide outlines the steps to get started with a simple Power App that connects to an SAP system using Neptunes API Factory. In the end the Power App will be able to look up customers in the SAP system using a Search Help function. The scenario was also shown in a joint webinar with Neptune Software, How Microsoft Power Platform customers can connect to SAP backends

Power Platform comes with several out of the box connectors that allow you to connect to an SAP System.

The approach outlined here uses the Neptune API Factory -- an installation that customers need to do in the SAP system -- to expose any BAPI, Function Modules, ALVs, ... via RESTful services. Using an OpenAPI / Swagger specification these REST services can easily be imported / used in the Power Platform using the Custom Connector.

All the steps outlined below can be done using a Trial account both on the Neptune and the Microsoft side.

Sign up to the Netpune Developer Trial

Go to https://www.neptune-software.com/free-trial/ scroll down and click on "Download Free Trial" Download

Click on Register Download

and fill in the required information. Select "Neptune DXP SAP edition [Planet 8]" and click on Register Download

You should get an Email with the required information to sign in to the Netpune Software Account Portal. We will log onto the portal later on in step xx

Sign up to the Power Platform Developer Trial

Go to https://powerapps.microsoft.com/en-us/developerplan/ and sign up for the "Power Apps Developer Plan" Download

Fill in the required information. Download

Note: If you have problems signing in with your work / school account, go to https://developer.microsoft.com/en-us/microsoft-365/dev-program and sign up for the Microsoft 365 Developer Program first.

Download and install the required files from Neptune

After registration to the Neptune Developer Trial you will get credentials and a link to login to the Neptune Portal. From there Click on Product Download -> Download Now Neptune Portal

From the Neptune DX Platform - SAP Edition, select Long Term Support Release -> DXP 21 (2021) and download the ZIP file. Download DXP

Now follow the instructions outlined in the Neptune-DXP SAP Edition Installation-Guide.pdf and install the transport files.

Also make sure to active the Neptune servies in SICF

After activation run the /NEPTUNE/INSTALLATION_CHECK from SE38

Start Neptune

From the SAP GUI and start transaction /NEPTUNE/COCKPIT

A browser will open with the Netpune DX Platofrm. Select the API Factory Download

Select in the ObjectTypeName column select the /NEPTUNE/CL_DR_LIB_DDIC_SHLP_X object: Download

Click on Policy and click on Edit Download

Now switch to Unrestricted and click on Save. Note: This is only for our test environment. For a real implementation you would not change this to unrestricted! Download

Make sure to select OpenAPI 2.0 in the drop down (Power Platform currently does not support OpenAPI 3.0) and enter DEBIA for the Searchhelp value
Download

Click on the Swagger UI and Explore to see the dynamically created specification Download

From here you can already test the function. Download

Note: In my setup I am using an Azure API Management to actually expose the REST API to the internet. This allows me to protect the SAP system, but also to quickly implement features like Single Sign-On from Azure Active Directory to the SAP sytem (see also

If your system already exposes this API to the internet, there is nothing else for you to do.
Download

Creating a Custom Connector in the Power Platform

With this we can switch over to the Power Platform, [https://us.flow.microsoft.com/en-us/[(https://us.flow.microsoft.com/en-us/).

Under Data -> Customer Connectors click on "+ New custom connector" and select "Import an OpenAPI from URL". Download

Enter the URL from the Swagger.ui, e.g.

https://yourSAPSystem:port/neptune/api/dynamic/neptune/cl_dr_lib_ddic_shlp_x/SH/DEBIA/swagger.json?oas_version=2.0&sap-user=user&sap-password=password&exclude_response_examples=true&namespace_separator=-

Please note that you might need to add the parameters exclude_response_examples=true and namespace_separator=- if you do get error "Definition is not valid" when creating the Customer Connector in Power Platform

Make sure to replace the user and password with the username and password of your SAP system (alternatively you can also download and upload the Swagger file) and click on Import -> Continue Download

Now double check the configuration. Click on Security, Download

Definition

Download

Download

And finally click on "Create Connector" to create the connector the actual connector.

Now open Power Apps, http://make.powerapps.com/ and click on Create -> Canvas app from blank image

Enter an App name and click on Create image

In the Apps Canvas click on the Data icon on the right, click on "Add data" Search for the Customer Connector name you previously created and select it. image

As a result you should see the new data source SearchHelp:SH(Searchhelp) image

Now click on Insert and Drag and drop a Text Input and Button onto the canvas image

Search for Table, select the Data table (preview) and drag it onto the canvas as well. image

Now select the button you created. Make sure that the Action for the Button is OnSelect and enter the function,

ClearCollect(Customers, 'SearchHelp:SH(Searchhelp)|DEBIA-Customers(general)'.POSTexecute(800,{MAXROWS:100, MCOD1:Table({SIGN: "I",OPTION: "CP",LOW: Concatenate("*",TextInput1.Text,"*"),HIGH: ""})}).result.DATA);

image

Note:

  • ClearCollect creates a new collection that we can easily poulate and use in other items.
  • SearchHelp:SH is the Custom Connection that we created in step xxx.
  • The POSTexecute step is the function to lookup the customer information
  • it requires several mandatory parameters, like SAP-Client (800), MAXROWS (a default value of 100 as an example), MCOD1 (a Table with information on what customer information we should look for)
  • TextInput1.Text is the value the user interes in the Input Field. You can find the execat property name by clicking on the Next infput field

image

Now click on the table and link the newly created Collection "Customers" to it. image

On the right hand side under Data sources -> Customers click on Fields -> Edit fields, click on "+ Add field" and select the two properties KUNNR and MCOD1. Then click on Add. image

The result should look like this (now you can see the name of the two columns). It's time to test the Power Apps. On the upper right corner click on the "Play" button. image

Enter some letters in the Input field and click the button. As a result you should see customer data displayed in the Power App. image

With this the app is ready. You can save it, publish it and distribute it within the organization. Now that you have the Custom Connector it can also be used in Power Automate Flow (for example to integrate it in Teams, Excel, ...).

power-platform-neptune-api-factory's People

Contributors

hobru avatar thorsten-wolf-neptune avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

power-platform-neptune-api-factory's Issues

Definition Failure by Creation of Custom Connector

Hi @hobru ,

I get an Error when I try to "Create Connector" in Power Automate.
Can you help me out?

Specified swagger has the following errors: 'Definition is not valid.  Error: 'Error : paths/~1search/post/responses/200/examples/OBJECT_SPECIFIC_LIST : The response example 'OBJECT_SPECIFIC_LIST' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1search/post/responses/200/examples/GENERAL_LIST : The response example 'GENERAL_LIST' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1search/post/responses/500/examples/~1NEPTUNE~1CX_DR_PROG-IF_T100_MESSAGE~0DEFAULT_TEXTID : The response example '/NEPTUNE/CX_DR_PROG-IF_T100_MESSAGE~DEFAULT_TEXTID' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1search/post/responses/500/examples/~1NEPTUNE~1CX_DR_PROG-RANGE_INVALID_LOW_HIGH : The response example '/NEPTUNE/CX_DR_PROG-RANGE_INVALID_LOW_HIGH' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1search/post/responses/500/examples/~1NEPTUNE~1CX_DR_PROG-SELSCREEN_EVENT_DOES_NOT_EXIST : The response example '/NEPTUNE/CX_DR_PROG-SELSCREEN_EVENT_DOES_NOT_EXIST' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1search/post/responses/500/examples/~1NEPTUNE~1CX_DR_PROG-SELSCREEN_REFERENCE_WRONG : The response example '/NEPTUNE/CX_DR_PROG-SELSCREEN_REFERENCE_WRONG' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1search/post/responses/500/examples/~1NEPTUNE~1CX_DR_PROG-VARIANT_DOES_NOT_EXIST : The response example '/NEPTUNE/CX_DR_PROG-VARIANT_DOES_NOT_EXIST' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1search/post/responses/500/examples/~1NEPTUNE~1CX_DR_PROG-VARIANT_OBSOLETE : The response example '/NEPTUNE/CX_DR_PROG-VARIANT_OBSOLETE' is not produced by the operation 'POST_search'.
   ##   Error : paths/~1execute/post/responses/500/examples/~1NEPTUNE~1CX_DR_SHLP-IF_T100_MESSAGE~0DEFAULT_TEXTID : The response example '/NEPTUNE/CX_DR_SHLP-IF_T100_MESSAGE~DEFAULT_TEXTID' is not produced by the operation 'POST_execute'.
   ##   Error : paths/~1execute/post/responses/500/examples/~1NEPTUNE~1CX_DR_SHLP-EXPAND_NOT_POSSIBLE : The response example '/NEPTUNE/CX_DR_SHLP-EXPAND_NOT_POSSIBLE' is not produced by the operation 'POST_execute'.
'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.