Joule AI Custom Solution for Material Shortage and Fulfillment
Share

A few weeks ago, I had the opportunity to participate in a hackathon to build a Joule AI solution that addresses material shortages in an expedited manner. This can help Inventory Management users save time and money.

I am sure many SAP customers have similar requirements, and I want to share my experience here so it can be beneficial to others.

Problem Statement: IM users have to manually check shortages in SAP applications and create purchase requisitions if there is any shortage, to make sure production runs smoothly. Users perform this activity in the backend S/4HANA system.

Solution Architecture & Design: I built the artifacts below as part of this Joule project to address the requirement.

  1. Actions to get material shortages and create purchase requisitions.
  2. Skills to call these APIs and perform tasks.
  3. An agent that can process user requests.
  4. A test environment to deploy and test the project.

A destination to the backend system already exists to leverage the APIs and to create and test actions.

Actions built in SAP Build:

npurnachanderrao_0-1777925568429.png

The action below was created to read material shortages from the backend by leveraging the Material Coverage API.

I also created a material input variable to filter the API using the material number. You can adjust the input and output as needed and test them in this section.

npurnachanderrao_1-1777925568439.png

A condition is applied to map the user input material to the API material attribute in the C_MaterialCoverage entity.

npurnachanderrao_2-1777925568453.png

npurnachanderrao_3-1777925568465.png

Like the Material Coverage API, I configured another action to create a purchase requisition in the backend system. Please remember to enable CSRF protection (if applicable) for that POST API call.

npurnachanderrao_4-1777925568474.png

Now let’s go into the Joule Studio to build the Joule project. As you can see from the screenshot below, a couple of Joule skills and an agent have been created.

npurnachanderrao_5-1777925568479.png

This Joule skill is responsible for creating purchase requisition in the backend system.

Joule skills can also be consumed directly without an agent. You can enable or disable the functionality, as highlighted below.

npurnachanderrao_6-1777925568486.png

These are the minimum inputs required to create a purchase requisition. Of course, it depends on how the backend is configured for a particular document type.

npurnachanderrao_7-1777925568493.png

The purchase requisition number is the output from the skill.

npurnachanderrao_8-1777925568501.png

Everything we’ve seen in the screenshots above is related to the Trigger part.

Below is the step where the corresponding Purchase Requisition action has been configured. A backend destination variable is also configured to create the purchase requisition in the corresponding backend system.

There are multiple other options available to use as well, like Process, Condition, etc.

npurnachanderrao_9-1777925568507.png

The Trigger inputs are mapped to the Action inputs.

npurnachanderrao_10-1777925568514.png

This is the output from the Action.

npurnachanderrao_11-1777925568527.png

At the end the Action result is mapped to the Purchase Requisition variable which we are interested in.

npurnachanderrao_12-1777925568532.png

Like the Purchase requisition skill, Material Shortage skill is also configured.

npurnachanderrao_13-1777925568537.png

npurnachanderrao_14-1777925568541.png

npurnachanderrao_15-1777925568546.png

npurnachanderrao_16-1777925568551.png

npurnachanderrao_17-1777925568556.png

Now it’s time to configure the agent.

It’s important to set the expertise and instructions so the agent understands how to behave.

npurnachanderrao_18-1777925568562.png

There are multiple LLM providers available in the Model Settings: OpenAI, Anthropic, Google, and Mistral AI.

You can select any provider and the LLM they offer for response generation and planning.

npurnachanderrao_19-1777925568571.png

Once everything is done, release and deploy the application.

A new test environment has been created under Control Tower to deploy and test this project.

npurnachanderrao_20-1777925568577.png

npurnachanderrao_21-1777925568581.png

To launch the agent, navigate to the Joule tab and click Launch.

npurnachanderrao_22-1777925568588.png

It’s testing time.

I entered a prompt to pull the shortage information for a product. As you can see in the screenshot below, the agent responded with the shortage details. This information is pulled from the backend system.

npurnachanderrao_23-1777925568605.png

Next, I want to create a purchase requisition. The expectation was that the agent would reuse as much information as possible from the previous step and ask questions only if additional input was required.

As expected, the agent understood the request and figured out that some inputs were still missing to create the purchase requisition. It asked for those details to proceed.

npurnachanderrao_24-1777925568639.png

Here you go. The requisition has been created in the backend.

You can check the log by clicking the highlighted button top right corner.

npurnachanderrao_25-1777925568662.png

Conclusion: The Joule AI solution is flexible enough to understand user requests and process them. Users don’t have to navigate through multiple screens to complete the job.

AI solutions are powerful because they make many processes simple and easy. They can support different scenarios depending on how the agent is configured. There are J4D, J4C, and other tools that can help developers, consultants, and businesses save a lot of time and add value.

Key Challenges: I found that date mapping is not easy in the formula editor, since the skill inputs are always strings.

Error handling is also challenging. The skill doesn’t provide a way to map action/API errors so the agent can guide the user to resolve the issue in the back end. For example: The Purchasing Organization doesn’t exist or authorization errors.

SAP Joule Studio is evolving, and I hope these gaps will be addressed soon.

Please feel free to comment if you have any questions. l will try to answer as much as I can.

Thank you!

 

  Read More Technology Blog Posts by Members articles 

#abap

By ali

Leave a Reply