Joule in SAP Build Code
Last week at SAP TechEd 2023, the stage was set for the introduction of SAP Build Code, a solution designed to streamline the entire lifecycle of business applications. SAP Build Code is a turn-key environment for coding, testing, integrating, and managing applications by bringing together key design time, runtime services and tools in one single offering.
SAP Build Code combines the development environment from SAP Business Application Studio with the most essential services and SDKs on SAP Business Technology Platform (BTP). The objective is to significantly enhance the development experience, boost efficiency, and supercharge productivity. For more information, please see the announcement blog.
One way to supercharge developer productivity is utilizing Generative AI. With SAP Build Code developers can build rapidly using AI code generation with Joule copilot, including generating application logic from natural language descriptions.
In this blog, you will discover the revolution of regular development activities, with a particular focus on enhancing the development process for SAP Cloud Application Programming Model (CAP) projects.
Note: As of now, Joule is exclusively available for customers taking part in the SAP Build Code & Joule preview program and will be finally available as an add-on to SAP Build Code.
Let us build a customer loyalty application that can calculate and store reward points for customers based on their purchases. The purchase points are one tenth of the purchase value and are tracked for each customer. This is recorded along with basic contact data about the customer such as name, total points, total purchase value, number of purchases, and total points redeemed.
When you create a new project `lcapCustomerLoyalty` from Build Code lobby, the Business Application Studio will get launched with the Storyboard viewer opened.
To guide developers to use the Generative AI features more efficiently within Business Application Studio, a new guide `Generative AI-Powered Development` has been introduced into the Guide Center panel. So far, we support 4 main use cases that help you develop your application quickly.
Joule is activated by pressing the `Open Joule` button within the guide.
Besides the normal approach of manually modeling the data model with the CDS (Core Data Services) graphical modeler tool within Business Application Studio, this time we could ask Joule to generate it using a pure natural language prompt.
Typically, the response fully respecting the requirements will get returned, and it can be accepted directly to the working project, just by pressing the `Accept` button on the top-right corner of the code block within the response content. Storyboard will get refreshed automatically to reflect the newly generated result.
So, you can see that Joule in Business Application Studio with SAP Build Code not only generates code but also supports the visual modelers in SAP Business Application Studio, allowing users to continue using the existing visual editors.
Besides the generated data model and data service, contextual sample data also gets initialized based on the user’s prompt.
In addition, the UI annotations were also generated. This means that your application is ready, and you can do a quick preview for the generated content using the default Fiori Element preview application. For example, in this case with the support on association entity and date type input.
If you think the result is not good enough, you can also press the `Regenerate` button to see a different result with the same user prompt. As you may be aware, Joule does not consistently produce identical results. Instead, it often introduces slight variations to the generated output.
Or you can still refine your text by pressing the `Pencil` button beside the initial text and resend it.
Within the graphical modeler editor, first select the service entity `Purchase`, and then press the `Add Logic` context menu.
Provide necessary information for the newly created application logic in natural language.
Map the new created application logic to standard CAP event as below within the Business Application Studio Application Logic editor.
Once the configuration is ready, the `Open Code Editor` button will be available to use. Choose `Application Logic AI-enabled` item to ask Joule again for the custom logic implementation.
We could provide more detailed information to Joule for the generation, like below.
Joule returns a response based on the requirements. And once you press the `Accept` button, the corresponding file content will be updated directly.
So, you see, it is a chat style conversation, all the history of your chat messages are sent along with the necessary project context information to the Generative AI model to generate the responses. However, when you think the history would be misleading, or the conversation has become too long, please reset the current conversation by pressing the panel top-right corner button. Then you could start your conversation from scratch once again.
Besides this, you can use the “Error Check” button to directly open the relevant log panel, such as `DEBUG CONSOLE`, to get the runtime errors. You can then copy the runtime error into Joule and Joule will generate an improved result for you.
In addition, besides the above shown scenarios, we also support the improvement on the existing sample data, and the unit test generation for the corresponding application logic. They all work similarly in this interactive chat style.
Leveraging Joule in the development environment of SAP Build Code, is just like having an AI assistant who knows your business context and the latest SAP technology sitting beside you and happy to give you help at any time. While it may not deliver perfect results consistently, it provides a solid starting point and opportunities for learning. We hope you enjoy its benefits and seamlessly integrate it into your work process.
If this has you excited, we have many more exciting features in store for you in 2024.
Drop us an email at SAPBusinessApplicationStudio@sap.com or comment on this post to talk to us regarding all things SAP Business Application Studio.
Until next time, happy coding!