SAP & Teams Integration with Copilot Studio and Generative AI (2024)

In this blog, we provide a detailed guide on leveraging AI to optimize SAP workflows within Microsoft Teams. This solution is particularly advantageous for mobile users or those with limited SAP experience, enabling them to efficiently manage even complex, repetitive SAP tasks.

By integrating SAP with Microsoft Teams using Copilot Studio and Generative AI, we can significantly enhance productivity and streamline workflows. This blog will take you through the entire process of setting up a Copilot to interact with SAP data in Teams. We'll utilize the Power Platform and SAP OData Connector to achieve this integration. By following along you will create and configure a Copilot, test and deploy it within Teams, enable Generative AI, build automation flows, and create adaptive cards for dynamic data representation and even change data in SAP.

The solution consists of three main components: Copilot Studio, Power Automate Flow and SAP OData Connector.

  • Copilot Studio is a web-based tool that allows you to create and manage conversational AI agents, called Copilots, that can interact with users through Microsoft Teams.
  • Power Automate Flow is a is a tool that allows you to automate workflows between your applications.
  • SAP OData Connector is a custom connector that enables you to connect to SAP systems using the OData protocol.

The following diagram illustrates how these components work together to provide a seamless SAP and Teams integration experience.

SAP & Teams Integration with Copilot Studio and Generative AI (1)

Before you start building your Copilot, you need to make sure that you have access to the Power Platform and to an SAP system. You can leverage the licenses and SAP systems that are available in your company, or alternatively you can use a trial license for the Power Platform and a public SAP demo system. The following links will guide you on how to obtain these resources if you don't have them already.

2.1. Power Platform Access

Trial license:https://learn.microsoft.com/en-us/power-apps/maker/signup-for-powerapps

2.2. SAP System Access

Request SAP Gateway Demo System ES5 Login:https://developers.sap.com/tutorials/gateway-demo-signup.html

Now that you have an overview of the solution and have ensured you meet the prerequisites, it's time to dive into the hands-on process of creating a Copilot. This section will guide you through the detailed steps to set up and configure your Copilot, enabling it to interact with SAP data within Microsoft Teams. You'll learn how to leverage Power Automate Flow and the SAP OData Connector to build a robust automated workflow. By the end of this chapter, you will have a fully functional Copilot that can retrieve information about products from the SAP system.

3.1. Create a Copilot

Create a Copilot with the name “SAP Product Copilot”:

SAP & Teams Integration with Copilot Studio and Generative AI (2)

And enter the following details:

SAP & Teams Integration with Copilot Studio and Generative AI (3)

Activate “Generative AI” Feature in the Settings of the Copilot

SAP & Teams Integration with Copilot Studio and Generative AI (4)

SAP & Teams Integration with Copilot Studio and Generative AI (5)

3.2. Setup Flow + Connector

Create a new “Instant cloud flow” in Power Automate:

SAP & Teams Integration with Copilot Studio and Generative AI (6)

Provide the name and chose “Run a flow from Copilot” as trigger:

SAP & Teams Integration with Copilot Studio and Generative AI (7)

Add an input variable to the trigger action:

SAP & Teams Integration with Copilot Studio and Generative AI (8)

Add an SAP OData action. Choose Query OData entities:

SAP & Teams Integration with Copilot Studio and Generative AI (9)

Configure the connection:

SAP & Teams Integration with Copilot Studio and Generative AI (10)

OData Base URI: https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC

Enter the OData Entity “Product Set”:

SAP & Teams Integration with Copilot Studio and Generative AI (11)

Presse “Show all” to enter a filter in the advanced parameters:

SAP & Teams Integration with Copilot Studio and Generative AI (12)

In $Filter you’ll enter a Power FX expression that will filter on the provided Category.

SAP & Teams Integration with Copilot Studio and Generative AI (13)

Add this expression:

