logo

Are you need IT Support Engineer? Free Consultant

Hands-on Tutorial: Vibe coding SAP HANA Cloud Mach…

  • By sujay
  • 18/06/2026
  • 3 Views

Have a Large Language Model write the Machine Learning code for you next project!

Sit back and watch the SAP Business Application Studio (BAS) use Anthropic Claude to create Jupyter Notebooks and write the Python code to trigger the Predictive Analysis Library in SAP HANA Cloud (or SAP Datasphere). This example uses Claude, but there is a long list of models to choose from through SAP AI Core. In this tutorial we go through a time-series forecast, but that's just an example, you can use this ability to vibe code in BAS for all sorts of requirements.

It's fantastic to see how the code is written automatically, and how good the code is! But to keep it real, work with that automatically created code as if it had been written by a human intern. Inspect the code to ensure it does what you want it to do.

Big thanks go to @sherwin_emami for introducing me to Cline and for showing me the ropes of vibe coding in BAS!

 

The architecture centers around the SAP Business Application Studio, where you can already do you Python scripting in a Jupyter Notebook by hand. 

The coding agent Cline is installed as extension in BAS. Cline connects to SAP AI Core to integrate the Large Language Models (LLM) that process the user requests and produce the code. You can choose which LLM you want to use. In this example we use Claude, which is hosted outside the SAP environment. Other models, i.e. from Mistral, are hosted on SAP infrastructure.

SAP HANA Cloud holds the data and Machine Learning algorithms. The same setup would also work with the SAP HANA Cloud that is embedded in SAP Datasphere.

Optionally, you can also add the Context7 MCP server to Cline to get access to additional / current software documentation.

You may have heard of the SAP Business AI Platform, which is also shown in the architecture diagram. However, here we use the same components that you know from the SAP Business Technology Platform (BTP). You can implement this scenario on any BTP environment.

 

You will need the following components to implement this blog's scenario:

  • SAP Business Application Studio, configured to run Jupyter Notebooks, see this blog
  • SAP HANA Cloud
    • configured to run the Predictive Analysis Library, see the same blog
    • with the table HOTELNIGHTS from this other blog uploaded
  • SAP AI Core, on an Extended Service Plan. SAP AI Launchpad is not needed for the vibe coding.

 

Install the Cline extension into the BAS. This should take only a few seconds.

020 Cline Install.gif

 

Then get a Service Key from your SAP AI Core instance.

030 Btp Cockpit Service Key.png

 

Continue in the Cline extension and give it access to SAP AI Core.

  • Select the option “Bring my own API key”.
  • From the “API Provider” dropdown select “SAP AI Core” and enter the values from your SAP AI Core Service Key:
    • AI Core Client ID: value of clientid
    • AI Core Client Secret: value of clientsecret
    • AI Core Base URL: value of AI_API_URL
    • AI Core Auth URL: value of url
    • AI Core Resource Group: By default the Resource Group is “default”, unless you created your own in SAP AI Core
  • Tick “Orchestration Mode”.  This makes all applicable models from SAP AI Core available, without having to deploy them first
  • Select your preferred model. Here I am going with Claude 4.7 Opus.

040 Cline Config.png

 

Click “Continue” and Cline is asking what it can do your you 

050 Cline.png

 

Use a simple task to get familiar with Cline. It's important to know the distinction between “Plan” and “Act” mode. 

Plan mode: Typically it is best to start in Plan mode. You describe what you would Cline built for you and Cline is building a plan for achieving this. This can be a discussion, which shapes how to address this task. In this phase, Cline can access files (if you grant access), but it cannot make any changes to your existing file or create new files.

Act mode: Once you are happy with the plan you can switch to the “Act” mode, in which Cline executes the plan. Here Cline can, for instance, create new files or modify existing ones.

Let's try it out!

First select the folder in which you want to work, ie “home/user/projects/hanaml”. If you are unsure about the folder, see this blog.

Make sure that Cline is in “Plan” mode (the little button below the prompt window). Check which permissions you want to give Cline. Then enter this task and Cline is creating the plan to achieve this.

Create a jupyter notebook that contains a greeting

060 Vibe Test Plan.gif

 

