#1
This guide shows how to connect SAP HANA Express, Spring Boot, and SAP UI5 to build a simple full-stack application.

1. Create Table in HANA

CREATE COLUMN TABLE PRODUCTS (
    ID INTEGER PRIMARY KEY,
    NAME NVARCHAR(100),
    PRICE DECIMAL(10,2)
);
Insert sample data:
INSERT INTO PRODUCTS VALUES (1, 'Laptop', 1200);
INSERT INTO PRODUCTS VALUES (2, 'Phone', 800);

2. Configure Spring Boot

application.properties:
spring.datasource.url=jdbc:sap://localhost:39015/?databaseName=HXE
spring.datasource.username=SYSTEM
spring.datasource.password=YourPassword
spring.datasource.driver-class-name=com.sap.db.jdbc.Driver

3. Repository and Service

import org.springframework.data.jpa.repository.JpaRepository;

public interface ProductRepository extends JpaRepository<Product, Integer> {
}
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ProductService {
    private final ProductRepository repo;

    public ProductService(ProductRepository repo) {
        this.repo = repo;
    }

    public List<Product> findAll() {
        return repo.findAll();
    }
}

4. Expose REST API

import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/products")
public class ProductController {
    private final ProductService service;

    public ProductController(ProductService service) {
        this.service = service;
    }

    @GetMapping
    public List<Product> getAll() {
        return service.findAll();
    }
}
Run and test:
GET /products

5. Build SAP UI5 Frontend

Create index.html:
<!DOCTYPE html>
<html>
<head>
    <script src="https://sdk.openui5.org/resources/sap-ui-core.js"
        id="sap-ui-bootstrap"
        data-sap-ui-theme="sap_fiori_3"
        data-sap-ui-libs="sap.m"
        data-sap-ui-compatVersion="edge">
    </script>
</head>
<body class="sapUiBody">
    <div id="content"></div>
    <script>
        var oTable = new sap.m.Table("table", {
            columns: [
                new sap.m.Column({ header: new sap.m.Label({ text: "ID" }) }),
                new sap.m.Column({ header: new sap.m.Label({ text: "Name" }) }),
                new sap.m.Column({ header: new sap.m.Label({ text: "Price" }) })
            ]
        });

        var oModel = new sap.ui.model.json.JSONModel();
        oModel.loadData("http://localhost:8080/products");

        oTable.setModel(oModel);
        oTable.bindItems("/", new sap.m.ColumnListItem({
            cells: [
                new sap.m.Text({ text: "{id}" }),
                new sap.m.Text({ text: "{name}" }),
                new sap.m.Text({ text: "{price}" })
            ]
        }));

        oTable.placeAt("content");
    </script>
</body>
</html>

6. Run the App

  1. Start Spring Boot.
  2. Open index.html in a browser.
  3. Product data from HANA will be displayed in the SAP UI5 table.

image quote pre code