concat('Categoryeq','''',triggerBody()['text'],'''')

Add a final action that will return the found products.

SAP & Teams Integration with Copilot Studio and Generative AI (14)

Find the required action by searching for Copilot

SAP & Teams Integration with Copilot Studio and Generative AI (15)

Add an output variable

SAP & Teams Integration with Copilot Studio and Generative AI (16)

In the output add a Power FX expression:

SAP & Teams Integration with Copilot Studio and Generative AI (17)

body('Query_OData_entities')

Finally, the action should look like this:

SAP & Teams Integration with Copilot Studio and Generative AI (18)

3.3. Test the flow

Choose Manually and enter the category “Keyboards”:

SAP & Teams Integration with Copilot Studio and Generative AI (19)

The successful run will indicate that the flow and the connector work fine.

SAP & Teams Integration with Copilot Studio and Generative AI (20)

3.4. Connect the Copilot with the Flow.

Add an action:

SAP & Teams Integration with Copilot Studio and Generative AI (21)

Chose the previously created Flow:

SAP & Teams Integration with Copilot Studio and Generative AI (22)

Next:

SAP & Teams Integration with Copilot Studio and Generative AI (23)

Edit the Input:

SAP & Teams Integration with Copilot Studio and Generative AI (24)

And add the following text into the Description. This ensures Gen AI knows how to set the input for the flow:

Product Category. Only one single category can be chosen as input from this list. It is case-sensitive and must be written exactly like below:

Accessories,

Notebooks,

Laser Printers,

Mice,

Keyboards,

Mousepads,

Scanners,

Speakers,

Headsets,

Software,

PCs,

Smartphones,

Tablets,

Servers,

Projectors,

MP3 Players,

Camcorders

Edit the Description of the action output in the same way:

Products found in SAP of a given category.

Present the result as HTML table including following information: ProductID; Name; Category; Description; Supplier; Price; Currency.

3.5. Test the Copilot in the test pane

Open the Test pane and give it a try:

SAP & Teams Integration with Copilot Studio and Generative AI (25)

For the first test you need to connect with the SAP OData Connector:

SAP & Teams Integration with Copilot Studio and Generative AI (26)

Now you should get the response in the chat window:

SAP & Teams Integration with Copilot Studio and Generative AI (27)

3.6. Add the Copilot to Teams

Publish the Copilot first:

SAP & Teams Integration with Copilot Studio and Generative AI (28)

SAP & Teams Integration with Copilot Studio and Generative AI (29)

Then connect to Teams in the Channels Tab:

SAP & Teams Integration with Copilot Studio and Generative AI (30)

SAP & Teams Integration with Copilot Studio and Generative AI (31)

Open the Copilot in Teams

SAP & Teams Integration with Copilot Studio and Generative AI (32)

Finally test the Copilot in MS Teams

SAP & Teams Integration with Copilot Studio and Generative AI (33)

You have successfully built a Copilot that can retrieve up-to-date information of products stored in an SAP system and present it in a table format in Microsoft Teams.

Now let’s move on by creating adaptive cards to display SAP data dynamically within Microsoft Teams. In this section you will

  • Create and configure topics.
  • Activate topics using the appropriate trigger phrases.
  • Call flows from within topics.
  • Utilize various entities of the SAP OData Connector.
  • Handle special situations, such as when no product is found.
  • Parse JSON data and assign values to topic variables.
  • Design and implement adaptive cards.
  • Understand the differences between actions and topics.

By mastering these skills, you will enhance the functionality and interactivity of your Copilot, providing users with a more intuitive and efficient way to interact with SAP data.

4.1. Create a Topic “SAP Product Data”

Create a new topic from blank

SAP & Teams Integration with Copilot Studio and Generative AI (34)

In the section “Describe what the topic does” Enter the following:

You can copy/paste this description:

This tool can handle queries like these:

sap product update.

Update SAP product.

Update SAP product data.

Edit product information in SAP.

Edit SAP product data.

Show SAP product details.

Edit SAP product information.

Save the Topic

SAP & Teams Integration with Copilot Studio and Generative AI (35)

Open the Topic Details and add the Description

SAP & Teams Integration with Copilot Studio and Generative AI (36)

Description: “Show and update information about a product in the SAP system.”

Create the Input variable

SAP & Teams Integration with Copilot Studio and Generative AI (37)

Save again.

Add a node that asks for the Product ID.

Question:

Which product do you want to update?

Please provide the Product ID.

Example: HT-1000.

SAP & Teams Integration with Copilot Studio and Generative AI (38)

In the Identify field choose “User’s entire response”:

SAP & Teams Integration with Copilot Studio and Generative AI (39)

Make sure the response will be saved in the variable ProductID:

SAP & Teams Integration with Copilot Studio and Generative AI (40)

Note: With GenAI feature enabled the question might not be asked when the ProductID is already known within the context of the conversation, which is very convenient.

Add a Message that will help us to verify if up to here the topic works as designed:

SAP & Teams Integration with Copilot Studio and Generative AI (41)

This message can be removed later when all is working fine.

4.2. Create a Flow to get SAP product details

Take the flow from Lab1 and make a copy

SAP & Teams Integration with Copilot Studio and Generative AI (42)

SAP & Teams Integration with Copilot Studio and Generative AI (43)

Refresh the page to see the new flow and then turn the flow on

SAP & Teams Integration with Copilot Studio and Generative AI (44)

Change the Filter in the new Flow

SAP & Teams Integration with Copilot Studio and Generative AI (45)

The new filter must be changed to filter on ProductID:

concat('ProductID eq ', '''', triggerBody()['text'], '''')

Then update the action and save the flow.

4.3. Call the Flow from the Topic

Add a node “Call Action” and choose the “List SAP product details” flow:

SAP & Teams Integration with Copilot Studio and Generative AI (46)

As Input provide the ProductID variable:

SAP & Teams Integration with Copilot Studio and Generative AI (47)

Save again.

4.4. Add error handling when no data is found

Add some error handling in case we got the ProductID wrong, and nothing was found in SAP:

SAP & Teams Integration with Copilot Studio and Generative AI (48)

Steps are:

  • Set a condition where Output is equal to “[]” which means no product was found and an empty JSON string was returned.
  • Send a message to inform the user: “The product with ID “ProductID” was not found.”
  • Add a route via “Topic Management” -> “Got to step” and select the destination step where the topic asks for the Product ID.
SAP & Teams Integration with Copilot Studio and Generative AI (49)SAP & Teams Integration with Copilot Studio and Generative AI (50)

Save again.

4.5. “Parse value” the Flow Output

The flow returns a JSON elopement that contains all product details. These must be parsed and assigned to a Table variable.

SAP & Teams Integration with Copilot Studio and Generative AI (51)

Select the Output from the Flow as Input.

SAP & Teams Integration with Copilot Studio and Generative AI (52)

As data type pick “From sample data”

SAP & Teams Integration with Copilot Studio and Generative AI (53)

Get the sample data from a flow test run with a known Product ID

SAP & Teams Integration with Copilot Studio and Generative AI (54)

You can copy/paste the sample data from the successful flow run. Either get it in the output of respond to copilot or take it from the Odata query output

SAP & Teams Integration with Copilot Studio and Generative AI (55)SAP & Teams Integration with Copilot Studio and Generative AI (56)

Enter the sample data to create the schema

SAP & Teams Integration with Copilot Studio and Generative AI (57)

SAP & Teams Integration with Copilot Studio and Generative AI (58)

Save the result into a new variable called Product.

SAP & Teams Integration with Copilot Studio and Generative AI (59)

4.6. Adaptive Card with SAP Data

Create a Send message node

SAP & Teams Integration with Copilot Studio and Generative AI (60)

Send the message as adaptive card

SAP & Teams Integration with Copilot Studio and Generative AI (61)

Enter the following draft adaptive card JSON to start with:

https://techcommunity.microsoft.com/gxcuf89792/attachments/gxcuf89792/SAPApplications/1042.22/1/sap_...

The card will look like this:

SAP & Teams Integration with Copilot Studio and Generative AI (62)

As a next step make the adaptive card dynamically showing the values from the Product Table. For this you must switch to Formula:

SAP & Teams Integration with Copilot Studio and Generative AI (63)

This will change the format slightly removing all the double quotes of the variable names.

Edit the last Entry from

"text": "${Topic.ProductID}"

To:

text: Topic.ProductID

Save and test again. Now you have an adaptive card showing dynamically a value returned by the flow:

SAP & Teams Integration with Copilot Studio and Generative AI (64)

As a next step add the full code from the link below to show all the SAP information in the adaptive card:

https://techcommunity.microsoft.com/gxcuf89792/attachments/gxcuf89792/SAPApplications/1042.22/2/sap_...

Note: You can create your own design and adaptive cards JSON code here: https://adaptivecards.io/designer/

Save and run another test:

SAP & Teams Integration with Copilot Studio and Generative AI (65)

To advance the copilot capabilities even further, you can enable changing product information in SAP. Therefore, the following steps must be done:

  • Initiate actions from adaptive cards by using the “Ask with adaptive card” node.
  • Create another flow to update data and use the update entity in the SAP OData connector.
  • Configure more additional variables handling in the topic
  • Update the Copilot to use the “update” flow.

5.1. Add “Ask with adaptive card” Node

Add a node “Ask with adaptive card”

See also:

Ask with Adaptive Cards - Microsoft Copilot Studio | Microsoft Learn
SAP & Teams Integration with Copilot Studio and Generative AI (66)

Take the code from the previously created adaptive card.

Add the action “Submit” at the end of the AC code.

,

actions: [

{

type: "Action.Submit",

title: "Submit Changes",

horizontalAlignment: "Center",

data: {

action: "submitProductChanges"

}

}

]

Save this adaptive card.

Delete the previously created AC as we don’t need it any longer.
SAP & Teams Integration with Copilot Studio and Generative AI (67)

When you get the error about missing properties, meaning the Adaptive Card editor did not automatically create the output structure you need to edit the schema manually.

Edit schema on the bottom right.

SAP & Teams Integration with Copilot Studio and Generative AI (68)

Enter the variable types into the schema binding:

kind: Record

properties:

action: String

actionSubmitId: String

currencyCode: String

description: String

price: Number

productName: String

SAP & Teams Integration with Copilot Studio and Generative AI (69)

Confirm this, save the topic and test again

SAP & Teams Integration with Copilot Studio and Generative AI (70)

5.2. Create “Update SAP Product Details” Flow

The final step is to run another flow that will update the product information in SAP.

Create another flow with the same copy procedure as before.

SAP & Teams Integration with Copilot Studio and Generative AI (71)

Refresh the page and “Turn on” the flow.

SAP & Teams Integration with Copilot Studio and Generative AI (72)

At second position add an action “SAP OData Connector” with the Entity “Update OData entity”.

Set the ProductID Input as shown:

SAP & Teams Integration with Copilot Studio and Generative AI (73)

In the advanced parameters mark those where we want to allow updates. These are Name, Description, Price and CurrencyCode:

SAP & Teams Integration with Copilot Studio and Generative AI (74)

Add the additionally required Flow Parameters. (Note: Price is a number):

SAP & Teams Integration with Copilot Studio and Generative AI (75)

Update the “Update Odata entity” Actions with the relevant variables in the corresponding fields:

SAP & Teams Integration with Copilot Studio and Generative AI (76)

Update the last action in the flow with the success message:

SAP & Teams Integration with Copilot Studio and Generative AI (77)

5.3. Update the Copilot Topic to call the update flow

After the adaptive card node add the node “Call an action” and pick the “Update SAP product detail” flow:

SAP & Teams Integration with Copilot Studio and Generative AI (78)

Open the “variable” pane and activate the required variables.

SAP & Teams Integration with Copilot Studio and Generative AI (79)

Fill in the variables in the respective input fields.

SAP & Teams Integration with Copilot Studio and Generative AI (80)

The last step is to send the message about the successful product information update:

SAP & Teams Integration with Copilot Studio and Generative AI (81)

Save and test in the copilot test pane.

SAP & Teams Integration with Copilot Studio and Generative AI (82)

When all works fine you can publish again and test the functionality in MS Teams. You’ll need to trigger the Copilot update in MS Teams with the “Start over” trigger phrase.

SAP & Teams Integration with Copilot Studio and Generative AI (83)

We hope you enjoyed following along this blog and that you will find it useful for your own SAP projects.

With the steps outlined in this blog, you are now equipped to fully leverage the integration of SAP with Microsoft Teams using Copilot Studio and Generative AI. You can use any available SAP OData service or even create your own, enabling seamless access and management of SAP data within Teams. This integration not only simplifies workflows but also transforms simple, repetitive tasks into significant value-adding activities for users.

You can enable even those users with little or no SAP know-how to complete SAP-specific tasks, thanks to the built-in Generative AI feature that can always help and answer every question. As you explore and implement these capabilities, you'll discover new opportunities to enhance productivity and drive innovation in your SAP related digital workspace.

The future of integrated, AI-powered collaboration is here, and it hopefully starts with your next SAP and Teams integration scenario.

sap_product_adaptive_card.zip

SAP & Teams Integration with Copilot Studio and Generative AI (2024)
Top Articles
OSRS Money Making - The Ultimate Guide [P2P] (2024)
Great Clips Hpurs
Spasa Parish
The Machine 2023 Showtimes Near Habersham Hills Cinemas
Gilbert Public Schools Infinite Campus
Rentals for rent in Maastricht
159R Bus Schedule Pdf
11 Best Sites Like The Chive For Funny Pictures and Memes
Finger Lakes 1 Police Beat
Craigslist Pets Huntsville Alabama
Paulette Goddard | American Actress, Modern Times, Charlie Chaplin
Red Dead Redemption 2 Legendary Fish Locations Guide (“A Fisher of Fish”)
‘An affront to the memories of British sailors’: the lies that sank Hollywood’s sub thriller U-571
Haverhill, MA Obituaries | Driscoll Funeral Home and Cremation Service
Rogers Breece Obituaries
Ella And David Steve Strange
Ems Isd Skyward Family Access
Elektrische Arbeit W (Kilowattstunden kWh Strompreis Berechnen Berechnung)
Omni Id Portal Waconia
Banned in NYC: Airbnb One Year Later
Four-Legged Friday: Meet Tuscaloosa's Adoptable All-Stars Cub & Pickle
Patriot Ledger Obits Today
Harvestella Sprinkler Lvl 2
Storm Prediction Center Convective Outlook
Experience the Convenience of Po Box 790010 St Louis Mo
modelo julia - PLAYBOARD
Poker News Views Gossip
Abby's Caribbean Cafe
Joanna Gaines Reveals Who Bought the 'Fixer Upper' Lake House and Her Favorite Features of the Milestone Project
Pull And Pay Middletown Ohio
Navy Qrs Supervisor Answers
Trade Chart Dave Richard
Sweeterthanolives
How to get tink dissipator coil? - Dish De
Lincoln Financial Field Section 110
1084 Sadie Ridge Road, Clermont, FL 34715 - MLS# O6240905 - Coldwell Banker
Kino am Raschplatz - Vorschau
Classic Buttermilk Pancakes
Pick N Pull Near Me [Locator Map + Guide + FAQ]
'I want to be the oldest Miss Universe winner - at 31'
Gun Mayhem Watchdocumentaries
Ice Hockey Dboard
Infinity Pool Showtimes Near Maya Cinemas Bakersfield
Dermpathdiagnostics Com Pay Invoice
A look back at the history of the Capital One Tower
Alvin Isd Ixl
Maria Butina Bikini
Busted Newspaper Zapata Tx
Rubrankings Austin
2045 Union Ave SE, Grand Rapids, MI 49507 | Estately 🧡 | MLS# 24048395
Upgrading Fedora Linux to a New Release
Latest Posts
Article information

Author: Msgr. Refugio Daniel

Last Updated:

Views: 6190

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.