We are happy with the plan and want this executed. Click on the “Act” tab. You will see how Cline is going through the plan. If you are using the default permissions, you will be asked to confirm the creation of the Notebook file and indeed the file opens up!

070 Vibe Test Act.gif

 

You can run the code in the notebook. And the file is there as requested. 

080 Vibe Test Run.gif

 

Mission accomplished, the vibe coding test was successful!

 

A few hints in case this didn't work for you:

  • With Cline's default settings you will probably get a few approval requests. You need to confirm these for the process to continue.
  • These requests are not always immediately shown on screen. Check whether you need to scroll further down in the Cline window to see the latest output.
  • Sometimes Cline seems to hang. Refreshing the browser seems to fix it for me
  • Sometimes Cline opening a file results in the error “The editor could not be opened due to an unexpected error. Please consult the log for more details.”. Clicking the “Try again” usually fixes it for me.
  • You know that the “Act” mode has completed, when you see “Start New Task”.

 

Before creating code for your business, let's make Cline even more useful. Currently the Large Language Model that we are using might not know the latest documentation of the libraries that we want to use, particularly the Python package hana_ml.

A popular approach for bringing in the latest documentation is by adding Context7 to the project. There may be alternatives, but Context7 worked well for me. It can be added as MCP server both as local installation and through a remote URL. The local installation through the Cline interface didn't succeed for me, but the remote version worked very well. Funnily enough, you can just ask Cline to add the remote version itself.

Go into the “Plan” mode and request:

Add an MCP server for Context7, use the remote URL

When happy with the plan, switch to the “Act” mode. Confirm the requests if you agree. And the MCP server for Context7 should have been added.

090 Context7.Png

 

Verify this in the Cline settings. In the “MCP Servers” section under “Configure” the new MCP Server should show up. Also, below the prompt window you can see that the new MCP server is enabled and ready for use.

100 Context7 Verification.gif

 

Everything we need has been set up. Let's do something useful with this it. This blog has a step-by-step explanation for writing the code to carry out a time-series forecast in SAP HANA Cloud. Hopefully that tutorial is useful to learn how the Machine Learning works, how Python code can instruct the Predictive Analysis Library to create the forecasts, without having to extract the data. Let's put vibe coding to the test, whether it can create such code for us.

First ensure that you have the credentials.json file in your folder, as shown in the same blog.

Then ask your code assistant in “Plan” mode to create the code.

Create a new notebook called “HANA ML Time-series forecast”.  Use the details from @/credentials.json to and the hana_ml package to connect to SAP HANA Cloud. Connect to the table HOTELNIGHTS. Do not download the data. Use hana_ml to have HANA Cloud aggregate this table on the MONTH column, summarising the column HOTELNIGHTS. Use the hana_ml Package to train an AdditiveModelForecast model and predict the next 6 months. Join the actuals and the prediction in a single structure and save as table HOTELNIGHTS_FORECAST_BAS. Test the code and fix any errors. Use context7.

110 Timeseries Prompt.png

 

It is coming back with a very detailed, pretty looking plan.

120 Timeseries Plan.png

 

Click on “Act” to have it executed. Watch how Cline is going through that plan: writing, testing and potentially fixing the code. Pay attention to any Request prompts that might come up at the bottom left. Approve these if you agree. After a few minutes you should have a Notebook!

130 Timeseries Notebook.png

 

In the new Notebook, first choose your Python kernel on the top right. Then hit “Run All” to test the logic. It's looking good! But not perfect… The dates for the future months, that are predicted, are not the first day of that month.

150 Timeseries Forecast V1.Png

 

Back to the prompt , and request a change. Here I am skipping the “Plan” mode and request this directly in the “Act” mode.

Change the code so that the forecasted dates are always the first day of the month.

160 Timeseries Change.png

 

And indeed, now the months are correctly dated!

170 Timeseries Forecast V2.Png

 

As requested, the prediction is also saved to SAP HANA Cloud.

180 Timeseries Forecast Dbexplorer.png

 

It's impressive how efficient and helpful vibe coding can be! 

It can be a massive time-saver, but do remember to verify the code…

 

 

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *