As of early 2025, the optimal approach for professional developers working with Generative AI involves creating project skeletons that cover general requirements, followed by incremental enhancements. SAP Build Code Joule expands on this practice with multi-agent support, allowing developers to use a single prompt to engage specialized agents for various tasks. By coordinating these agents, Joule creates more comprehensive project foundations, thereby streamlining the development process. This approach enables developers to focus more on refining and customizing their applications, improving productivity and efficiency.
To align with these best practices for Build Code CAP developers, we've begun supporting more complex requirements for initial CAP application generation.
Note: If you're more used to the previous data model generation process, you can use a newly introduced command specifically for this purpose: /cap-gen-model.
Let's walk through the end-to-end flow to see these improvements in detail.
1. Create Project
Create a new Build Code Full-Stack Application from SAP Build Lobby via this navigation path: Create -> Build an Application -> SAP Build Code -> Full-Stack Application.
Note: Choose the 'Node' item from the 'Development Stack' dropdown box to see the new improvements.
Once the status of the newly created application changes from 'Pending Creation' to a normal status, click the application name to load it into the Build Code development environment. By default, the Storyboard will open automatically, and you can access the Build Code Joule panel from the left sidebar.
2. Initialize CAP Application
Select the /cap-gen-app command. You'll notice a new example prompt added for the capex application. You can view the full content in the Joule input field once it's selected.
Note:
For backward compatibility, SAP Build Code Joule maintains the previous functionality alongside the new multi-agent approach. You can still use the simpler generation process by typing the /cap-gen-app command without a detailed prompt, which triggers the original single-agent generation. This short-term solution allows you to choose between a comprehensive multi-agent approach for complex applications and a quicker, simpler generation for basic needs. Keep in mind that the richness of your input directly influences the comprehensiveness of the generated output.
Now, instead of showing the generated result for a simple request (only data model-related), an execution plan is displayed. The complex requirements are broken down into subtasks and we apply our best practices. As an end-user, you can review the improved user requirements and enhance them manually (via the pencil action button). This follows a popular human-in-the-loop pattern for working with Generative AI. We believe it's always easier for users to improve requirements using human language rather than adjusting generated code, which may be less familiar.
Once the improved requirements in steps are satisfactory, you can trigger the generation step-by-step manually.
Let's start with step 1 to generate the CAP data model.
After executing step 1, step 2 becomes available. You can check the generated content in the bottom 'Staging Files' UI block. Click any item to open the file content in Build Code.
Note:
- The staging files are in a temporary folder for review purposes only. You can manually change them if you're certain there won't be unexpected consequences for the following steps.
- You can rerun a step if you encounter any failures or are unsatisfied with the existing content.
Before running step 2 for sample data, let's improve it further to make the sample data more specific. Edit it, save it, and run it.
Then, proceed to step 3 for custom application logic.
You'll see two new files generated per the requirement for this step:
- The 'service.js' file: mapping configuration for the application logic handler and service entity events.
- The 'before-asserts-create.js' file: new logic attached to the entity 'Asserts' create event, triggered before every assert entity creation.
Background info on how Build Code Joule determines the application logic configuration:
- Validation checking logic: typically attached to the entity 'CREATE' or 'UPDATE' event in the 'before' phase.
- Entity property value calculation logic: typically attached to the entity 'READ' event in the 'after' phase.
- Custom service logic for a CAP action or function: no standard entity event, typically attached to the 'on' phase.
Note:
- Describe the app logic requirement more specifically to align with the above guidelines.
- You can still change the configuration later (after accepting the staging files) using the CAP application logic editor and adjust the logic content using the Build Code Joule command /cap-app-logic.
When all steps are executed successfully, the 'Accept' button becomes visible under the staging files. Accept the content into your working project if you're satisfied with the staging content.
The Storyboard will refresh to reflect all updated aspects: data model, sample data, service entities, and the application logic attached to the service entity.
You can switch to the detail view of the Storyboard for a better overview of each entity.
3. Preview the Application
After initializing the application according to the business requirements, it's time to preview it. Click the green triangle button in the top-right corner to launch it.
The CAP application will launch in local mode with sample data in a new window.
Use the 'View as table' button to check the runtime content for each entity, e.g., the 'Asserts' entity.
Click the 'Create' button to verify the application logic and see if there's a warning when the cost is exceeded. Test with sample input values.
You should see a warning message for a negative use case test and successful creation for a positive use case test.
If the application logic runs as expected, great! However, you may sometimes need to troubleshoot unexpected code issues (including data model, sample data, and FE UI annotations), debug, and ask Build Code Joule to enhance the code or make manual changes.
A Useful Tip: To improve logic codes using Build Code Joule with additional runtime data structure as the reference.
Additional info: In this flow, the cost 'Currency' field is not covered. If you click the value help button beside the cost value, you may find it empty.
Try solving this via manual changes or using Data Editor & Build Code Joule to enhance it. Here's a sample content for reference (/db/data/sap.common-Currencies.csv)
name;descr;code;symbol;minorUnit
US Dollar;United States Dollar;USD;$;2
Euro;Euro Member Countries;EUR;€;2
Japanese Yen;Japan Yen;JPY;¥;0
British Pound;United Kingdom Pound;GBP;£;2
Australian Dollar;Australia Dollar;AUD;$;2
Once everything looks good, return to Build Code and stop the preview.
As mentioned in the beginning, working with Generative AI on top of initially generated artifacts from Build Code Joule provides a good starting point for further improvements to meet additional requirements. Use Build Code Joule via available commands or visual productivity tools for further changes.
4. Deploy the Application
Finally, when the project is ready for deployment, navigate to the Task Explorer to deploy this app to BTP.
You'll be able to access this new CAP service app using a new BTP deployed URL.
Note:
- There's no 'View as table' action button for the deployed application, as it's only for local development purposes.
- You need create FE (or MDK) UI applications for the service entities separately.
P.S.
The SAP Build Code Test Drive tutorial has been updated to showcase this latest feature.
Summary
We hope you now have a better understanding of our latest improvements to CAP application initial generation and how it can streamline your development work. In the future, we plan to extend similar support to additional generation scenarios.
Enjoy coding with Build Code Joule assistant!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.