Spend Management Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
avikjuoss94
Participant
716

My initial plan was to se Boosters for Free Tier Use of SAP AI Core and SAP AI Launchpad
(Be aware- AI core and AI launchpad are not available in BTP free tier. Alas!)

Next Goal:

Build an end-to-end document AI demo that:

  1. Uploads an invoice or receipt (PDF/image)
  2. Extracts structured data using SAP Document AI API
  3. Stores the response as JSON
  4. Visualizes extracted fields in Streamlit

Architecture

[Streamlit UI] → [BTP Destination/Service Key] → [SAP Document AI API]

                                         ↓

                             [Response JSON → Results Display]

But hang on – If you are a first time user of SAP BTP, ( Most of SAP business analyst, Functional consultants, SAP managers in 2025 are right at this phase- they all have heard about BTP, knows what it is used for – but never used it hands-on ) there are too many pre requisite one after another. More interesting fact- not all of them are in a single place. You need to stitch bits and pieces to make it work. 

I researched few articles over internet even asked Walkme- but didn't get necessary answers

avikjuoss94_11-1763065841534.png

Assumption - Most of the folks who would read this article have SAP S-user ID from past interaction with SAP marketplace portal.

Note – Reference: https://developers.sap.com/tutorials/hcp-create-trial-account.html

To start with- Access SAP BTP Cockpit and create Global + Sub account under free BTP trial.

Once the signup process is complete, you can access the cockpit via https://cockpit.hanatrial.ondemand.com/trial/

avikjuoss94_0-1763064767730.png

Choose region- Either of the below- it will take up to 3 minutes to create BTP accounts.

avikjuoss94_1-1763064893290.png

This page below will display the current state of the subaccount. You can manage your subscriptions and jump into the different runtime environments. It also shows you fundamental; information of the Cloud Foundry environment, such as the API endpoint and the available spaces – SAVE it as favourite (Top right corner star icon inside SAP BTP)

You may need to navigate between Global and sub account and different nodes often.

avikjuoss94_2-1763064957379.png

A SAP BTP subaccount is best described as a workspace for development and application deployment that provides strong isolation for security, user management, and data segregation, rather than a "client" in the traditional SAP multi-client sense. 

We can have multiple sub account inside one global BTP account

avikjuoss94_3-1763065036252.png

Next step-  Run Booster method to enable SAP document service

NOTE - We do not need to Manage Entitlements Using the BTP Cockpit.
Rather we shall use booster method under Global BTP account
Go to global BTP account page- click on left panel boosters as shown below

avikjuoss94_4-1763065210780.png

scroll down – under artificial intelligence category

avikjuoss94_5-1763065299243.png

This booster helps you set up SAP Document AI in the SAP BTP cockpit.
Step by step, this booster assigns entitlements, updates your subaccount, and creates a service instance and the associated service key for SAP Document AI.

Click start

avikjuoss94_6-1763065383297.png

Reminder- If you close SAP BTP browser by mistake – here is a quick link to open it again - https://cockpit.hanatrial.ondemand.com/trial/

Next go to BTP sub account – which is visible under Global account as below- left panel you can click on account explorer

avikjuoss94_7-1763065471465.png

Inside sub account ->expand services - look for instances and subscriptions on left panel- shown below

avikjuoss94_8-1763065503451.png

We can see 2 subscriptions below by default SAP Business application studio is enabled

avikjuoss94_9-1763065550934.png

Next click on service marketplace

avikjuoss94_10-1763065690844.png

Search with AI + Enter- select 1st tile shown below

avikjuoss94_12-1763065943891.png

Click on Create (as I pre-created so it is greyed out)

avikjuoss94_13-1763066016618.png

Fill up below popup 

Tips: You should select the plan as shown below to use the SAP AI document service effectively as a plug and play from external ecosystem.

avikjuoss94_14-1763066090887.png

Setup your new instance as below- name as per your choice

avikjuoss94_15-1763066275787.png

Next – From left panel, again go to instances and subscriptions- this time 2nd tab called instances

avikjuoss94_16-1763066306162.png

Note – the difference in “Plan” in the setup, one is default another is blocks of 100.

avikjuoss94_17-1763066434778.png

Click on the credential “1key “ and 'Form'- we explain this in details. You may download it.
1/ Url -i.e. DOC_AI_URL used by external application.

avikjuoss94_18-1763066561707.png

2/ TOKEN_URL = This will be needed by external apps to authenticate with BTP service.

This url has term ‘authentication’- -Tips- do not use sburl

 

avikjuoss94_20-1763066727305.png

