Looking to enhance your SAP BAS development workflow without relying (or paying) for SAP Joule? In this article I’ll share how you can connect “external” LLMs into your SAP Business Application Studio environment - and help you generate those overly complex annotation files for Fiori Elements and get explanations to code from sample repositories.
Cursor AI connecting to BAS
Cursor AI is an intelligent coding assistant and IDE that combines large language models with traditional development tools. It offers code completion, explanation, and refactoring while maintaining a familiar VS Code-like interface that developers love. Unlike GitHub Copilot, it provides a richer development experience with additional tools for controlling the development process.
Joule's functionality is limited within a BAS trial account or SAP Build Code service—it's only available in the AWS Virginia Data Center (US10), with capped usage. Joule works through specific commands for distinct tasks, such as generating CDS entities or adding application logic.
Example of Joule in Context
This discovery center mission shows how to build a CAP application using Joule. https://developers.sap.com/tutorials/build-code-test-drive.html
Here's how to leverage Cursor AI as a powerful alternative LLM for your development environment—getting you up and running quickly, even with a trial account.
The setup is straightforward and requires just a few prerequisites:
In SAP Build Lobby, create a new application by cloning this git repository: https://github.com/SAP-samples/cap-sflight
Once your BAS application has started, open the project folder and issue the following commands:
If all has gone well you should see the application start and you can click on the link generated to view the standard application:
SAP SFLIGHT CAP running
First thing is to determine the URL of your BAS instance, you can determine that looking at the URL of the application it should look something like this: https://vmg.us10cf.applicationstudio.cloud.sap/
Now open Cursor and make sure you have the extension installed:
Cursor with BAS installed
Open the command palette and search for Business Application Studio Desktop Client and select "Connect Landscape" button and enter your BAS instance URL.
Command palette in Cursor AI
Next click the login button on the right of the landscape you added (make sure you have the Tamper Monkey script installed).
Script opens Cursor instead of VS Code
Now you should be able to open the desktop by clicking on the right hand column of the landscape. You have now connected remotely to your BAS instance, open the project folder and you and can start using the power of Cursor.
In order to see the AI options, open the panel in the top right of the application:
AI Panel in Cursor
Cursor AI offers Chat and Composer as two distinct AI features designed for different coding tasks:
Now you can ask questions about the project and get coding recommendations:
Composer providing insight into CAP project
Here is an example of a prompt to adjust the entity structure, with the result of what it will change in the project files:
Code Change Suggestions
When you issue a command like CDS watch, toggle back to your BAS (browser session) and open the link from there to get a preview of your changes (it is not possible to run that locally).
It is also possible to change the LLM that Cursor uses, we have added our own API keys from the LLM providers in Cursor settings.
Like all AI tools you need to be careful with the suggestions, I would suggest regularly committing changes via GIT so you can easily roll back when the coding starts going in the wrong direction.
Happy coding from the team at VMG Labs.