Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
cancel
Showing results for 
Search instead for 
Did you mean: 
awaes59
Explorer
3,312

Introduction



In today's fast-paced business environment, companies are constantly seeking ways to improve their operations and enhance customer experience.

One emerging technology that has gained significant attention in recent months is ChatGPT, a language processing tool that enables businesses to automate customer service and support.

By integrating ChatGPT and SAP FSM, companies can unlock a host of benefits, including improved customer satisfaction, increased efficiency, and reduced costs.

In this article, we will explore the benefits of connecting ChatGPT and SAP FSM and provide examples of how businesses can leverage these technologies to streamline their operations and enhance customer experience.

 


FSM extension



SAP FSM Extensions


SAP Field Service Management (FSM) is a comprehensive solution that helps businesses manage their field service operations.

One of the key benefits of SAP FSM is its ability to be extended with custom functionality through the use of extensions. Extensions are modules that can be installed in SAP FSM to add new capabilities, automate processes, or integrate with other systems.

This flexibility enables businesses to tailor SAP FSM to their specific needs and requirements. For more information on SAP FSM extensions, you can refer to the official documentation here.

 

Connecting FSM and ChatGPT openAI APIs


To illustrate the potential of integrating ChatGPT and SAP FSM, consider a common scenario where a technician is required to complete an observation report while on site. This process can be time-consuming and challenging for technicians to provide detailed and accurate information.
Therefore, the text is often reviewed by the project manager or dispatcher to ensure it is comprehensible and complete for the final customer.

By integrating ChatGPT's natural language processing capabilities with SAP FSM's reporting functionality, the technician could write/dictate the observations on the activity, and then an extension on activity level could transcribe and summarize the text in the report. This would save time for both the technician and the project manager, resulting in a more efficient process and a more satisfactory customer experience.

 

Create an extension


The initial step in integrating ChatGPT with SAP FSM is to create a new FSM Extension. This can be achieved by downloading a "sample extension" from Github, which provides a starting point for building a custom extension.
You can find them on this link.

We'll also create a new repository on Github, and use the integrated Github functionnality "Pages" to upload the extension.

 

Adding the extension to SAP FSM


Next step is to test if our extension is correctly deployed, and add it to FSM screen. We'll add it on the right part of the Dispatching board screen.


Adding the extension


 


Using the Github pages URL



Retrieving the technician comments


Now that the extension is successfully installed, we need to retrieve all the data required to make the ChatGPT request. For that, we'll make a first call to the Activity API, then on the ServiceCall API.
This will allow us to retrieve : ServiceCall subject, Activity remark (this is where the technician comment is stored, via a custom Business rule)

Here is the code used to retrieve the data :
// Fetch Activity object
fetch(`https://${cloudHost}/api/data/v4/Activity/${activity_id}?dtos=Activity.37&account=${account}&company=${company}`, {
headers
})

.then(response => response.json())
.then(function (json) {


const activity = json.data[0].activity;

// Fetch ServiceCall object
fetch(`https://${cloudHost}/api/data/v4/ServiceCall/${activity.object.objectId}?dtos=ServiceCall.21&account=${account}&company=${company}`, {
headers
}).then(response => response.json())
.then(function (json) {

const serviceCall = json.data[0].serviceCall;
resolve(serviceCall);

})

});


helpers.js code to make Activity and ServiceCall APIs


Now that we got all the required information, the next step will be to call openAI APIs to beautify the technician comment.

 

OpenAI APIs


ChatGPT OpenAI APIs are a set of natural language processing tools offered by OpenAI that enable businesses to integrate conversational AI capabilities into their applications. These APIs can be used to generate human-like text, answer questions, and translate languages, among other things.

To call these APIs, we must first obtain an API key or token from OpenAI by creating an account on the website. The token can then be used to authenticate API requests and access the desired features. In the case of integrating ChatGPT with SAP FSM, we will use the API to enable natural language processing of technician observations.

You can refer to the official documentation here.

 

Let's make the call


This is the code we'll be using to make the request to ChatGPT API
function callOpenAI(inputText) {

// Send the request to OpenAI
fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer API KEY`,
},
body: JSON.stringify({
model: "gpt-3.5-turbo",
max_tokens: 60,
messages: [{
role: "user",
content: `Rephrase this as a mechanical engineer: ${inputText}`
}]

}),
})
.then((response) => response.json())
.then((data) => {
// Extract the generated text from the response
const generatedText = data.choices[0].message.content;

updateUI(generatedText);

})
.catch((error) => {
console.error("Error:", error);
});
}

 

Et voilà !

ChatGPT answer will be then shown on the extension outlet.

 

Final Result


Here is what is shown on the extension whenever an activity is selected on the dispatching board :


The original comment made by the field technician


Then, using the "Format GPT" button, the dispatcher is able to generate a better and cleaner version of this comment for the Final Customer :


 

Opening thoughts


In conclusion, the integration of SAP FSM and ChatGPT OpenAI APIs offers a powerful opportunity to streamline reporting processes and enhance the overall efficiency of organizations.

However, the potential for integration between these technologies extends beyond reporting alone. If you have any ideas of integration with ChatGPT, feel free to comment this post, I could make a new article about this.
2 Comments
Labels in this area