Note: This blog serves as a technical walkthrough for the Automatic Service Order creation with SAP Build Process Automation and Generative AI blog.
Our solution employs SAP Build Process Automation to log email data and attachments.
Image 1: SAP Build Process Automation workflow
Essentially, the process automation is designed to monitor a dedicated inbox for service order requests sent by customers. Upon detecting a new service order request, it performs these actions:
Following the processing of a request, the automation system continues to scan the inbox for additional emails. This iterative process repeats, ensuring no request is overlooked, and ceases only when there are no more relevant emails to process.
The custom script below shows an example of how you can package your payload to send over to the web service:
Image 2: Custom script within the automated workflow
For a more in-depth example of developing a custom process automation workflow, check out this video done by my colleague here.
For your reference, the code for this custom flask web service can be found in this Github repository link,
Upon receiving the JSON body from the above process automation, this custom Flask web service will then process the JSON body and post the desired outcome in JSON format into the S/4HANA system via two different API calls, which will be detailed below.
This web service makes use of the SAP AI Core, allowing us to utilize a variety of generative AI models in the Generative AI Hub.
For our solution, we thought that it was necessary to use two different AI models:
Needless to say, these two models integrated seamlessly with our solution.
This is an example of a service order request mail sent in by a customer:
Image 3: Example service order request email
When handling a service order request sent by a customer, it's crucial to extract key details, such as the purchase date, model number, the problem as described by the customer, and the customer's contact information. The lack of uniformity in customer emails makes it challenging to use traditional methods like Regex for keyword extraction. This is where artificial intelligence becomes invaluable. It excels in understanding diverse text inputs and identifying essential information without the need for predefined patterns.
From a single email, AI enables us to accurately extract vital data, including:
Moreover, AI can leverage this information to generate a comprehensive problem description. When combined with image processing capabilities, this facilitates the creation of a detailed JSON payload.
This payload is then submitted to the S/4HANA Cloud, where the service order is generated (detailed at the bottom section of this blog).
For example, the following problem description is generated by AI (after passing to it the context of the mail and the images descriptions as well):
The customer has requested a service order for the following issue: damage to their shear, rendering it unusable, specifically a broken and detached handle grip, and a dislodged spring mechanism. The shear also began rusting within a month of use despite being advertised as waterproof. This damage considerably impacts the customer's ability to use the shear for its intended purpose. The customer mentioned that the shear was purchased on 27th December 2023, with the model number XKU00145. Given the unexpected nature of the damage and the fact that the shear should still be under warranty, the customer expects help in rectifying this situation through repair or replacement. The customer has also attached images documenting the specific damage (0987865.jpg). The image shows a pair of separated garden shears, a detached and possibly rusted spring, and signs of corrosion and wear on the metal parts. Due to these damages, the shears are not functional and appear to need repair or replacement to be usable again. The customer's contact number is +65 91112222.
The above customer sends in an email with the following image attachment:
Image 4: Example of an image attachment (take note of the file name)
Image 5: Example of an image attachment
The following description of the above image was generated using LLaVA-1.6:
The image shows a pair of garden shears that appear to be broken. The tool is meant to be a single piece, but it has been separated into two parts, indicating a failure. Specifically, the shears' handles have been detached from each other, and a spring which is likely supposed to provide tension for the pruning action is also detached and appears to be rusted. The metal parts of the tool show signs of corrosion and wear. Due to these damages, the shears are not functional in their current state and would require repair or replacement to be usable again.
Additionally, it renamed the file from 0987865.jpg to BrokenShears_RoronoaZoro_20240228213047.jpg.
Notice how a short description of the problem, the customer’s name, and a timestamp is concatenated to make the filename unique and easily identifiable:
Image 6: Renaming of image attachment(s)
Also, multiple image attachments are also supported.
All the above data is then processed and passed on into a JSON payload (hint: we also used AI to format our JSON body😉, think adhering to maxLength text fields and potential loopholes that can be solved using AI), which is then submitted to the S/4HANA system through two separate APIs:
As the name describes, the Service Order Creation API enables us to create service orders without having to manually create it on the S/4HANA system.
The Attachments API enables us to latch onto the business object (which is the service order created above), and uploads the images into the same service order. I have included the link above to both the API references. The APIs require CSRF tokens to be called, therefore a GET precedes every POST. The business object type to be used in the attachments API is BUS2000116.
The web service then passes the following example JSON payload into the S/4HANA system via the service creation API:
Image 7: Example of the Service Order API JSON payload
The service order is successfully created in the S/4HANA system!
The below image shows an excerpt of the service order:
Image 8: An excerpt of the service order (Note that not the full service order is shown above, due to its large content)
Of course, if any of the fields are not filled in properly or if its properties are not respected, then the service creation will fail. I encourage you to read up the API reference for both the service order and attachments before getting started.
Image 10: Solution architecture for automation scenario
If you’re interested in a high level overview of this solution, you can visit this blog. Also, if you're interested in exploring solutions like this or wish to learn more, feel free to reach out to me.
SAP Build Process Automation
SAP AI Core
SAP AI Core service guide
Generative AI @ SAP
Service Order documentation
Generative AI hub sdk
Service Order Creation API (OData v2)
Image Attachments API (OData v2)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
15 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |