/Azure_OpenAI_powered_SAP-Self-Services

Azure OpenAI-powered chatbot for SAP users, enabling account verification, job status checks, as well as providing maintenance schedule communications.

Azure OpenAI powered SAP Self-Services

Azure OpenAI-powered chatbot for SAP users, enabling account verification, job status checks, as well as providing maintenance schedule communications.

Unlike traditional bots, where users are constrained to rigid, predefined pathways, this AI assistant provides the flexibility to interact in natural language. It mimics a conversational experience like interacting with a human, making it intuitive and user-friendly. Users can freely express their queries and commands in everyday language, eliminating the need to understand complex code or specific command language.

No more clicking through endless menus or decoding tech jargon. Just type what you need, like checking if your account is locked, finding out the status of a job, or schedule a system maintenance. Just write in plain English in your natural language. It’s as easy as chatting with a friend - quick, straightforward, and no hassle!

Architecture

High Level Process

Greetings in Teams

Greetings

Prerequesites

  1. Power Platform
  2. Azure Subscription
  3. Azure OpenAI Service
  4. On-Premises Data Gateway
  5. SAP System

Setup

Azure OpenAI Service

On-Premises Data Gateway

Setup the Power Automate Flow (Flow)

Adapt the HTTP Connector in the Flow

  • Get your Azure OpenAI URL and API-Key from the Azure Open AI Service Chat playground.

    Get URI and KEY

  • URI example: https://[your endpoint].openai.azure.com/openai/deployments/[deployed model name]]/chat/completions?api-version=2023-07-01-preview

  • Edit the Flow

  • Enter the URI and KEY in the respective fields of the HTTP Connector.

    Enter URI and KEY in HTTP Connector

  • For now you can enter this directly in clear text. For later production use it's recommended to configure these as secrets and put references to the secrets like seen in the screen shot.

Adapt SAP ERP and M365 Connectors in the Flow

  • In the designer overview you'll see the connections showing errors. These require an update so that it will work in your environment

  • Change the connection references in below steps or delete those not required (e.g. Sharepoint list entry). This is needed because the flow was imported from another environment.

    • Get my profile (V2)
    • Call SAP function (V2) (For case A, B & C)
    • Send an email (V2)
    • Post card in chat or channel
    • Create item in Sharepoint list (or delete this step if not needed)

    Change Connections

  • Change all 3 SAP ERP Connectors

  • Update the JSON connection definition in "SAP System" field to match your SAP system(s).

  • For simplicity there is only one SID per case in the flow.

  • Please follow this documentation to handle mutliple SAP SIDs in each case: Multiple SIDs

    Change SAP ERP

  • Also update the connection to your Data Gateway in the "Change connection reference" link

    Change SAP ERP

  • Now you can finally save the flow

  • And turn on the flow

Setup the Power Virtual Agent (PVA)

  • Login to: https://web.powerva.microsoft.com/ and create a new bot.

    Create Bot Step 1

    Create Bot Step 2

  • In the fallback topic paste the code from the provided fallback.yaml file.

  • Download the fallback topic code here: fallback.yaml

  • Open the fallback topic in your bot

    Fallback Topic

  • Open the code editor and enter the code via copy/paste.

    Fallback Topic

  • The last step is to configure your personal bot greeting message into the following 2 topics:

    • Greetings
    • Reset Conversation

    Example:

    I’m an AI assistant that helps you with SAP activities.

    I can:

    A.) Check if your user account exists, determine the roles assigned, and verify if it is locked.

    B.) Check the status of an SAP job.

    C.) Communicate planned maintenance schedules.

    What would you like me to do?

Test & Publish the Bot

  • Test the Bot:

    Test

    Test

  • When OK publish the bot:

    Publish

  • Activate and Open the Bot in Teams

    Publish

  • Open the Bot in Teams and test:

    Publish

Troubleshooting

  • In case of errors most likely the flow failed.

  • The logs of the flow run provide helpful error messages.

    Troubleshooting 1

  • Example with a timeout error:

    Troubleshooting 2

Contributing

Contributions to enhance the capabilities are welcome.

License

This project is licensed under the MIT License.

Disclaimer

THE CONTENT OF THIS REPOSITORY IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.