Tips- when using this Token for authentication, we need to add suffix befind above url as below after ondemand.com
/oauth/token"
3/ CLIENT_ID – That is self-explanatory- from the above screenshot, you must note down.
4/ CLIENT_SECRET - That is self-explanatory- from the above screenshot, you must note down.
Inside the key file there is another element called swagger

avikjuoss94_21-1763066759775.png

When we would make a call to SAP AI document services- our schema from external applications, then this swagger needs to be passed along with the document Url.

Full API endpoint (for extraction jobs)
combine "url" + "swagger"

avikjuoss94_22-1763066863091.png

Next- From left panel -click on Security- still within BTP sub account

avikjuoss94_23-1763066918127.png

Look into right panel – click on arrow – to navigate inside details

avikjuoss94_24-1763066945245.png

Click on the Role collections tab- It will show already assigned existing roles- do not get confused or search roles here. Click on assign role collections

avikjuoss94_25-1763066978579.png

In the below popup-search for ‘doc’ and assign all of them to your BTP user

Note- without those roles you will not be able to use SAP AI doc service schema configuration- neither the external call will work.

Tips- this is crucial step-otherwise SAP BTP service call will authenticate but not be able to use your own custom schema or SAP defined standard schemas and purpose of the plug & play will be defeated.

Interestingly this role collection step you may have to do multiple times as I observed even after assignment on 1st day- next day it vanished- had to re assign.

avikjuoss94_26-1763067150331.png

Next go back to Instances & subsc.from left panel

avikjuoss94_27-1763067194549.png

Click on application = SAP doc AI shown below

avikjuoss94_28-1763067325732.png

A new browser widow will open as below

Tips- Without suitable role collection this arrow marked button will not appear- This is used for schema creation.

avikjuoss94_29-1763067365835.png

Click on schema configuration Below list of schemas will be shown- SAP_ are all standard schema provided out of box-we can use it as is or create our own schema. When we click on create – below popup appears

avikjuoss94_30-1763067411163.png

As shown below I created my own schema namely invoice_ai_doc

avikjuoss94_31-1763067430419.png

I clicked on my schema name- copy of SAP_invoice_schema  Next – I click on create version- I could now get ‘Edit’ button enabled for both header and item fields of the invoice schema- I can click on ADD button to add my bespoke fields as shown below.

avikjuoss94_32-1763067496996.png

Finally click on activate the schema
Now all necessary BTP setup is ready.
Next- outside SAP ecosystem – plug and play.
For simplicity, I shall use ‘Streamlit’ an open-source Python library that allows us to create interactive web applications using pure Python and a python project on PyCharm IDE
Note- Any web application/tech. stack React, Django, Flask, JavaScript Node.js backend, Angular, CSS etc. can leverage SAP BTP Document AI service with above setup.

I created following python project in PyCharm - where I loaded secret key of SAP BTP DOC AI service instance in a safe and secure way. I have used .env and .gitignore to protect unwanted github publishing of the key details as per best practice guidelines.

avikjuoss94_33-1763067638273.png

A simple object class is created for this demonstration

avikjuoss94_34-1763067667754.png

Having 4 methods as below

avikjuoss94_35-1763067713273.png

Next showtime!  I run my streamlit app UI called app.py(see python project)

The frontend is displayed  below

avikjuoss94_36-1763067851095.png

Feature-
1/ I can test service configuration with SAP BTP authentication token
2/ Available schema
3/ Browse & Upload invoice and click ‘Extract document information’ on streamlit app
a) I upload a train ticket invoice PDF

avikjuoss94_37-1763067941010.png

b) A sample invoice jpeg
c) A sample invoice pdf with different details.

Result –

avikjuoss94_38-1763067998868.png

 

avikjuoss94_39-1763067998873.png

 

avikjuoss94_40-1763067998875.png

2nd Invoice image

avikjuoss94_41-1763067998880.png

3rd Invoice also uploaded for analysis and extracted on my app as below

avikjuoss94_42-1763067998883.png

Next – check on SAP BTP portal, where we submitted those 3 invoices (2 pdf and 1 jpeg)

Below is the document service page, amazing!

avikjuoss94_43-1763068099451.png

I can also open any invoice – example below – It also shows ECR values right side!

avikjuoss94_44-1763068099466.png

Conclusion:

In a world where technology evolves faster than documentation can keep up, it’s easy for Functional Analysts to feel lost and overwhelmed. This guide bridges that gap, providing clear, step-by-step instructions to integrate SAP Document AI seamlessly with any non-SAP web application. By removing the guesswork and eliminating outdated instructions, it empowers analysts to explore, experiment, and innovate without frustration. The result? Less confusion, more confidence, and the ability to unlock the true potential of intelligent document processing in your organization.

 

 

 

 

1 Comment