Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "sap-hana-cli",
|
||||||
|
"description": "SAP HANA Developer CLI (hana-cli) for database development and administration. Covers 91 commands, 17+ output formats, HDI container management, CDS/EDMX/OpenAPI conversion, cloud operations, and BTP integration.",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": {
|
||||||
|
"name": "Zhongwei Li",
|
||||||
|
"email": "zhongweili@tubi.tv"
|
||||||
|
},
|
||||||
|
"skills": [
|
||||||
|
"./"
|
||||||
|
]
|
||||||
|
}
|
||||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# sap-hana-cli
|
||||||
|
|
||||||
|
SAP HANA Developer CLI (hana-cli) for database development and administration. Covers 91 commands, 17+ output formats, HDI container management, CDS/EDMX/OpenAPI conversion, cloud operations, and BTP integration.
|
||||||
271
SKILL.md
Normal file
271
SKILL.md
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
---
|
||||||
|
name: sap-hana-cli
|
||||||
|
description: |
|
||||||
|
Assists with SAP HANA Developer CLI (hana-cli) for database development and administration.
|
||||||
|
Use when: installing hana-cli, connecting to SAP HANA databases, inspecting database objects
|
||||||
|
(tables, views, procedures, functions), managing HDI containers, executing SQL queries,
|
||||||
|
converting metadata to CDS/EDMX/OpenAPI formats, managing SAP HANA Cloud instances,
|
||||||
|
working with BTP CLI integration, or troubleshooting hana-cli commands.
|
||||||
|
Covers: 91 commands, 17+ output formats, HDI container management, cloud operations.
|
||||||
|
license: GPL-3.0
|
||||||
|
metadata:
|
||||||
|
version: "1.1.0"
|
||||||
|
last_verified: "2025-11-26"
|
||||||
|
---
|
||||||
|
|
||||||
|
# SAP HANA Developer CLI (hana-cli)
|
||||||
|
|
||||||
|
## Related Skills
|
||||||
|
|
||||||
|
- **sap-cap-capire**: Use for CAP database development, HDI container management, and CDS syntax comparison
|
||||||
|
- **sap-btp-cloud-platform**: Use for HANA Cloud operations, BTP integration, and cloud instance management
|
||||||
|
- **sap-abap-cds**: Use for comparing CDS syntax between CAP and ABAP or understanding HANA CDS features
|
||||||
|
- **sap-datasphere**: Use when working with SAP Datasphere integration or data warehousing scenarios
|
||||||
|
|
||||||
|
A developer-centric command-line interface for SAP HANA database development, particularly useful in non-SAP tooling environments like VS Code.
|
||||||
|
|
||||||
|
**Repository**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
**npm Package**: [https://www.npmjs.com/package/hana-cli](https://www.npmjs.com/package/hana-cli)
|
||||||
|
**Current Version**: 3.202405.1 (April 2024)
|
||||||
|
**Node.js Requirement**: ≥20.19.0
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install globally via npm (recommended)
|
||||||
|
npm install -g hana-cli
|
||||||
|
|
||||||
|
# Verify installation
|
||||||
|
hana-cli version
|
||||||
|
```
|
||||||
|
|
||||||
|
### First Connection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Interactive connection setup
|
||||||
|
hana-cli connect
|
||||||
|
|
||||||
|
# Or specify connection directly
|
||||||
|
hana-cli connect -n "hostname:port" -u DBUSER -p PASSWORD --save
|
||||||
|
|
||||||
|
# Using service key (HANA Cloud)
|
||||||
|
hana-cli connectViaServiceKey
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Core Command Categories
|
||||||
|
|
||||||
|
### Database Object Inspection
|
||||||
|
|
||||||
|
| Command | Aliases | Purpose |
|
||||||
|
|---------|---------|---------|
|
||||||
|
| `inspectTable` | `it`, `table` | Inspect table structure |
|
||||||
|
| `inspectView` | - | Inspect view definition |
|
||||||
|
| `inspectProcedure` | - | Inspect stored procedure |
|
||||||
|
| `inspectFunction` | - | Inspect function definition |
|
||||||
|
| `tables` | - | List all tables in schema |
|
||||||
|
| `views` | - | List all views in schema |
|
||||||
|
| `procedures` | - | List stored procedures |
|
||||||
|
| `functions` | - | List functions |
|
||||||
|
|
||||||
|
### Query Execution
|
||||||
|
|
||||||
|
| Command | Aliases | Purpose |
|
||||||
|
|---------|---------|---------|
|
||||||
|
| `querySimple` | `qs` | Execute SQL query |
|
||||||
|
| `callProcedure` | `cp` | Execute stored procedure |
|
||||||
|
| `hdbsql` | - | Direct SQL execution |
|
||||||
|
|
||||||
|
### HDI Container Management
|
||||||
|
|
||||||
|
| Command | Aliases | Purpose |
|
||||||
|
|---------|---------|---------|
|
||||||
|
| `containers` | `cont` | List HDI containers |
|
||||||
|
| `createContainer` | - | Create new container |
|
||||||
|
| `dropContainer` | - | Remove container |
|
||||||
|
| `activateHDI` | - | Enable HDI service |
|
||||||
|
| `adminHDI` | - | Administer HDI privileges |
|
||||||
|
|
||||||
|
### Cloud & BTP Operations
|
||||||
|
|
||||||
|
| Command | Aliases | Purpose |
|
||||||
|
|---------|---------|---------|
|
||||||
|
| `hanaCloudInstances` | - | List HANA Cloud instances |
|
||||||
|
| `hanaCloudStart` | - | Start cloud instance |
|
||||||
|
| `hanaCloudStop` | - | Stop cloud instance |
|
||||||
|
| `btp` | - | Configure BTP CLI |
|
||||||
|
| `btpInfo` | - | Display BTP target info |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Output Formats
|
||||||
|
|
||||||
|
The `--output` / `-o` option supports 17+ formats:
|
||||||
|
|
||||||
|
| Format | Use Case |
|
||||||
|
|--------|----------|
|
||||||
|
| `tbl` | Human-readable table (default) |
|
||||||
|
| `json` | JSON data |
|
||||||
|
| `yaml` | YAML format |
|
||||||
|
| `csv` | CSV export |
|
||||||
|
| `excel` | Excel file |
|
||||||
|
| `cds` | CAP CDS definitions |
|
||||||
|
| `hdbcds` | HANA CDS format |
|
||||||
|
| `hdbtable` | HDB Table definitions |
|
||||||
|
| `sql` | SQL DDL statements |
|
||||||
|
| `edmx` | OData EDMX metadata |
|
||||||
|
| `openapi` | OpenAPI/Swagger spec |
|
||||||
|
| `graphql` | GraphQL schema |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Connection Configuration
|
||||||
|
|
||||||
|
Connection credentials are searched in priority order:
|
||||||
|
|
||||||
|
1. `default-env-admin.json` (with `--admin` flag)
|
||||||
|
2. `.cdsrc-private.json` (via `cds bind`)
|
||||||
|
3. `.env` file with VCAP_SERVICES
|
||||||
|
4. File specified via `--conn` parameter
|
||||||
|
5. `default-env.json` in current/parent directories
|
||||||
|
6. `~/.hana-cli/default.json`
|
||||||
|
|
||||||
|
For connection templates, see `templates/default-env.json`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Common Workflows
|
||||||
|
|
||||||
|
### Inspect and Convert Table to CDS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Inspect table structure
|
||||||
|
hana-cli inspectTable -s MYSCHEMA -t MYTABLE
|
||||||
|
|
||||||
|
# Convert to CDS format
|
||||||
|
hana-cli inspectTable -s MYSCHEMA -t MYTABLE -o cds
|
||||||
|
```
|
||||||
|
|
||||||
|
### Mass Convert Schema Objects
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Convert all objects in schema to CDS
|
||||||
|
hana-cli massConvert -s MYSCHEMA
|
||||||
|
```
|
||||||
|
|
||||||
|
### Execute Query with Export
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run query and export to JSON
|
||||||
|
hana-cli querySimple -q "SELECT * FROM MYTABLE" -o json
|
||||||
|
|
||||||
|
# Export to Excel file
|
||||||
|
hana-cli querySimple -q "SELECT * FROM MYTABLE" -o excel -f ./output -n report
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manage HDI Containers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List all containers
|
||||||
|
hana-cli containers
|
||||||
|
|
||||||
|
# Create new container
|
||||||
|
hana-cli createContainer -c MY_CONTAINER -g MY_GROUP
|
||||||
|
|
||||||
|
# Create container users
|
||||||
|
hana-cli createContainerUsers -c MY_CONTAINER
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## UI Commands
|
||||||
|
|
||||||
|
Many commands have browser-based UI alternatives (suffix `UI`):
|
||||||
|
|
||||||
|
- `tablesUI` - Browse tables visually
|
||||||
|
- `containersUI` - Manage containers in browser
|
||||||
|
- `massConvertUI` - Visual mass conversion
|
||||||
|
- `querySimpleUI` - Query builder interface
|
||||||
|
- `systemInfoUI` - System dashboard
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- **Multi-database support**: HANA, PostgreSQL, SQLite backends
|
||||||
|
- **Format conversion**: 17+ output formats including CDS, EDMX, OpenAPI
|
||||||
|
- **HDI management**: Full container lifecycle management
|
||||||
|
- **Cloud integration**: SAP BTP CLI and HANA Cloud support
|
||||||
|
- **Interactive prompts**: Missing parameters prompted automatically
|
||||||
|
- **Service key auth**: Secure cloud authentication
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Detailed References
|
||||||
|
|
||||||
|
For comprehensive documentation:
|
||||||
|
|
||||||
|
- **All 91 Commands**: See `references/command-reference.md`
|
||||||
|
- **Connection & Security**: See `references/connection-security.md`
|
||||||
|
- **HDI Management**: See `references/hdi-management.md`
|
||||||
|
- **Output Formats**: See `references/output-formats.md`
|
||||||
|
- **Cloud Operations**: See `references/cloud-operations.md`
|
||||||
|
- **Database Inspection**: See `references/db-inspection.md`
|
||||||
|
- **Mass Operations**: See `references/mass-operations.md`
|
||||||
|
- **System Administration**: See `references/system-admin.md`
|
||||||
|
- **Web UI Interface**: See `references/web-ui.md`
|
||||||
|
- **Troubleshooting Guide**: See `references/troubleshooting.md`
|
||||||
|
- **Development Environment**: See `references/development-environment.md`
|
||||||
|
- **ABAP Programming Patterns**: See `references/abap-programming.md`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Connection Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check current connection status
|
||||||
|
hana-cli status
|
||||||
|
|
||||||
|
# Test with explicit credentials
|
||||||
|
hana-cli connect -n "host:443" -u USER -p PASS --encrypt true
|
||||||
|
|
||||||
|
# Use SSL trust store
|
||||||
|
hana-cli connect --trustStore /path/to/certificate.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
### Permission Errors
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Diagnose privilege errors
|
||||||
|
hana-cli privilegeError
|
||||||
|
|
||||||
|
# View current user info
|
||||||
|
hana-cli inspectUser
|
||||||
|
```
|
||||||
|
|
||||||
|
### Version Compatibility
|
||||||
|
|
||||||
|
- **Node.js**: Requires ≥20.19.0
|
||||||
|
- **@sap/cds**: Uses 9.4.4
|
||||||
|
- **@sap/cds-dk**: Requires ≥8.9 for cds bind
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- **GitHub**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
- **Intro Video**: [https://youtu.be/dvVQfi9Qgog](https://youtu.be/dvVQfi9Qgog)
|
||||||
|
- **Cloud Shells Demo**: [https://youtu.be/L7QyVLvAIIQ](https://youtu.be/L7QyVLvAIIQ)
|
||||||
|
- **SAP HANA Cloud**: [https://help.sap.com/docs/hana-cloud](https://help.sap.com/docs/hana-cloud)
|
||||||
|
- **SAP CAP**: [https://cap.cloud.sap/docs/](https://cap.cloud.sap/docs/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Last Updated: 2025-11-26 | Version: 1.1.0*
|
||||||
101
plugin.lock.json
Normal file
101
plugin.lock.json
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||||
|
"pluginId": "gh:secondsky/sap-skills:skills/sap-hana-cli",
|
||||||
|
"normalized": {
|
||||||
|
"repo": null,
|
||||||
|
"ref": "refs/tags/v20251128.0",
|
||||||
|
"commit": "5c5f6a882543915ccb27a1b4267b2af8fd2ef2d3",
|
||||||
|
"treeHash": "d64f5930e48aba1182f577f55fcdbd9906ab0e32fed233f7c5a1a331064cc0d9",
|
||||||
|
"generatedAt": "2025-11-28T10:28:15.354230Z",
|
||||||
|
"toolVersion": "publish_plugins.py@0.2.0"
|
||||||
|
},
|
||||||
|
"origin": {
|
||||||
|
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||||
|
"branch": "master",
|
||||||
|
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||||
|
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||||
|
},
|
||||||
|
"manifest": {
|
||||||
|
"name": "sap-hana-cli",
|
||||||
|
"description": "SAP HANA Developer CLI (hana-cli) for database development and administration. Covers 91 commands, 17+ output formats, HDI container management, CDS/EDMX/OpenAPI conversion, cloud operations, and BTP integration.",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"path": "README.md",
|
||||||
|
"sha256": "c1e76bef1a89863ae1993d20d74eb0c0432a88a0068a273fc5511a0c36e4f544"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "SKILL.md",
|
||||||
|
"sha256": "977ae48a28c94f496e66940fd254abdd734a6c2b20f8b553b33a157911fac752"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/abap-programming.md",
|
||||||
|
"sha256": "34e7b2017beb78a0ed031dd8539a9b2d65bfddaf70ce391f1017fe544e683566"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/command-reference.md",
|
||||||
|
"sha256": "aa7185d8ac639e9a530c2b1ac8356b3902c0ab7487624b873849ec621bcd6a9f"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/db-inspection.md",
|
||||||
|
"sha256": "112fed51e6a346ff8b3f9332c86b7cb10d71c0a8bf67caa29c763aef3ced4462"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/web-ui.md",
|
||||||
|
"sha256": "2cfd9357b0ffe9914843f80085552008a65e6375508a8bcf352a394ed8167918"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/troubleshooting.md",
|
||||||
|
"sha256": "1b932ca6227f99c28d8e60ef8ba0df88a23ee6a9cd746b3399826c84b18ce8d5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/connection-security.md",
|
||||||
|
"sha256": "96406bf0579897ea2b0c13487e085cf69a2d8a320b48cf699c31be0087e6541c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/cloud-operations.md",
|
||||||
|
"sha256": "ef4642cc154139e92ef7994ebbee5e4a4d25615653a31e4d831dd139c30a9e10"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/system-admin.md",
|
||||||
|
"sha256": "a124185ef22ad55a50c6ec3fc3540bed5addf62fb3909bba40a333d63b7e3410"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/hdi-management.md",
|
||||||
|
"sha256": "f18fb9d1a5394fa5cf3119a0843ea7d56fb2f6f6a3c1e0ab19827de2cb9013b1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/mass-operations.md",
|
||||||
|
"sha256": "769de8e3ba2944ed1eab9f7d1555ce11ee103c4106d6a8e25add8a1224514701"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/output-formats.md",
|
||||||
|
"sha256": "06847ee07eedc3f2584452c7f7f1da165bad79bc1351922bdd75e5a6f9e1f2ee"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "references/development-environment.md",
|
||||||
|
"sha256": "b12ab58c4ea33cb8e36041432327d3e1b3d2812f4d7d4c74a6980a4ef302eabd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": ".claude-plugin/plugin.json",
|
||||||
|
"sha256": "1d1ef3f7ff92c841cbd8a5a79d0955596b7ea59c05fc02c2af91370758b02e6e"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "templates/default-env.json",
|
||||||
|
"sha256": "e68fce20e5a1b99c70e4c1ce695f82fb53b1df5dbf8eab3bf70c0d4df37380e3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "templates/cdsrc-private.json",
|
||||||
|
"sha256": "722ec255b161a9e6830a27a18d6011a91b35fac7e5a0287c72c84a799514ae46"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dirSha256": "d64f5930e48aba1182f577f55fcdbd9906ab0e32fed233f7c5a1a331064cc0d9"
|
||||||
|
},
|
||||||
|
"security": {
|
||||||
|
"scannedAt": null,
|
||||||
|
"scannerVersion": null,
|
||||||
|
"flags": []
|
||||||
|
}
|
||||||
|
}
|
||||||
422
references/abap-programming.md
Normal file
422
references/abap-programming.md
Normal file
@@ -0,0 +1,422 @@
|
|||||||
|
# SAP ABAP Programming Reference
|
||||||
|
|
||||||
|
**Source**: [https://codezentrale.de/category/sap/sap-abap/](https://codezentrale.de/category/sap/sap-abap/)
|
||||||
|
**Language**: Translated from German
|
||||||
|
|
||||||
|
This reference covers ABAP programming patterns relevant to SAP HANA development.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
1. [SQL Operations](#sql-operations)
|
||||||
|
2. [Internal Tables](#internal-tables)
|
||||||
|
3. [String Operations](#string-operations)
|
||||||
|
4. [JSON Processing](#json-processing)
|
||||||
|
5. [XML Processing](#xml-processing)
|
||||||
|
6. [Regular Expressions](#regular-expressions)
|
||||||
|
7. [Exception Handling](#exception-handling)
|
||||||
|
8. [Performance Optimization](#performance-optimization)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SQL Operations
|
||||||
|
|
||||||
|
### Open SQL
|
||||||
|
|
||||||
|
#### Common Table Expressions (CTE)
|
||||||
|
|
||||||
|
```abap
|
||||||
|
WITH
|
||||||
|
+cte1 AS ( SELECT * FROM table1 WHERE condition ),
|
||||||
|
+cte2 AS ( SELECT * FROM +cte1 WHERE condition2 )
|
||||||
|
SELECT * FROM +cte2 INTO TABLE @DATA(lt_result).
|
||||||
|
```
|
||||||
|
|
||||||
|
#### String Aggregation
|
||||||
|
|
||||||
|
```abap
|
||||||
|
SELECT STRING_AGG( field, ',' ) AS aggregated
|
||||||
|
FROM table
|
||||||
|
INTO @DATA(lv_result).
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Global Temporary Tables (GTT)
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Use GTT for intermediate data storage
|
||||||
|
```
|
||||||
|
|
||||||
|
### Performance Comparison
|
||||||
|
|
||||||
|
| Method | Performance |
|
||||||
|
|--------|-------------|
|
||||||
|
| RANGE clause | ~0.086 seconds |
|
||||||
|
| FOR ALL ENTRIES | ~0.073 seconds |
|
||||||
|
| JOIN | ~0.012 seconds (fastest) |
|
||||||
|
|
||||||
|
**Best Practice**: Use JOINs instead of FOR ALL ENTRIES when possible.
|
||||||
|
|
||||||
|
### AMDP (ABAP Managed Database Procedures)
|
||||||
|
|
||||||
|
Convert RANGES to WHERE clause for AMDP:
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Using cl_shdb_seltab
|
||||||
|
DATA(lv_where) = cl_shdb_seltab=>combine_seltabs(
|
||||||
|
it_named_seltabs = VALUE #(
|
||||||
|
( name = 'FIELD' dref = REF #( lr_range ) )
|
||||||
|
)
|
||||||
|
)->sql_where_condition( ).
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Internal Tables
|
||||||
|
|
||||||
|
### TABLE_LINE Pseudo-Component
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Access complete row without structure
|
||||||
|
DATA(lv_vbeln) = it_vbeln[ table_line = '2345678901' ].
|
||||||
|
```
|
||||||
|
|
||||||
|
### REDUCE Operator
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Sum values
|
||||||
|
DATA(lv_sum) = REDUCE decfloat34(
|
||||||
|
INIT sum = CONV decfloat34( 0 )
|
||||||
|
FOR wa IN it_costs
|
||||||
|
NEXT sum = sum + wa-amount ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### OPTIONAL Clause
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Avoid exceptions for missing entries
|
||||||
|
DATA(ls_person) = VALUE #( it_persons[ name = 'John' ] OPTIONAL ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### DEFAULT VALUE
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Provide fallback value
|
||||||
|
DATA(ls_person) = VALUE #(
|
||||||
|
it_persons[ name = 'John' ]
|
||||||
|
DEFAULT VALUE #( name = '<empty>' age = -1 )
|
||||||
|
).
|
||||||
|
```
|
||||||
|
|
||||||
|
### BASE Operator
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Prepend existing data
|
||||||
|
it_result = VALUE #( BASE it_existing ( field = 'new' ) ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### Line Index
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Get index without exceptions
|
||||||
|
DATA(lv_idx) = line_index( itab[ col = '123' ] ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### Search Operations
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Case-insensitive search
|
||||||
|
FIND 'pattern' IN TABLE it_data IGNORING CASE.
|
||||||
|
|
||||||
|
" All occurrences
|
||||||
|
FIND ALL OCCURRENCES OF 'pattern' IN it_data
|
||||||
|
RESULTS DATA(lt_results).
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## String Operations
|
||||||
|
|
||||||
|
### Substring Extraction
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Offset and length syntax
|
||||||
|
DATA(lv_first) = CONV string( lv_string+0(1) ).
|
||||||
|
DATA(lv_middle) = CONV string( lv_string+5(3) ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### Transliteration
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Convert special characters
|
||||||
|
CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
|
||||||
|
EXPORTING
|
||||||
|
intext = lv_input
|
||||||
|
IMPORTING
|
||||||
|
outtext = lv_output.
|
||||||
|
" Result: ÄÖÜ → AeOeUe
|
||||||
|
```
|
||||||
|
|
||||||
|
### Codepage Conversion
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" SAP codepage to HTTP encoding
|
||||||
|
DATA(lv_encoding) = cl_abap_codepage=>sap_codepage(
|
||||||
|
http_encoding = 'UTF-8' ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pattern Matching (CP Operator)
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Wildcard matching
|
||||||
|
IF lv_string CP '*-*'. " Contains dash
|
||||||
|
IF lv_string CP '+++*'. " Three+ characters
|
||||||
|
```
|
||||||
|
|
||||||
|
### Message Text Splitting
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Distribute text across message fields
|
||||||
|
cl_message_helper=>set_msg_vars_for_clike(
|
||||||
|
EXPORTING i_text = lv_long_text ).
|
||||||
|
" Access via sy-msgv1, sy-msgv2, sy-msgv3, sy-msgv4
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## JSON Processing
|
||||||
|
|
||||||
|
### ABAP to JSON
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Using xco_cp_json (modern)
|
||||||
|
DATA(lv_json) = xco_cp_json=>data->from_abap( ls_data )->to_string( ).
|
||||||
|
|
||||||
|
" Using /ui2/cl_json
|
||||||
|
DATA(lv_json) = /ui2/cl_json=>serialize(
|
||||||
|
data = ls_data
|
||||||
|
pretty_name = /ui2/cl_json=>pretty_mode-camel_case ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### JSON to ABAP
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Using xco_cp_json
|
||||||
|
xco_cp_json=>data->from_string( lv_json )->apply(
|
||||||
|
VALUE #( ( xco_cp_json=>transformation->boolean_to_abap_bool )
|
||||||
|
( xco_cp_json=>transformation->pascal_case_to_underscore ) )
|
||||||
|
)->write_to( REF #( ls_data ) ).
|
||||||
|
|
||||||
|
" Using /ui2/cl_json
|
||||||
|
/ui2/cl_json=>deserialize(
|
||||||
|
EXPORTING json = lv_json
|
||||||
|
CHANGING data = ls_data ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### Internal Table to JSON
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Using transformation
|
||||||
|
CALL TRANSFORMATION id
|
||||||
|
SOURCE values = it_data
|
||||||
|
RESULT XML DATA(lv_json).
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## XML Processing
|
||||||
|
|
||||||
|
### XML to Internal Table
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Using cl_xml_document
|
||||||
|
DATA(lo_xml) = cl_xml_document=>create( ).
|
||||||
|
lo_xml->import_from_file( lv_filename ).
|
||||||
|
|
||||||
|
CALL FUNCTION 'SMUM_XML_PARSE'
|
||||||
|
EXPORTING
|
||||||
|
xml_input = lo_xml->get_document_xml_string( )
|
||||||
|
TABLES
|
||||||
|
return = lt_return
|
||||||
|
xml_table = lt_xml_data.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Display XML in Browser
|
||||||
|
|
||||||
|
```abap
|
||||||
|
cl_soap_xml_helper=>xml_show(
|
||||||
|
xml_xstring = lv_xml_xstring ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### ABAP to XML
|
||||||
|
|
||||||
|
```abap
|
||||||
|
DATA(lv_xml) = cl_proxy_xml_transform=>abap_to_xml_xstring(
|
||||||
|
abap_data = ls_structure ).
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Regular Expressions
|
||||||
|
|
||||||
|
### Replace Non-Alphanumeric
|
||||||
|
|
||||||
|
```abap
|
||||||
|
REPLACE ALL OCCURRENCES OF REGEX '[^\w]+' IN lv_str WITH '_'.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using cl_abap_matcher
|
||||||
|
|
||||||
|
```abap
|
||||||
|
DATA(lo_matcher) = cl_abap_matcher=>create(
|
||||||
|
pattern = '<placeholder>'
|
||||||
|
text = lv_text
|
||||||
|
ignore_case = abap_true ).
|
||||||
|
|
||||||
|
IF lo_matcher->replace_all( ' and ' ) > 0.
|
||||||
|
DATA(lv_result) = lo_matcher->text.
|
||||||
|
ENDIF.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Extract Submatches
|
||||||
|
|
||||||
|
```abap
|
||||||
|
DATA(lo_matcher) = cl_abap_matcher=>create(
|
||||||
|
pattern = '^/category/([0-9]+)/item/([0-9]+)$'
|
||||||
|
text = '/category/12345/item/12' ).
|
||||||
|
|
||||||
|
IF lo_matcher->match( ).
|
||||||
|
DATA(lv_category) = lo_matcher->get_submatch( 1 ). " 12345
|
||||||
|
DATA(lv_item) = lo_matcher->get_submatch( 2 ). " 12
|
||||||
|
ENDIF.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Remove HTML Tags
|
||||||
|
|
||||||
|
```abap
|
||||||
|
DATA(lo_matcher) = cl_abap_matcher=>create(
|
||||||
|
pattern = '<([!A-Za-z][A-Za-z0-9]*)|</([A-Za-z][A-Za-z0-9]*)>'
|
||||||
|
text = lv_html ).
|
||||||
|
lo_matcher->replace_all( '' ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### Common Patterns
|
||||||
|
|
||||||
|
| Pattern | Purpose |
|
||||||
|
|---------|---------|
|
||||||
|
| `[^\w]+` | Non-alphanumeric characters |
|
||||||
|
| `\s` | Whitespace |
|
||||||
|
| `[0-9]` | Digits |
|
||||||
|
| `^(AA\|BB).*$` | String prefix match |
|
||||||
|
| `\d{5}` | German postal code |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Exception Handling
|
||||||
|
|
||||||
|
### TRY...CATCH Block
|
||||||
|
|
||||||
|
```abap
|
||||||
|
TRY.
|
||||||
|
" Risky operation
|
||||||
|
DATA(lv_result) = 1 / 0.
|
||||||
|
CATCH cx_sy_zerodivide INTO DATA(lx_error).
|
||||||
|
" Handle exception
|
||||||
|
DATA(lv_msg) = lx_error->get_text( ).
|
||||||
|
ENDTRY.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Custom Exception Class
|
||||||
|
|
||||||
|
```abap
|
||||||
|
CLASS lcx_custom_error DEFINITION
|
||||||
|
INHERITING FROM cx_static_check.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
DATA mv_custom_field TYPE string.
|
||||||
|
METHODS constructor
|
||||||
|
IMPORTING
|
||||||
|
iv_custom_field TYPE string OPTIONAL.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
" Raising
|
||||||
|
RAISE EXCEPTION TYPE lcx_custom_error
|
||||||
|
EXPORTING iv_custom_field = 'Error details'.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using CX_T100_MSG
|
||||||
|
|
||||||
|
```abap
|
||||||
|
CLASS lcx_message DEFINITION
|
||||||
|
INHERITING FROM cx_t100_msg.
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CONSTANTS:
|
||||||
|
BEGIN OF error_occurred,
|
||||||
|
msgid TYPE symsgid VALUE 'ZMSG',
|
||||||
|
msgno TYPE symsgno VALUE '001',
|
||||||
|
attr1 TYPE scx_attrname VALUE 'MV_ATTR1',
|
||||||
|
END OF error_occurred.
|
||||||
|
ENDCLASS.
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Performance Optimization
|
||||||
|
|
||||||
|
### Field Symbols vs. References
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Faster: Field symbols
|
||||||
|
LOOP AT it_data ASSIGNING FIELD-SYMBOL(<ls_data>).
|
||||||
|
<ls_data>-field = 'value'.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
" Slower: References
|
||||||
|
LOOP AT it_data REFERENCE INTO DATA(lr_data).
|
||||||
|
lr_data->field = 'value'.
|
||||||
|
ENDLOOP.
|
||||||
|
```
|
||||||
|
|
||||||
|
### COLLECT for Deduplication
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Fastest approach - uses internal hash table
|
||||||
|
COLLECT ls_line INTO it_aggregated.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Table Copy Efficiency
|
||||||
|
|
||||||
|
```abap
|
||||||
|
" Most efficient: Direct assignment
|
||||||
|
it_target = it_source.
|
||||||
|
|
||||||
|
" Also efficient: CORRESPONDING
|
||||||
|
it_target = CORRESPONDING #( it_source ).
|
||||||
|
```
|
||||||
|
|
||||||
|
### SQL Best Practices
|
||||||
|
|
||||||
|
1. Use JOINs instead of FOR ALL ENTRIES
|
||||||
|
2. Use WHERE conditions early
|
||||||
|
3. Limit result sets with UP TO n ROWS
|
||||||
|
4. Use indexes appropriately
|
||||||
|
5. Avoid SELECT * when possible
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Useful Classes Reference
|
||||||
|
|
||||||
|
| Class | Purpose |
|
||||||
|
|-------|---------|
|
||||||
|
| `cl_abap_matcher` | Regular expressions |
|
||||||
|
| `cl_abap_codepage` | Codepage conversion |
|
||||||
|
| `/ui2/cl_json` | JSON serialization |
|
||||||
|
| `xco_cp_json` | Modern JSON handling |
|
||||||
|
| `cl_xml_document` | XML processing |
|
||||||
|
| `cl_salv_table` | ALV display |
|
||||||
|
| `cl_gui_alv_grid` | ALV grid control |
|
||||||
|
| `cl_abap_typedescr` | Runtime type info |
|
||||||
|
| `cl_shdb_seltab` | RANGES to WHERE |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Source: [https://codezentrale.de/category/sap/sap-abap/*](https://codezentrale.de/category/sap/sap-abap/*)
|
||||||
336
references/cloud-operations.md
Normal file
336
references/cloud-operations.md
Normal file
@@ -0,0 +1,336 @@
|
|||||||
|
# SAP HANA CLI - Cloud & BTP Operations
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
Commands for managing SAP HANA Cloud instances and SAP BTP integration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## BTP CLI Integration
|
||||||
|
|
||||||
|
The hana-cli integrates with SAP BTP CLI for cloud resource management.
|
||||||
|
|
||||||
|
### Configure BTP Target
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configure BTP CLI targeting
|
||||||
|
hana-cli btp
|
||||||
|
```
|
||||||
|
|
||||||
|
This sets up the connection to your BTP global account.
|
||||||
|
|
||||||
|
### View BTP Information
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Display current BTP target
|
||||||
|
hana-cli btpInfo
|
||||||
|
```
|
||||||
|
|
||||||
|
### List BTP Subscriptions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List subscribed services
|
||||||
|
hana-cli btpSubs
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HANA Cloud Instance Management
|
||||||
|
|
||||||
|
### List All HANA Cloud Instances
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
### Start HANA Cloud Instance
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start a stopped instance
|
||||||
|
hana-cli hanaCloudStart [instance]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Use Cases**:
|
||||||
|
- Resume development after break
|
||||||
|
- Scheduled startup
|
||||||
|
- Cost management (stop during off-hours)
|
||||||
|
|
||||||
|
### Stop HANA Cloud Instance
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Stop running instance
|
||||||
|
hana-cli hanaCloudStop [instance]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: Stopping instances helps reduce costs. Trial instances auto-stop after inactivity.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud Instance Types
|
||||||
|
|
||||||
|
### HDI Instances
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List Cloud HDI instances
|
||||||
|
hana-cli hanaCloudHDIInstances
|
||||||
|
|
||||||
|
# UI version
|
||||||
|
hana-cli hanaCloudHDIInstancesUI
|
||||||
|
```
|
||||||
|
|
||||||
|
### Schema Instances
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List Cloud schema instances
|
||||||
|
hana-cli hanaCloudSchemaInstances
|
||||||
|
|
||||||
|
# UI version
|
||||||
|
hana-cli hanaCloudSchemaInstancesUI
|
||||||
|
```
|
||||||
|
|
||||||
|
### SBSS Instances
|
||||||
|
|
||||||
|
Service Broker Secure Store instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List Cloud SBSS instances
|
||||||
|
hana-cli hanaCloudSBSSInstances
|
||||||
|
|
||||||
|
# UI version
|
||||||
|
hana-cli hanaCloudSBSSInstancesUI
|
||||||
|
```
|
||||||
|
|
||||||
|
### Secure Store Instances
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List Cloud secure store instances
|
||||||
|
hana-cli hanaCloudSecureStoreInstances
|
||||||
|
|
||||||
|
# UI version
|
||||||
|
hana-cli hanaCloudSecureStoreInstancesUI
|
||||||
|
```
|
||||||
|
|
||||||
|
### UPS Instances
|
||||||
|
|
||||||
|
User-Provided Service instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List Cloud UPS instances
|
||||||
|
hana-cli hanaCloudUPSInstances
|
||||||
|
|
||||||
|
# UI version
|
||||||
|
hana-cli hanaCloudUPSInstancesUI
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud Connection
|
||||||
|
|
||||||
|
### Using Service Keys
|
||||||
|
|
||||||
|
Connect to HANA Cloud using service keys:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Interactive service key connection
|
||||||
|
hana-cli connectViaServiceKey
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cloud Connection File
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [{
|
||||||
|
"name": "hana-cloud",
|
||||||
|
"credentials": {
|
||||||
|
"host": "xxxxxxxx.hana.trial-eu10.hanacloud.ondemand.com",
|
||||||
|
"port": "443",
|
||||||
|
"user": "DBADMIN",
|
||||||
|
"password": "SecurePass123!",
|
||||||
|
"encrypt": true,
|
||||||
|
"sslValidateCertificate": true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### SSL Requirements
|
||||||
|
|
||||||
|
HANA Cloud requires SSL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli connect \
|
||||||
|
-n "instance.hanacloud.ondemand.com:443" \
|
||||||
|
-u DBADMIN \
|
||||||
|
--encrypt true
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud Shell Compatibility
|
||||||
|
|
||||||
|
The hana-cli works in cloud-based development environments:
|
||||||
|
|
||||||
|
### SAP Business Application Studio
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Open BAS in browser
|
||||||
|
hana-cli openBAS
|
||||||
|
```
|
||||||
|
|
||||||
|
### Google Cloud Shell
|
||||||
|
|
||||||
|
Full compatibility with GCP Cloud Shell.
|
||||||
|
|
||||||
|
### AWS Cloud9
|
||||||
|
|
||||||
|
Full compatibility with AWS Cloud9.
|
||||||
|
|
||||||
|
### Video Demo
|
||||||
|
|
||||||
|
Cloud shell usage: [https://youtu.be/L7QyVLvAIIQ](https://youtu.be/L7QyVLvAIIQ)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud Workflows
|
||||||
|
|
||||||
|
### Development Instance Setup
|
||||||
|
|
||||||
|
1. **Create instance in SAP BTP Cockpit**
|
||||||
|
|
||||||
|
2. **Generate service key**
|
||||||
|
|
||||||
|
3. **Connect via hana-cli**:
|
||||||
|
```bash
|
||||||
|
hana-cli connectViaServiceKey
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Verify connection**:
|
||||||
|
```bash
|
||||||
|
hana-cli status
|
||||||
|
hana-cli systemInfo
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cost Optimization
|
||||||
|
|
||||||
|
1. **Check instance status**:
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Stop when not needed**:
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudStop myinstance
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Start when needed**:
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudStart myinstance
|
||||||
|
```
|
||||||
|
|
||||||
|
### HDI Container in Cloud
|
||||||
|
|
||||||
|
1. **List cloud HDI instances**:
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudHDIInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Create container**:
|
||||||
|
```bash
|
||||||
|
hana-cli createContainer MY_APP
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Create users**:
|
||||||
|
```bash
|
||||||
|
hana-cli createContainerUsers MY_APP
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## CDS Bind for Cloud
|
||||||
|
|
||||||
|
Use CDS binding for secure cloud credentials:
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# In your CAP project directory
|
||||||
|
cds bind --to hana --for hybrid
|
||||||
|
```
|
||||||
|
|
||||||
|
### .cdsrc-private.json
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"requires": {
|
||||||
|
"db": {
|
||||||
|
"kind": "hana",
|
||||||
|
"binding": {
|
||||||
|
"type": "cf",
|
||||||
|
"apiEndpoint": "[https://api.cf.eu10.hana.ondemand.com",](https://api.cf.eu10.hana.ondemand.com",)
|
||||||
|
"org": "my-org",
|
||||||
|
"space": "dev",
|
||||||
|
"instance": "hana-hdi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Benefits
|
||||||
|
|
||||||
|
- No local credential storage
|
||||||
|
- Dynamic credential lookup
|
||||||
|
- Works with rotated credentials
|
||||||
|
- Most secure option
|
||||||
|
|
||||||
|
### Tradeoff
|
||||||
|
|
||||||
|
Each command execution includes credential lookup, adding slight latency.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting Cloud Connections
|
||||||
|
|
||||||
|
### Instance Not Responding
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check if stopped
|
||||||
|
hana-cli hanaCloudInstances
|
||||||
|
|
||||||
|
# Start if needed
|
||||||
|
hana-cli hanaCloudStart myinstance
|
||||||
|
```
|
||||||
|
|
||||||
|
### SSL Certificate Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ensure encryption enabled
|
||||||
|
hana-cli connect --encrypt true
|
||||||
|
|
||||||
|
# Custom trust store if needed
|
||||||
|
hana-cli connect --trustStore /path/to/DigiCertGlobalRootCA.crt
|
||||||
|
```
|
||||||
|
|
||||||
|
### BTP Target Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Reconfigure BTP
|
||||||
|
hana-cli btp
|
||||||
|
|
||||||
|
# Verify target
|
||||||
|
hana-cli btpInfo
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud Resources
|
||||||
|
|
||||||
|
- **SAP HANA Cloud**: [https://help.sap.com/docs/hana-cloud](https://help.sap.com/docs/hana-cloud)
|
||||||
|
- **SAP BTP**: [https://help.sap.com/docs/btp](https://help.sap.com/docs/btp)
|
||||||
|
- **HANA Cloud Getting Started**: [https://developers.sap.com/group.hana-cloud-get-started-1-trial.html](https://developers.sap.com/group.hana-cloud-get-started-1-trial.html)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
730
references/command-reference.md
Normal file
730
references/command-reference.md
Normal file
@@ -0,0 +1,730 @@
|
|||||||
|
# SAP HANA CLI - Complete Command Reference
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
**Total Commands**: 91
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
1. [Database Object Commands](#database-object-commands)
|
||||||
|
2. [Inspection Commands](#inspection-commands)
|
||||||
|
3. [Connection Commands](#connection-commands)
|
||||||
|
4. [HDI Container Commands](#hdi-container-commands)
|
||||||
|
5. [Query & Execution Commands](#query--execution-commands)
|
||||||
|
6. [Mass Operation Commands](#mass-operation-commands)
|
||||||
|
7. [Cloud & BTP Commands](#cloud--btp-commands)
|
||||||
|
8. [User & Role Commands](#user--role-commands)
|
||||||
|
9. [System Information Commands](#system-information-commands)
|
||||||
|
10. [Development Commands](#development-commands)
|
||||||
|
11. [Monitoring Commands](#monitoring-commands)
|
||||||
|
12. [Documentation Commands](#documentation-commands)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Database Object Commands
|
||||||
|
|
||||||
|
### tables
|
||||||
|
List tables in schema.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli tables [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
| Option | Alias | Type | Default | Description |
|
||||||
|
|--------|-------|------|---------|-------------|
|
||||||
|
| schema | s | string | CURRENT_SCHEMA | Target schema |
|
||||||
|
| limit | l | number | 200 | Max results |
|
||||||
|
|
||||||
|
**UI Alternative**: `tablesUI`
|
||||||
|
|
||||||
|
### views
|
||||||
|
List views in schema.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli views [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### procedures
|
||||||
|
List stored procedures.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli procedures [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### functions / functionsUI
|
||||||
|
List database functions.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli functions [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### indexes / indexesUI
|
||||||
|
List database indexes.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli indexes [schema] [table]
|
||||||
|
```
|
||||||
|
|
||||||
|
### sequences
|
||||||
|
List sequences.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli sequences [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### synonyms
|
||||||
|
List synonyms.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli synonyms [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### triggers
|
||||||
|
List database triggers.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli triggers [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### schemas / schemasUI
|
||||||
|
List available schemas.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli schemas
|
||||||
|
```
|
||||||
|
|
||||||
|
### dataTypes / dataTypesUI
|
||||||
|
Display HANA data type specifications.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli dataTypes
|
||||||
|
```
|
||||||
|
|
||||||
|
### objects
|
||||||
|
List all database objects.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli objects [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### libraries
|
||||||
|
List database libraries.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli libraries [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Inspection Commands
|
||||||
|
|
||||||
|
### inspectTable
|
||||||
|
Inspect table structure with format conversion.
|
||||||
|
|
||||||
|
**Aliases**: `it`, `table`, `insTbl`, `inspecttable`, `inspectable`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable [schema] [table]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
| Option | Alias | Type | Default | Description |
|
||||||
|
|--------|-------|------|---------|-------------|
|
||||||
|
| table | t | string | required | Table name |
|
||||||
|
| schema | s | string | CURRENT_SCHEMA | Schema name |
|
||||||
|
| output | o | string | tbl | Output format |
|
||||||
|
| useHanaTypes | hana | boolean | false | Use HANA types |
|
||||||
|
| useQuoted | q | boolean | false | Quoted identifiers |
|
||||||
|
| useExists | exists | boolean | true | Check existence |
|
||||||
|
|
||||||
|
**Output Formats**: `tbl`, `sql`, `sqlite`, `postgres`, `cds`, `json`, `yaml`, `cdl`, `hdbcds`, `hdbtable`, `hdbmigrationtable`, `jsdoc`, `graphql`, `edmx`, `annos`, `edm`, `swgr`, `openapi`
|
||||||
|
|
||||||
|
**UI Alternative**: `inspectTableUI`
|
||||||
|
|
||||||
|
### inspectView
|
||||||
|
Inspect view definition.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectView [schema] [view]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectProcedure
|
||||||
|
Inspect stored procedure.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectProcedure [schema] [procedure]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectFunction
|
||||||
|
Inspect function definition.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectFunction [schema] [function]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectIndex
|
||||||
|
Inspect index structure.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectIndex [schema] [index]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectTrigger
|
||||||
|
Inspect trigger definition.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTrigger [schema] [trigger]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectUser
|
||||||
|
Inspect database user.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectUser [user]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectLibrary
|
||||||
|
Inspect database library.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectLibrary [schema] [library]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectLibMember
|
||||||
|
Inspect library member.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectLibMember [schema] [library] [member]
|
||||||
|
```
|
||||||
|
|
||||||
|
### inspectJWT
|
||||||
|
Inspect and decode JWT token.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectJWT [token]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Connection Commands
|
||||||
|
|
||||||
|
### connect
|
||||||
|
Establish and save database connection.
|
||||||
|
|
||||||
|
**Aliases**: `c`, `login`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli connect [user] [password]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
| Option | Alias | Type | Default | Description |
|
||||||
|
|--------|-------|------|---------|-------------|
|
||||||
|
| connection | n | string | - | host:port |
|
||||||
|
| user | u | string | - | Database user |
|
||||||
|
| password | p | string | - | Password (masked) |
|
||||||
|
| userstorekey | U | string | - | User store key |
|
||||||
|
| save | s | boolean | true | Save credentials |
|
||||||
|
| encrypt | e | boolean | - | Enable SSL |
|
||||||
|
| trustStore | t | string | - | SSL certificate path |
|
||||||
|
|
||||||
|
### connectViaServiceKey
|
||||||
|
Connect using BTP service key.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli connectViaServiceKey
|
||||||
|
```
|
||||||
|
|
||||||
|
### status
|
||||||
|
Display current connection status.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli status
|
||||||
|
```
|
||||||
|
|
||||||
|
### certificates
|
||||||
|
List system certificates.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli certificates
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HDI Container Commands
|
||||||
|
|
||||||
|
### activateHDI
|
||||||
|
Enable HDI service for tenant.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli activateHDI [tenant]
|
||||||
|
```
|
||||||
|
|
||||||
|
### adminHDI
|
||||||
|
Create/assign HDI admin privileges.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli adminHDI [user]
|
||||||
|
```
|
||||||
|
|
||||||
|
### adminHDIGroup
|
||||||
|
Add HDI group administrator.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli adminHDIGroup [group] [user]
|
||||||
|
```
|
||||||
|
|
||||||
|
### containers
|
||||||
|
List HDI containers.
|
||||||
|
|
||||||
|
**Aliases**: `cont`, `listContainers`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli containers [containerGroup] [container]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
| Option | Alias | Type | Default | Description |
|
||||||
|
|--------|-------|------|---------|-------------|
|
||||||
|
| container | c | string | * | Container filter |
|
||||||
|
| containerGroup | g | string | * | Group filter |
|
||||||
|
| limit | l | number | 200 | Max results |
|
||||||
|
|
||||||
|
**UI Alternative**: `containersUI`
|
||||||
|
|
||||||
|
### createContainer
|
||||||
|
Create new HDI container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli createContainer [container] [group]
|
||||||
|
```
|
||||||
|
|
||||||
|
### createContainerUsers
|
||||||
|
Create container access users.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli createContainerUsers [container]
|
||||||
|
```
|
||||||
|
|
||||||
|
### dropContainer
|
||||||
|
Remove HDI container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli dropContainer [container]
|
||||||
|
```
|
||||||
|
|
||||||
|
### createGroup
|
||||||
|
Create container group.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli createGroup [group]
|
||||||
|
```
|
||||||
|
|
||||||
|
### dropGroup
|
||||||
|
Remove container group.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli dropGroup [group]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Query & Execution Commands
|
||||||
|
|
||||||
|
### querySimple
|
||||||
|
Execute SQL query with flexible output.
|
||||||
|
|
||||||
|
**Aliases**: `qs`, `querysimple`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli querySimple [query]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
| Option | Alias | Type | Default | Description |
|
||||||
|
|--------|-------|------|---------|-------------|
|
||||||
|
| query | q | string | required | SQL query |
|
||||||
|
| folder | f | string | ./ | Output directory |
|
||||||
|
| filename | n | string | - | Output filename |
|
||||||
|
| output | o | string | table | Output format |
|
||||||
|
| profile | p | string | - | Connection profile |
|
||||||
|
|
||||||
|
**Output Formats**: `table`, `json`, `excel`, `csv`
|
||||||
|
|
||||||
|
**UI Alternative**: `querySimpleUI`
|
||||||
|
|
||||||
|
### callProcedure
|
||||||
|
Execute stored procedure.
|
||||||
|
|
||||||
|
**Aliases**: `cp`, `callprocedure`, `callProc`, `callSP`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli callProcedure [schema] [procedure]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
| Option | Alias | Type | Default | Description |
|
||||||
|
|--------|-------|------|---------|-------------|
|
||||||
|
| procedure | p | string | required | Procedure name |
|
||||||
|
| schema | s | string | CURRENT_SCHEMA | Schema name |
|
||||||
|
|
||||||
|
### hdbsql
|
||||||
|
Direct SQL execution interface.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hdbsql
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mass Operation Commands
|
||||||
|
|
||||||
|
### massConvert
|
||||||
|
Batch convert database objects.
|
||||||
|
|
||||||
|
**Aliases**: `mc`, `massconvert`, `massConv`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massConvert [schema] [table] [view]
|
||||||
|
```
|
||||||
|
|
||||||
|
**UI Alternative**: `massConvertUI`
|
||||||
|
|
||||||
|
### massRename
|
||||||
|
Batch rename operations.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massRename [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
### massUsers
|
||||||
|
Bulk user operations.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massUsers
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cloud & BTP Commands
|
||||||
|
|
||||||
|
### btp
|
||||||
|
Configure BTP CLI targeting.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli btp
|
||||||
|
```
|
||||||
|
|
||||||
|
### btpInfo
|
||||||
|
Display BTP target details.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli btpInfo
|
||||||
|
```
|
||||||
|
|
||||||
|
### btpSubs
|
||||||
|
List BTP subscriptions.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli btpSubs
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudInstances
|
||||||
|
List HANA Cloud instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudHDIInstances / hanaCloudHDIInstancesUI
|
||||||
|
List Cloud HDI instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudHDIInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudSchemaInstances / hanaCloudSchemaInstancesUI
|
||||||
|
List Cloud schema instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudSchemaInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudSBSSInstances / hanaCloudSBSSInstancesUI
|
||||||
|
List Cloud SBSS instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudSBSSInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudSecureStoreInstances / hanaCloudSecureStoreInstancesUI
|
||||||
|
List Cloud secure store instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudSecureStoreInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudUPSInstances / hanaCloudUPSInstancesUI
|
||||||
|
List Cloud UPS instances.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudUPSInstances
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudStart
|
||||||
|
Start HANA Cloud instance.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudStart [instance]
|
||||||
|
```
|
||||||
|
|
||||||
|
### hanaCloudStop
|
||||||
|
Stop HANA Cloud instance.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hanaCloudStop [instance]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## User & Role Commands
|
||||||
|
|
||||||
|
### users
|
||||||
|
List database users.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli users
|
||||||
|
```
|
||||||
|
|
||||||
|
### roles
|
||||||
|
List database roles.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli roles
|
||||||
|
```
|
||||||
|
|
||||||
|
### createXSAAdmin
|
||||||
|
Create XSA administrator.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli createXSAAdmin [user]
|
||||||
|
```
|
||||||
|
|
||||||
|
### createJWT
|
||||||
|
Generate JWT token.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli createJWT
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## System Information Commands
|
||||||
|
|
||||||
|
### systemInfo / systemInfoUI
|
||||||
|
Display system information.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli systemInfo
|
||||||
|
```
|
||||||
|
|
||||||
|
### hostInformation
|
||||||
|
Display host details.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hostInformation
|
||||||
|
```
|
||||||
|
|
||||||
|
### version
|
||||||
|
Display hana-cli version.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli version
|
||||||
|
```
|
||||||
|
|
||||||
|
### ports
|
||||||
|
List database ports.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli ports
|
||||||
|
```
|
||||||
|
|
||||||
|
### disks
|
||||||
|
Display disk information.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli disks
|
||||||
|
```
|
||||||
|
|
||||||
|
### dataVolumes
|
||||||
|
Display data volume information.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli dataVolumes
|
||||||
|
```
|
||||||
|
|
||||||
|
### iniFiles
|
||||||
|
List INI configuration files.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli iniFiles
|
||||||
|
```
|
||||||
|
|
||||||
|
### iniContents
|
||||||
|
Display INI file contents.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli iniContents [file]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Development Commands
|
||||||
|
|
||||||
|
### cds
|
||||||
|
Convert database objects to CDS format.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli cds [schema] [object]
|
||||||
|
```
|
||||||
|
|
||||||
|
### createModule
|
||||||
|
Create development module.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli createModule
|
||||||
|
```
|
||||||
|
|
||||||
|
### copy2DefaultEnv
|
||||||
|
Copy credentials to default-env.json.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli copy2DefaultEnv
|
||||||
|
```
|
||||||
|
|
||||||
|
### copy2Env
|
||||||
|
Copy credentials to .env file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli copy2Env
|
||||||
|
```
|
||||||
|
|
||||||
|
### copy2Secrets
|
||||||
|
Copy credentials to secrets.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli copy2Secrets
|
||||||
|
```
|
||||||
|
|
||||||
|
### openDBExplorer
|
||||||
|
Open HANA Database Explorer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli openDBExplorer
|
||||||
|
```
|
||||||
|
|
||||||
|
### openBAS
|
||||||
|
Open Business Application Studio.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli openBAS
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Monitoring Commands
|
||||||
|
|
||||||
|
### features / featuresUI
|
||||||
|
Display database features.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli features
|
||||||
|
```
|
||||||
|
|
||||||
|
### featureUsage / featureUsageUI
|
||||||
|
Display feature usage metrics.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli featureUsage
|
||||||
|
```
|
||||||
|
|
||||||
|
### traces
|
||||||
|
List trace files.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli traces
|
||||||
|
```
|
||||||
|
|
||||||
|
### traceContents
|
||||||
|
Display trace contents.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli traceContents [trace]
|
||||||
|
```
|
||||||
|
|
||||||
|
### privilegeError
|
||||||
|
Diagnose privilege errors.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli privilegeError
|
||||||
|
```
|
||||||
|
|
||||||
|
### reclaim
|
||||||
|
Reclaim database resources.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli reclaim
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Documentation Commands
|
||||||
|
|
||||||
|
### changeLog / changeLogUI / openChangeLog
|
||||||
|
View release changelog.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli changeLog
|
||||||
|
hana-cli openChangeLog # Opens in browser
|
||||||
|
```
|
||||||
|
|
||||||
|
### readMe / readMeUI / openReadMe
|
||||||
|
View documentation.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli readMe
|
||||||
|
hana-cli openReadMe # Opens in browser
|
||||||
|
```
|
||||||
|
|
||||||
|
### issue
|
||||||
|
Report issue to GitHub.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli issue
|
||||||
|
```
|
||||||
|
|
||||||
|
### UI
|
||||||
|
Open general web UI.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli UI
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Global Options
|
||||||
|
|
||||||
|
All commands support:
|
||||||
|
|
||||||
|
| Option | Alias | Description |
|
||||||
|
|--------|-------|-------------|
|
||||||
|
| --help | -h | Display help |
|
||||||
|
| --admin | - | Use admin credentials |
|
||||||
|
| --conn | - | Specify connection file |
|
||||||
|
| --profile | -p | Connection profile |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
312
references/connection-security.md
Normal file
312
references/connection-security.md
Normal file
@@ -0,0 +1,312 @@
|
|||||||
|
# SAP HANA CLI - Connection & Security Guide
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Connection Credential Hierarchy
|
||||||
|
|
||||||
|
The hana-cli searches for connection credentials in this priority order:
|
||||||
|
|
||||||
|
### 1. default-env-admin.json (Highest Priority)
|
||||||
|
Used when `--admin` flag is specified.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [{
|
||||||
|
"name": "hana-admin",
|
||||||
|
"credentials": {
|
||||||
|
"host": "hostname.hanacloud.ondemand.com",
|
||||||
|
"port": "443",
|
||||||
|
"user": "DBADMIN",
|
||||||
|
"password": "AdminPassword123",
|
||||||
|
"schema": "MYSCHEMA",
|
||||||
|
"encrypt": true,
|
||||||
|
"sslValidateCertificate": true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. .cdsrc-private.json (cds bind)
|
||||||
|
Most secure option for cloud credentials. Uses CAP binding.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"requires": {
|
||||||
|
"db": {
|
||||||
|
"kind": "hana",
|
||||||
|
"binding": {
|
||||||
|
"type": "cf",
|
||||||
|
"apiEndpoint": "[https://api.cf.eu10.hana.ondemand.com",](https://api.cf.eu10.hana.ondemand.com",)
|
||||||
|
"org": "my-org",
|
||||||
|
"space": "dev",
|
||||||
|
"instance": "my-hana-hdi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. .env File
|
||||||
|
Environment variables with VCAP_SERVICES.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
VCAP_SERVICES={"hana":[{"credentials":{"host":"...","port":"443",...}}]}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. --conn Parameter
|
||||||
|
Specify custom connection file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli tables --conn ./my-connection.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. ${homedir}/.hana-cli/
|
||||||
|
User-level configuration directory.
|
||||||
|
|
||||||
|
### 6. default-env.json
|
||||||
|
Project-level default connection.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [{
|
||||||
|
"name": "hana-db",
|
||||||
|
"credentials": {
|
||||||
|
"host": "hostname",
|
||||||
|
"port": "30015",
|
||||||
|
"user": "SYSTEM",
|
||||||
|
"password": "Password123"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. ${homedir}/.hana-cli/default.json (Lowest Priority)
|
||||||
|
Global fallback configuration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Connection Methods
|
||||||
|
|
||||||
|
### Interactive Connection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Prompts for all parameters
|
||||||
|
hana-cli connect
|
||||||
|
|
||||||
|
# Partial parameters (prompts for missing)
|
||||||
|
hana-cli connect -n "myhost:443" -u MYUSER
|
||||||
|
```
|
||||||
|
|
||||||
|
### Direct Connection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Full specification
|
||||||
|
hana-cli connect -n "hostname:443" -u USER -p PASSWORD --encrypt --save
|
||||||
|
|
||||||
|
# Using user store key
|
||||||
|
hana-cli connect -U MYKEY
|
||||||
|
```
|
||||||
|
|
||||||
|
### Service Key Connection (HANA Cloud)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Interactive service key setup
|
||||||
|
hana-cli connectViaServiceKey
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SSL/TLS Configuration
|
||||||
|
|
||||||
|
### Enable Encryption
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli connect --encrypt true
|
||||||
|
# or
|
||||||
|
hana-cli connect -e
|
||||||
|
# or
|
||||||
|
hana-cli connect --ssl
|
||||||
|
```
|
||||||
|
|
||||||
|
### Custom Trust Store
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Specify certificate file
|
||||||
|
hana-cli connect --trustStore /path/to/DigiCertGlobalRootCA.crt
|
||||||
|
|
||||||
|
# Alternative aliases
|
||||||
|
hana-cli connect --Trust /path/to/cert.pem
|
||||||
|
hana-cli connect -t /path/to/cert.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
### HANA Cloud SSL
|
||||||
|
|
||||||
|
For SAP HANA Cloud, SSL is required. The connection automatically uses:
|
||||||
|
- Port 443
|
||||||
|
- SSL encryption enabled
|
||||||
|
- DigiCert Global Root CA (usually pre-installed)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Credential Storage
|
||||||
|
|
||||||
|
### Save Credentials
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Save after connection (default behavior)
|
||||||
|
hana-cli connect -n "host:port" -u USER -p PASS --save
|
||||||
|
|
||||||
|
# Don't save
|
||||||
|
hana-cli connect --save false
|
||||||
|
```
|
||||||
|
|
||||||
|
### Credential Files Created
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|------|---------|
|
||||||
|
| `default-env.json` | Standard connection |
|
||||||
|
| `default-env-admin.json` | Admin connection |
|
||||||
|
| `.cdsrc-private.json` | CDS binding (gitignored) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Security Best Practices
|
||||||
|
|
||||||
|
### DO:
|
||||||
|
- Use `cds bind` for cloud credentials (no local storage)
|
||||||
|
- Add `default-env*.json` to `.gitignore`
|
||||||
|
- Add `.cdsrc-private.json` to `.gitignore`
|
||||||
|
- Use service keys for HANA Cloud
|
||||||
|
- Enable SSL/TLS for all connections
|
||||||
|
- Use user store keys when available
|
||||||
|
|
||||||
|
### DON'T:
|
||||||
|
- Commit credentials to version control
|
||||||
|
- Use plaintext passwords in scripts
|
||||||
|
- Disable SSL certificate validation in production
|
||||||
|
- Share admin credentials
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Connection File Templates
|
||||||
|
|
||||||
|
### HANA Cloud Connection
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [{
|
||||||
|
"name": "hana-cloud",
|
||||||
|
"label": "hana",
|
||||||
|
"credentials": {
|
||||||
|
"host": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.hana.trial-eu10.hanacloud.ondemand.com",
|
||||||
|
"port": "443",
|
||||||
|
"user": "DBADMIN",
|
||||||
|
"password": "SecurePassword123!",
|
||||||
|
"schema": "DBADMIN",
|
||||||
|
"encrypt": true,
|
||||||
|
"sslValidateCertificate": true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### On-Premise HANA Connection
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [{
|
||||||
|
"name": "hana-onprem",
|
||||||
|
"label": "hana",
|
||||||
|
"credentials": {
|
||||||
|
"host": "hana.company.internal",
|
||||||
|
"port": "30015",
|
||||||
|
"user": "DEVELOPER",
|
||||||
|
"password": "Password123",
|
||||||
|
"schema": "MYSCHEMA"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### HDI Container Connection
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [{
|
||||||
|
"name": "hdi-container",
|
||||||
|
"label": "hana",
|
||||||
|
"credentials": {
|
||||||
|
"host": "hostname",
|
||||||
|
"port": "443",
|
||||||
|
"user": "CONTAINER_USER",
|
||||||
|
"password": "ContainerPass",
|
||||||
|
"schema": "CONTAINER_SCHEMA",
|
||||||
|
"hdi_user": "CONTAINER_USER",
|
||||||
|
"hdi_password": "ContainerPass"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting Connections
|
||||||
|
|
||||||
|
### Check Status
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli status
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test Connection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Simple query test
|
||||||
|
hana-cli querySimple -q "SELECT CURRENT_USER FROM DUMMY"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Common Issues
|
||||||
|
|
||||||
|
| Error | Cause | Solution |
|
||||||
|
|-------|-------|----------|
|
||||||
|
| Connection refused | Wrong host/port | Verify hostname and port |
|
||||||
|
| SSL handshake failed | Certificate issue | Add --trustStore |
|
||||||
|
| Authentication failed | Wrong credentials | Check user/password |
|
||||||
|
| Insufficient privilege | Missing permissions | Check user roles |
|
||||||
|
|
||||||
|
### Diagnose Privileges
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli privilegeError
|
||||||
|
hana-cli inspectUser
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Connection Profiles
|
||||||
|
|
||||||
|
Use profiles for multiple environments:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Use specific profile
|
||||||
|
hana-cli tables --profile dev
|
||||||
|
hana-cli tables --profile prod
|
||||||
|
|
||||||
|
# Profile stored in connection file
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
245
references/db-inspection.md
Normal file
245
references/db-inspection.md
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
# SAP HANA CLI - Database Inspection Functions
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/dbInspect.js](https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/dbInspect.js)
|
||||||
|
|
||||||
|
Detailed documentation of the database inspection functions used by hana-cli.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Version & Metadata Functions
|
||||||
|
|
||||||
|
### getHANAVersion(db)
|
||||||
|
|
||||||
|
Returns HANA version information.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Returns: { version: "2.00.045", versionMajor: 2 }
|
||||||
|
```
|
||||||
|
|
||||||
|
**System Table**: `M_DATABASE`
|
||||||
|
|
||||||
|
### isCalculationView(db, schema, viewId)
|
||||||
|
|
||||||
|
Checks if a view is a Calculation View.
|
||||||
|
|
||||||
|
**System Table**: `_SYS_BI.BIMC_REPORTABLE_VIEWS`
|
||||||
|
|
||||||
|
**Note**: HANA 2.0+ only
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Table Inspection Functions
|
||||||
|
|
||||||
|
### getTable(db, schema, tableId)
|
||||||
|
|
||||||
|
Returns table metadata.
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| TABLE_NAME | Table name |
|
||||||
|
| TABLE_OID | Object ID |
|
||||||
|
| TABLE_TYPE | Table type |
|
||||||
|
| HAS_PRIMARY_KEY | Primary key exists |
|
||||||
|
| UNLOAD_PRIORITY | Memory priority |
|
||||||
|
| IS_PRELOAD | Preload enabled |
|
||||||
|
|
||||||
|
**System Table**: `TABLES`
|
||||||
|
|
||||||
|
### getTableFields(db, tableOid)
|
||||||
|
|
||||||
|
Returns column metadata for a table.
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| COLUMN_NAME | Column name |
|
||||||
|
| DATA_TYPE_NAME | Data type |
|
||||||
|
| LENGTH | Field length |
|
||||||
|
| SCALE | Decimal scale |
|
||||||
|
| IS_NULLABLE | Nullable flag |
|
||||||
|
| DEFAULT_VALUE | Default value |
|
||||||
|
| POSITION | Column position |
|
||||||
|
|
||||||
|
**System Table**: `TABLE_COLUMNS`
|
||||||
|
|
||||||
|
### getConstraints(db, object)
|
||||||
|
|
||||||
|
Returns PRIMARY KEY constraints.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## View Inspection Functions
|
||||||
|
|
||||||
|
### getView(db, schema, viewId)
|
||||||
|
|
||||||
|
Returns view metadata.
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| VIEW_NAME | View name |
|
||||||
|
| VIEW_OID | Object ID |
|
||||||
|
| COMMENTS | Documentation |
|
||||||
|
| VIEW_TYPE | View type |
|
||||||
|
|
||||||
|
**Note**: Version-aware queries (HANA 1.0 vs 2.0+)
|
||||||
|
|
||||||
|
### getViewFields(db, viewOid)
|
||||||
|
|
||||||
|
Returns view column metadata.
|
||||||
|
|
||||||
|
**System Table**: `VIEW_COLUMNS`
|
||||||
|
|
||||||
|
### getViewParameters(db, viewOid)
|
||||||
|
|
||||||
|
Returns view input parameters.
|
||||||
|
|
||||||
|
**System Table**: `VIEW_PARAMETERS`
|
||||||
|
|
||||||
|
### getCalcViewFields(db, schema, viewId, viewOid)
|
||||||
|
|
||||||
|
Returns Calculation View field metadata.
|
||||||
|
|
||||||
|
**System Table**: `_SYS_BI.BIMC_DIMENSION_VIEW`
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| POSITION | Field position |
|
||||||
|
| DATA_TYPE_NAME | Data type |
|
||||||
|
| SCALE | Decimal scale |
|
||||||
|
| KEY_COLUMN_NAME | Key indicator |
|
||||||
|
|
||||||
|
### getCalcViewParameters(db, schema, viewId, viewOid)
|
||||||
|
|
||||||
|
Returns Calculation View parameters.
|
||||||
|
|
||||||
|
**System Table**: `_SYS_BI.BIMC_VARIABLE_VIEW`
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| PARAMETER_NAME | Parameter name |
|
||||||
|
| DATA_TYPE_NAME | Data type |
|
||||||
|
| MANDATORY | Required flag |
|
||||||
|
| DEFAULT_VALUE | Default value |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Procedure & Function Functions
|
||||||
|
|
||||||
|
### getProcedure(db, schema, procedure)
|
||||||
|
|
||||||
|
Returns procedure metadata.
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| PROCEDURE_OID | Object ID |
|
||||||
|
| SQL_SECURITY | Security mode |
|
||||||
|
| INPUT_PARAMETER_COUNT | Input params |
|
||||||
|
| OUTPUT_PARAMETER_COUNT | Output params |
|
||||||
|
| READ_ONLY | Read-only flag |
|
||||||
|
| IS_VALID | Validity status |
|
||||||
|
|
||||||
|
**System Table**: `PROCEDURES`
|
||||||
|
|
||||||
|
### getProcedurePrams(db, procOid)
|
||||||
|
|
||||||
|
Returns procedure parameters.
|
||||||
|
|
||||||
|
**System Table**: `PROCEDURE_PARAMETERS`
|
||||||
|
|
||||||
|
### getProcedurePramCols(db, procOid)
|
||||||
|
|
||||||
|
Returns procedure parameter columns (for table-type params).
|
||||||
|
|
||||||
|
**System Table**: `PROCEDURE_PARAMETER_COLUMNS`
|
||||||
|
|
||||||
|
### getFunction(db, schema, functionName)
|
||||||
|
|
||||||
|
Returns function metadata.
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| FUNCTION_OID | Object ID |
|
||||||
|
| SQL_SECURITY | Security mode |
|
||||||
|
| INPUT_PARAMETER_COUNT | Input params |
|
||||||
|
| RETURN_VALUE_COUNT | Return values |
|
||||||
|
|
||||||
|
**System Table**: `FUNCTIONS`
|
||||||
|
|
||||||
|
### getFunctionPrams(db, funcOid)
|
||||||
|
|
||||||
|
Returns function parameters.
|
||||||
|
|
||||||
|
**Returns**:
|
||||||
|
| Field | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| PARAMETER_NAME | Parameter name |
|
||||||
|
| DATA_TYPE_NAME | Data type |
|
||||||
|
| PARAMETER_TYPE | IN/OUT/INOUT |
|
||||||
|
|
||||||
|
**System Table**: `FUNCTION_PARAMETERS`
|
||||||
|
|
||||||
|
### getFunctionPramCols(db, funcOid)
|
||||||
|
|
||||||
|
Returns function parameter columns.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Utility Functions
|
||||||
|
|
||||||
|
### getDef(db, schema, Id)
|
||||||
|
|
||||||
|
Returns object creation statement.
|
||||||
|
|
||||||
|
**System Procedure**: `GET_OBJECT_DEFINITION`
|
||||||
|
|
||||||
|
### getGeoColumns(db, object, field, type)
|
||||||
|
|
||||||
|
Returns SRS_ID for spatial geometry columns.
|
||||||
|
|
||||||
|
### formatCDS(db, object, fields, constraints, type, schema, parent, parameters)
|
||||||
|
|
||||||
|
Formats database object as CDS entity.
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- Type mapping (HANA to CDS)
|
||||||
|
- Name normalization
|
||||||
|
- Constraint handling
|
||||||
|
- Parameter support
|
||||||
|
|
||||||
|
### parseSQLOptions(output, cdsSource)
|
||||||
|
|
||||||
|
Extracts extended SQL syntax via regex:
|
||||||
|
- PARTITION clauses
|
||||||
|
- UNLOAD PRIORITY
|
||||||
|
- AUTO MERGE settings
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## System Tables Summary
|
||||||
|
|
||||||
|
| Table | Purpose |
|
||||||
|
|-------|---------|
|
||||||
|
| `M_DATABASE` | Version info |
|
||||||
|
| `TABLES` | Table metadata |
|
||||||
|
| `TABLE_COLUMNS` | Column definitions |
|
||||||
|
| `VIEWS` | View metadata |
|
||||||
|
| `VIEW_COLUMNS` | View columns |
|
||||||
|
| `VIEW_PARAMETERS` | View input params |
|
||||||
|
| `PROCEDURES` | Procedure metadata |
|
||||||
|
| `PROCEDURE_PARAMETERS` | Procedure params |
|
||||||
|
| `PROCEDURE_PARAMETER_COLUMNS` | Table-type columns |
|
||||||
|
| `FUNCTIONS` | Function metadata |
|
||||||
|
| `FUNCTION_PARAMETERS` | Function params |
|
||||||
|
| `_SYS_BI.BIMC_REPORTABLE_VIEWS` | Calc view detection |
|
||||||
|
| `_SYS_BI.BIMC_DIMENSION_VIEW` | Calc view fields |
|
||||||
|
| `_SYS_BI.BIMC_VARIABLE_VIEW` | Calc view variables |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/dbInspect.js*](https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/dbInspect.js*)
|
||||||
287
references/development-environment.md
Normal file
287
references/development-environment.md
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
# SAP HANA CLI - Development Environment Reference
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
Configuration for development environments, testing, and multi-database support.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## DevContainer Setup
|
||||||
|
|
||||||
|
The repository includes VS Code DevContainer configuration for consistent development environments.
|
||||||
|
|
||||||
|
### Container Base
|
||||||
|
|
||||||
|
```dockerfile
|
||||||
|
# Base image: Node.js 22 on Debian Buster
|
||||||
|
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-22-buster
|
||||||
|
```
|
||||||
|
|
||||||
|
### System Packages Installed
|
||||||
|
|
||||||
|
```dockerfile
|
||||||
|
# Cloud Foundry CLI
|
||||||
|
apt-get install cf8-cli
|
||||||
|
|
||||||
|
# Utilities
|
||||||
|
apt-get install git jq
|
||||||
|
```
|
||||||
|
|
||||||
|
### Global npm Packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install -g @ui5/cli
|
||||||
|
npm install -g @sap/cds-dk
|
||||||
|
npm install -g yo
|
||||||
|
npm install -g @sap/generator-hdb-project
|
||||||
|
npm install -g @sap/generator-fiori
|
||||||
|
npm install -g typescript
|
||||||
|
```
|
||||||
|
|
||||||
|
### VS Code Extensions (21 total)
|
||||||
|
|
||||||
|
| Category | Extensions |
|
||||||
|
|----------|------------|
|
||||||
|
| **SAP Tools** | CDS Language Support, Fiori Tools, SAP UX Pack, HANA Driver, XML Toolkit |
|
||||||
|
| **Development** | ESLint, Beautify, IntelliCode, REST Client |
|
||||||
|
| **Productivity** | GitLens, Bracket Pair Colorizer, Path IntelliSense |
|
||||||
|
| **Other** | Yeoman UI, Version Lens, VS Code Icons |
|
||||||
|
|
||||||
|
### Port Forwarding
|
||||||
|
|
||||||
|
```json
|
||||||
|
"forwardPorts": [4004, 3010]
|
||||||
|
```
|
||||||
|
|
||||||
|
- **4004**: CAP default server port
|
||||||
|
- **3010**: hana-cli UI default port
|
||||||
|
|
||||||
|
### Post-Creation Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash -i install-btp.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Installs BTP CLI from SAP GitHub repository.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Multi-Database Support
|
||||||
|
|
||||||
|
The hana-cli supports multiple database backends through abstraction.
|
||||||
|
|
||||||
|
### Database Adapters
|
||||||
|
|
||||||
|
| File | Database | Purpose |
|
||||||
|
|------|----------|---------|
|
||||||
|
| `hanaCDS.js` | SAP HANA | CDS-based connection via CAP |
|
||||||
|
| `hanaDirect.js` | SAP HANA | Direct connection via hdb |
|
||||||
|
| `postgres.js` | PostgreSQL | PostgreSQL backend |
|
||||||
|
| `sqlite.js` | SQLite | SQLite backend |
|
||||||
|
|
||||||
|
### Backend Selection
|
||||||
|
|
||||||
|
Database backend is selected based on:
|
||||||
|
1. Connection configuration
|
||||||
|
2. CDS profile settings
|
||||||
|
3. Command-specific requirements
|
||||||
|
|
||||||
|
### Database-Specific Commands
|
||||||
|
|
||||||
|
| Command | Purpose |
|
||||||
|
|---------|---------|
|
||||||
|
| `tablesPG` | List tables (PostgreSQL) |
|
||||||
|
| `tablesSQLite` | List tables (SQLite) |
|
||||||
|
| `tables` | List tables (HANA default) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## XS API Support (On-Premise)
|
||||||
|
|
||||||
|
For on-premise XSA environments, additional utilities are available.
|
||||||
|
|
||||||
|
### XS Configuration Functions
|
||||||
|
|
||||||
|
| Function | Purpose |
|
||||||
|
|----------|---------|
|
||||||
|
| `getCFConfig()` | Read ~/.xsconfig |
|
||||||
|
| `getCFOrg()` | Get target organization |
|
||||||
|
| `getCFSpace()` | Get target space |
|
||||||
|
| `getCFTarget()` | Get API endpoint |
|
||||||
|
|
||||||
|
### XS Service Discovery
|
||||||
|
|
||||||
|
| Function | Purpose |
|
||||||
|
|----------|---------|
|
||||||
|
| `getServices()` | List all services |
|
||||||
|
| `getServiceGUID(service)` | Get service GUID |
|
||||||
|
| `getServicePlans(guid)` | Get service plans |
|
||||||
|
| `getHANAInstances()` | List HANA instances |
|
||||||
|
| `getHDIInstances()` | List HDI instances |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## SQL Injection Prevention
|
||||||
|
|
||||||
|
The tool includes built-in SQL injection protection.
|
||||||
|
|
||||||
|
### Validation Functions
|
||||||
|
|
||||||
|
| Function | Purpose |
|
||||||
|
|----------|---------|
|
||||||
|
| `isAcceptableParameter(value, maxToken)` | Validate SQL parameter |
|
||||||
|
| `isAcceptableQuotedParameter(value)` | Validate quoted strings |
|
||||||
|
| `escapeDoubleQuotes(value)` | Escape " characters |
|
||||||
|
| `escapeSingleQuotes(value)` | Escape ' characters |
|
||||||
|
|
||||||
|
### Security Features
|
||||||
|
|
||||||
|
- Comment detection (`--` and `/* */`)
|
||||||
|
- Quote nesting tracking
|
||||||
|
- Token counting
|
||||||
|
- Separator boundary enforcement
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Testing Configuration
|
||||||
|
|
||||||
|
### Test Framework
|
||||||
|
|
||||||
|
- **Framework**: Mocha
|
||||||
|
- **Reporter**: Mochawesome (HTML reports)
|
||||||
|
- **Timeout**: 10 seconds
|
||||||
|
- **Parallel**: Enabled
|
||||||
|
|
||||||
|
### Configuration (.mocharc.json)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"timeout": "10s",
|
||||||
|
"parallel": true,
|
||||||
|
"reporter": "mochawesome",
|
||||||
|
"require": ["./tests/helper.js", "mochawesome/register"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test Files
|
||||||
|
|
||||||
|
| Test | Purpose |
|
||||||
|
|------|---------|
|
||||||
|
| `SystemInfo.Test.js` | System info commands |
|
||||||
|
| `btpInfo.Test.js` | BTP info commands |
|
||||||
|
| `btpSubs.Test.js` | BTP subscriptions |
|
||||||
|
| `callProcedure.Test.js` | Procedure execution |
|
||||||
|
| `status.Test.js` | Connection status |
|
||||||
|
| `version.Test.js` | Version info |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Fiori LaunchPad Configuration
|
||||||
|
|
||||||
|
### Tile Groups
|
||||||
|
|
||||||
|
**List Objects** (9 tiles):
|
||||||
|
- Containers, Data Types, Functions, Indexes
|
||||||
|
- Schemas, Tables, Table Inspection
|
||||||
|
- Views, View Inspection
|
||||||
|
|
||||||
|
**Admin** (3 tiles):
|
||||||
|
- Features, Feature Usage, SQL Query
|
||||||
|
|
||||||
|
**CF/XS** (5 tiles):
|
||||||
|
- HDI, SBSS, Schema, SecureStore, UPS instances
|
||||||
|
|
||||||
|
### Applications
|
||||||
|
|
||||||
|
| App | Path | Purpose |
|
||||||
|
|-----|------|---------|
|
||||||
|
| systemInfo | /systemInfo | System dashboard |
|
||||||
|
| readMe | /readMe | Documentation |
|
||||||
|
| changeLog | /changeLog | Version history |
|
||||||
|
| massConvert | /massConvert | Batch conversion |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Version Checking
|
||||||
|
|
||||||
|
### Node.js Version Validation
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Reads engines.node from package.json
|
||||||
|
// Current requirement: ≥20.19.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update Notifications
|
||||||
|
|
||||||
|
The CLI includes update notification via `update-notifier` package.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## UI5 Configuration
|
||||||
|
|
||||||
|
### ui5.yaml Settings
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
specVersion: "1.0"
|
||||||
|
type: application
|
||||||
|
metadata:
|
||||||
|
name: test1
|
||||||
|
|
||||||
|
server:
|
||||||
|
customMiddleware:
|
||||||
|
- name: fiori-tools-proxy
|
||||||
|
configuration:
|
||||||
|
backend:
|
||||||
|
- path: /sap/opu/odata
|
||||||
|
url: [http://localhost](http://localhost)
|
||||||
|
ui5:
|
||||||
|
path:
|
||||||
|
- /resources
|
||||||
|
- /test-resources
|
||||||
|
url: [https://ui5.sap.com](https://ui5.sap.com)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Theme Support
|
||||||
|
|
||||||
|
- Light: `sap_horizon`
|
||||||
|
- Dark: `sap_horizon_dark`
|
||||||
|
- Legacy: `sap_fiori_3_dark`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Building from Source
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Node.js 20.19.0 or higher
|
||||||
|
node --version
|
||||||
|
|
||||||
|
# Remove SAP registry if set
|
||||||
|
npm config delete @sap:registry
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone repository
|
||||||
|
git clone [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
cd hana-developer-cli-tool-example
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Link globally
|
||||||
|
npm link
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using DevContainer
|
||||||
|
|
||||||
|
1. Open in VS Code with Remote-Containers extension
|
||||||
|
2. Select "Reopen in Container"
|
||||||
|
3. Wait for container build
|
||||||
|
4. Run `npm install && npm link`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
260
references/hdi-management.md
Normal file
260
references/hdi-management.md
Normal file
@@ -0,0 +1,260 @@
|
|||||||
|
# SAP HANA CLI - HDI Container Management
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
HDI (HANA Deployment Infrastructure) containers provide isolated runtime environments for database artifacts.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HDI Command Overview
|
||||||
|
|
||||||
|
| Command | Purpose |
|
||||||
|
|---------|---------|
|
||||||
|
| `activateHDI` | Enable HDI service |
|
||||||
|
| `adminHDI` | Assign HDI admin privileges |
|
||||||
|
| `adminHDIGroup` | Manage group administrators |
|
||||||
|
| `containers` | List containers |
|
||||||
|
| `createContainer` | Create new container |
|
||||||
|
| `createContainerUsers` | Create access users |
|
||||||
|
| `dropContainer` | Remove container |
|
||||||
|
| `createGroup` | Create container group |
|
||||||
|
| `dropGroup` | Remove container group |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Activate HDI Service
|
||||||
|
|
||||||
|
Enable HDI for a database tenant.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Activate HDI
|
||||||
|
hana-cli activateHDI
|
||||||
|
|
||||||
|
# For specific tenant
|
||||||
|
hana-cli activateHDI [tenant]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Prerequisites**: SYSTEM user or equivalent privileges.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HDI Administration
|
||||||
|
|
||||||
|
### Assign HDI Admin
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Make user an HDI administrator
|
||||||
|
hana-cli adminHDI [user]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Group Administration
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Add group administrator
|
||||||
|
hana-cli adminHDIGroup [group] [user]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Container Operations
|
||||||
|
|
||||||
|
### List Containers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List all containers
|
||||||
|
hana-cli containers
|
||||||
|
|
||||||
|
# With aliases
|
||||||
|
hana-cli cont
|
||||||
|
hana-cli listContainers
|
||||||
|
|
||||||
|
# Filter by container name pattern
|
||||||
|
hana-cli containers -c "MY_APP*"
|
||||||
|
|
||||||
|
# Filter by group
|
||||||
|
hana-cli containers -g "DEV_GROUP"
|
||||||
|
|
||||||
|
# Limit results
|
||||||
|
hana-cli containers -l 50
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**:
|
||||||
|
| Option | Alias | Default | Description |
|
||||||
|
|--------|-------|---------|-------------|
|
||||||
|
| container | c | * | Container filter pattern |
|
||||||
|
| containerGroup | g | * | Group filter pattern |
|
||||||
|
| limit | l | 200 | Maximum results |
|
||||||
|
|
||||||
|
**Output**: Container name, group, schema, creator, creation timestamp (UTC).
|
||||||
|
|
||||||
|
**UI Alternative**:
|
||||||
|
```bash
|
||||||
|
hana-cli containersUI
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create new container
|
||||||
|
hana-cli createContainer [container] [group]
|
||||||
|
|
||||||
|
# Example
|
||||||
|
hana-cli createContainer MY_APP_HDI DEV_GROUP
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Container Users
|
||||||
|
|
||||||
|
Creates the standard HDI access users for a container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create users for container
|
||||||
|
hana-cli createContainerUsers [container]
|
||||||
|
|
||||||
|
# Example
|
||||||
|
hana-cli createContainerUsers MY_APP_HDI
|
||||||
|
```
|
||||||
|
|
||||||
|
**Users Created**:
|
||||||
|
- Runtime user (read/execute)
|
||||||
|
- Design-time user (deploy artifacts)
|
||||||
|
- Admin user (full access)
|
||||||
|
|
||||||
|
### Drop Container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Remove container
|
||||||
|
hana-cli dropContainer [container]
|
||||||
|
|
||||||
|
# Example
|
||||||
|
hana-cli dropContainer MY_APP_HDI
|
||||||
|
```
|
||||||
|
|
||||||
|
**Warning**: This permanently deletes all artifacts in the container.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Container Groups
|
||||||
|
|
||||||
|
### Create Group
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create container group
|
||||||
|
hana-cli createGroup [group]
|
||||||
|
|
||||||
|
# Example
|
||||||
|
hana-cli createGroup DEV_GROUP
|
||||||
|
```
|
||||||
|
|
||||||
|
### Drop Group
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Remove container group
|
||||||
|
hana-cli dropGroup [group]
|
||||||
|
|
||||||
|
# Example
|
||||||
|
hana-cli dropGroup DEV_GROUP
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: Group must be empty before deletion.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HANA Cloud HDI Instances
|
||||||
|
|
||||||
|
For SAP HANA Cloud, use cloud-specific commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List Cloud HDI instances
|
||||||
|
hana-cli hanaCloudHDIInstances
|
||||||
|
|
||||||
|
# UI version
|
||||||
|
hana-cli hanaCloudHDIInstancesUI
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HDI Container Workflow
|
||||||
|
|
||||||
|
### Typical Development Workflow
|
||||||
|
|
||||||
|
1. **Enable HDI** (if not enabled):
|
||||||
|
```bash
|
||||||
|
hana-cli activateHDI
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Create group** (optional organization):
|
||||||
|
```bash
|
||||||
|
hana-cli createGroup MY_PROJECT_GROUP
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Create container**:
|
||||||
|
```bash
|
||||||
|
hana-cli createContainer MY_APP_HDI MY_PROJECT_GROUP
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Create users**:
|
||||||
|
```bash
|
||||||
|
hana-cli createContainerUsers MY_APP_HDI
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Verify**:
|
||||||
|
```bash
|
||||||
|
hana-cli containers -c "MY_APP*"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cleanup Workflow
|
||||||
|
|
||||||
|
1. **List containers**:
|
||||||
|
```bash
|
||||||
|
hana-cli containers
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Drop container**:
|
||||||
|
```bash
|
||||||
|
hana-cli dropContainer MY_APP_HDI
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Drop group** (if empty):
|
||||||
|
```bash
|
||||||
|
hana-cli dropGroup MY_PROJECT_GROUP
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## HDI Connection in default-env.json
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [{
|
||||||
|
"name": "hdi-container",
|
||||||
|
"label": "hana",
|
||||||
|
"credentials": {
|
||||||
|
"host": "hostname",
|
||||||
|
"port": "443",
|
||||||
|
"user": "MY_APP_HDI_RT",
|
||||||
|
"password": "RuntimeUserPassword",
|
||||||
|
"schema": "MY_APP_HDI",
|
||||||
|
"hdi_user": "MY_APP_HDI_DT",
|
||||||
|
"hdi_password": "DesignTimePassword",
|
||||||
|
"certificate": "-----BEGIN CERTIFICATE-----..."
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Common Issues
|
||||||
|
|
||||||
|
| Issue | Cause | Solution |
|
||||||
|
|-------|-------|----------|
|
||||||
|
| HDI not activated | Service disabled | Run `activateHDI` |
|
||||||
|
| Cannot create container | Insufficient privileges | Get HDI admin rights |
|
||||||
|
| Container exists | Name conflict | Use unique name |
|
||||||
|
| Cannot drop group | Group not empty | Drop containers first |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
216
references/mass-operations.md
Normal file
216
references/mass-operations.md
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
# SAP HANA CLI - Mass Operations Reference
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/massConvert.js](https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/massConvert.js)
|
||||||
|
|
||||||
|
Commands and functions for batch operations on database objects.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mass Convert Command
|
||||||
|
|
||||||
|
### massConvert
|
||||||
|
|
||||||
|
Batch convert database objects to various formats.
|
||||||
|
|
||||||
|
**Aliases**: `mc`, `massconvert`, `massConv`, `massconv`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massConvert [schema] [table] [view]
|
||||||
|
```
|
||||||
|
|
||||||
|
**UI Alternative**: `massConvertUI`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Conversion Types
|
||||||
|
|
||||||
|
### HDBTABLE Format
|
||||||
|
|
||||||
|
Generates `.hdbtable` files packaged in ZIP format.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massConvert -s MYSCHEMA -o hdbtable
|
||||||
|
```
|
||||||
|
|
||||||
|
**Functions**:
|
||||||
|
- `hdbtableTablesSQL()` - SQL-based table conversion
|
||||||
|
- `hdbtableTables()` - CDS-compiled table conversion
|
||||||
|
- `hdbtableViewsSQL()` - SQL-based view conversion
|
||||||
|
- `hdbtableViews()` - CDS-compiled view conversion
|
||||||
|
|
||||||
|
### HDBMIGRATIONTABLE Format
|
||||||
|
|
||||||
|
Generates `.hdbmigrationtable` files with version headers.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massConvert -s MYSCHEMA -o hdbmigrationtable
|
||||||
|
```
|
||||||
|
|
||||||
|
**Functions**:
|
||||||
|
- `hdbmigrationtableTablesSQL()` - SQL-based migration format
|
||||||
|
- `hdbmigrationtableTables()` - CDS-compiled migration format
|
||||||
|
|
||||||
|
### CDS Format
|
||||||
|
|
||||||
|
Generates unified `.cds` source file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massConvert -s MYSCHEMA -o cds
|
||||||
|
```
|
||||||
|
|
||||||
|
**Functions**:
|
||||||
|
- `cdsTables()` - Extracts table definitions
|
||||||
|
- `cdsViews()` - Extracts view definitions with parameters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Configuration Options
|
||||||
|
|
||||||
|
| Option | Type | Description |
|
||||||
|
|--------|------|-------------|
|
||||||
|
| `useHanaTypes` | boolean | Apply HANA-specific data types |
|
||||||
|
| `keepPath` | boolean | Preserve namespace paths |
|
||||||
|
| `noColons` | boolean | Remove colon syntax |
|
||||||
|
| `useExists` | boolean | Use EXISTS conditions |
|
||||||
|
| `useQuoted` | boolean | Quote identifiers |
|
||||||
|
| `useCatalogPure` | boolean | SQL-based catalog extraction |
|
||||||
|
| `namespace` | string | CDS namespace prefix |
|
||||||
|
| `limit` | number | Restrict result set size |
|
||||||
|
| `log` | boolean | Generate JSON audit logs |
|
||||||
|
| `table` | string | Pattern filter for tables |
|
||||||
|
| `view` | string | Pattern filter for views |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Output Functions
|
||||||
|
|
||||||
|
### writeZip()
|
||||||
|
|
||||||
|
Compresses files using DEFLATE compression.
|
||||||
|
|
||||||
|
### writeCDS()
|
||||||
|
|
||||||
|
Writes unified CDS file containing all entities.
|
||||||
|
|
||||||
|
### writeSynonyms()
|
||||||
|
|
||||||
|
Stores synonym mappings for reference.
|
||||||
|
|
||||||
|
### writeLog()
|
||||||
|
|
||||||
|
Creates JSON execution logs for auditing.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mass Rename Command
|
||||||
|
|
||||||
|
### massRename
|
||||||
|
|
||||||
|
Batch rename database objects.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massRename [schema]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Use Cases**:
|
||||||
|
- Standardize naming conventions
|
||||||
|
- Apply prefixes/suffixes
|
||||||
|
- Case conversion
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mass Users Command
|
||||||
|
|
||||||
|
### massUsers
|
||||||
|
|
||||||
|
Bulk user operations.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli massUsers
|
||||||
|
```
|
||||||
|
|
||||||
|
**Use Cases**:
|
||||||
|
- Create multiple users
|
||||||
|
- Assign roles in bulk
|
||||||
|
- User cleanup operations
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workflow Example
|
||||||
|
|
||||||
|
### Convert Entire Schema to CDS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Interactive mode
|
||||||
|
hana-cli massConvert
|
||||||
|
|
||||||
|
# Direct specification
|
||||||
|
hana-cli massConvert -s MYSCHEMA
|
||||||
|
|
||||||
|
# With options
|
||||||
|
hana-cli massConvert -s MYSCHEMA --useHanaTypes --namespace "my.app"
|
||||||
|
|
||||||
|
# Generate log file
|
||||||
|
hana-cli massConvert -s MYSCHEMA --log
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the UI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Launch browser-based interface
|
||||||
|
hana-cli massConvertUI
|
||||||
|
```
|
||||||
|
|
||||||
|
The UI provides:
|
||||||
|
- Schema browser
|
||||||
|
- Object selection
|
||||||
|
- Preview before conversion
|
||||||
|
- Download options
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Output Structure
|
||||||
|
|
||||||
|
### ZIP Archive Contents
|
||||||
|
|
||||||
|
```
|
||||||
|
output.zip
|
||||||
|
├── src/
|
||||||
|
│ ├── CUSTOMERS.hdbtable
|
||||||
|
│ ├── ORDERS.hdbtable
|
||||||
|
│ ├── PRODUCTS.hdbtable
|
||||||
|
│ └── ...
|
||||||
|
└── synonyms.json (if applicable)
|
||||||
|
```
|
||||||
|
|
||||||
|
### CDS File Structure
|
||||||
|
|
||||||
|
```cds
|
||||||
|
namespace my.schema;
|
||||||
|
|
||||||
|
entity CUSTOMERS {
|
||||||
|
key ID : Integer;
|
||||||
|
NAME : String(100);
|
||||||
|
EMAIL : String(255);
|
||||||
|
}
|
||||||
|
|
||||||
|
entity ORDERS {
|
||||||
|
key ID : Integer;
|
||||||
|
CUSTOMER_ID : Integer;
|
||||||
|
ORDER_DATE : Date;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
1. **Test with limit first**: Use `--limit 10` to verify output format
|
||||||
|
2. **Review generated files**: Check for naming conflicts
|
||||||
|
3. **Backup before conversion**: Preserve original definitions
|
||||||
|
4. **Use namespaces**: Apply consistent CDS namespaces
|
||||||
|
5. **Enable logging**: Track what was converted
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/massConvert.js*](https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/utils/massConvert.js*)
|
||||||
391
references/output-formats.md
Normal file
391
references/output-formats.md
Normal file
@@ -0,0 +1,391 @@
|
|||||||
|
# SAP HANA CLI - Output Formats Reference
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
The hana-cli supports 17+ output formats for database metadata conversion and export.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Format Overview
|
||||||
|
|
||||||
|
| Format | Extension | Use Case |
|
||||||
|
|--------|-----------|----------|
|
||||||
|
| `tbl` | - | Console table display (default) |
|
||||||
|
| `json` | .json | JSON data exchange |
|
||||||
|
| `yaml` | .yaml | YAML configuration |
|
||||||
|
| `csv` | .csv | Spreadsheet import |
|
||||||
|
| `excel` | .xlsx | Excel file export |
|
||||||
|
| `cds` | .cds | CAP CDS definitions |
|
||||||
|
| `cdl` | .cds | CDS Language format |
|
||||||
|
| `hdbcds` | .hdbcds | HANA native CDS |
|
||||||
|
| `hdbtable` | .hdbtable | HDB table definitions |
|
||||||
|
| `hdbmigrationtable` | .hdbmigrationtable | Migration tables |
|
||||||
|
| `sql` | .sql | SQL DDL statements |
|
||||||
|
| `sqlite` | .sql | SQLite-compatible SQL |
|
||||||
|
| `postgres` | .sql | PostgreSQL-compatible SQL |
|
||||||
|
| `edmx` | .edmx | OData EDMX metadata |
|
||||||
|
| `edm` | - | OData EDM |
|
||||||
|
| `annos` | .xml | OData annotations |
|
||||||
|
| `graphql` | .graphql | GraphQL schema |
|
||||||
|
| `openapi` | .json | OpenAPI specification |
|
||||||
|
| `swgr` | .json | Swagger specification |
|
||||||
|
| `jsdoc` | - | JSDoc documentation |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Using Output Formats
|
||||||
|
|
||||||
|
### Syntax
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli <command> --output <format>
|
||||||
|
# or
|
||||||
|
hana-cli <command> -o <format>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Console table (default)
|
||||||
|
hana-cli inspectTable -s SCHEMA -t TABLE
|
||||||
|
|
||||||
|
# JSON output
|
||||||
|
hana-cli inspectTable -s SCHEMA -t TABLE -o json
|
||||||
|
|
||||||
|
# CDS format
|
||||||
|
hana-cli inspectTable -s SCHEMA -t TABLE -o cds
|
||||||
|
|
||||||
|
# OpenAPI spec
|
||||||
|
hana-cli inspectTable -s SCHEMA -t TABLE -o openapi
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Format Details
|
||||||
|
|
||||||
|
### Console Formats
|
||||||
|
|
||||||
|
#### tbl (Table)
|
||||||
|
Human-readable table format for console display.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli tables -o tbl
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```
|
||||||
|
┌─────────────────┬────────────┬──────────┐
|
||||||
|
│ TABLE_NAME │ SCHEMA │ ROWS │
|
||||||
|
├─────────────────┼────────────┼──────────┤
|
||||||
|
│ CUSTOMERS │ MYSCHEMA │ 1000 │
|
||||||
|
│ ORDERS │ MYSCHEMA │ 5000 │
|
||||||
|
└─────────────────┴────────────┴──────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Data Exchange Formats
|
||||||
|
|
||||||
|
#### json
|
||||||
|
Standard JSON format.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o json
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"table": "CUSTOMERS",
|
||||||
|
"schema": "MYSCHEMA",
|
||||||
|
"columns": [
|
||||||
|
{"name": "ID", "type": "INTEGER", "nullable": false},
|
||||||
|
{"name": "NAME", "type": "NVARCHAR", "length": 100}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### yaml
|
||||||
|
YAML format for configuration files.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
#### csv
|
||||||
|
Comma-separated values for spreadsheet import.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli querySimple -q "SELECT * FROM CUSTOMERS" -o csv
|
||||||
|
```
|
||||||
|
|
||||||
|
#### excel
|
||||||
|
Microsoft Excel format (.xlsx).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli querySimple -q "SELECT * FROM CUSTOMERS" -o excel -f ./output -n customers
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### CAP CDS Formats
|
||||||
|
|
||||||
|
#### cds
|
||||||
|
SAP Cloud Application Programming Model CDS.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o cds
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```cds
|
||||||
|
entity Customers {
|
||||||
|
key ID : Integer;
|
||||||
|
NAME : String(100);
|
||||||
|
EMAIL : String(255);
|
||||||
|
CREATED_AT : Timestamp;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### cdl
|
||||||
|
CDS Language format (similar to cds).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o cdl
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### HANA Native Formats
|
||||||
|
|
||||||
|
#### hdbcds
|
||||||
|
HANA native CDS format.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o hdbcds
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```cds
|
||||||
|
context myschema {
|
||||||
|
entity CUSTOMERS {
|
||||||
|
key ID : Integer;
|
||||||
|
NAME : String(100);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
#### hdbtable
|
||||||
|
HDB table definition format.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o hdbtable
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```hdbtable
|
||||||
|
COLUMN TABLE "MYSCHEMA"."CUSTOMERS" (
|
||||||
|
"ID" INTEGER NOT NULL,
|
||||||
|
"NAME" NVARCHAR(100),
|
||||||
|
PRIMARY KEY ("ID")
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### hdbmigrationtable
|
||||||
|
Migration table format for HDI.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o hdbmigrationtable
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### SQL Formats
|
||||||
|
|
||||||
|
#### sql
|
||||||
|
Standard SQL DDL.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o sql
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```sql
|
||||||
|
CREATE TABLE "MYSCHEMA"."CUSTOMERS" (
|
||||||
|
"ID" INTEGER NOT NULL,
|
||||||
|
"NAME" NVARCHAR(100),
|
||||||
|
PRIMARY KEY ("ID")
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### sqlite
|
||||||
|
SQLite-compatible SQL.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o sqlite
|
||||||
|
```
|
||||||
|
|
||||||
|
#### postgres
|
||||||
|
PostgreSQL-compatible SQL.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### OData Formats
|
||||||
|
|
||||||
|
#### edmx
|
||||||
|
OData Entity Data Model XML.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o edmx
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<edmx:Edmx Version="4.0">
|
||||||
|
<edmx:DataServices>
|
||||||
|
<Schema Namespace="myschema">
|
||||||
|
<EntityType Name="Customers">
|
||||||
|
<Key>
|
||||||
|
<PropertyRef Name="ID"/>
|
||||||
|
</Key>
|
||||||
|
<Property Name="ID" Type="Edm.Int32" Nullable="false"/>
|
||||||
|
<Property Name="NAME" Type="Edm.String" MaxLength="100"/>
|
||||||
|
</EntityType>
|
||||||
|
</Schema>
|
||||||
|
</edmx:DataServices>
|
||||||
|
</edmx:Edmx>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### edm
|
||||||
|
OData EDM format.
|
||||||
|
|
||||||
|
#### annos
|
||||||
|
OData annotations XML.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o annos
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### API Formats
|
||||||
|
|
||||||
|
#### openapi / swgr
|
||||||
|
OpenAPI/Swagger specification.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o openapi
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {"title": "CUSTOMERS API"},
|
||||||
|
"paths": {
|
||||||
|
"/Customers": {
|
||||||
|
"get": {...},
|
||||||
|
"post": {...}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### graphql
|
||||||
|
GraphQL schema definition.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o graphql
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```graphql
|
||||||
|
type Customers {
|
||||||
|
ID: Int!
|
||||||
|
NAME: String
|
||||||
|
EMAIL: String
|
||||||
|
}
|
||||||
|
|
||||||
|
type Query {
|
||||||
|
Customers: [Customers]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Documentation Formats
|
||||||
|
|
||||||
|
#### jsdoc
|
||||||
|
JSDoc-style documentation.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectProcedure -p MY_PROC -o jsdoc
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mass Conversion
|
||||||
|
|
||||||
|
Convert multiple objects at once:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Convert all tables in schema to CDS
|
||||||
|
hana-cli massConvert -s MYSCHEMA
|
||||||
|
|
||||||
|
# UI version for interactive selection
|
||||||
|
hana-cli massConvertUI
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Output Options
|
||||||
|
|
||||||
|
### HANA Types
|
||||||
|
|
||||||
|
Use native HANA data types instead of generic types:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o cds --useHanaTypes
|
||||||
|
# or
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o cds --hana
|
||||||
|
```
|
||||||
|
|
||||||
|
### Quoted Identifiers
|
||||||
|
|
||||||
|
Preserve case-sensitive identifiers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o sql --useQuoted
|
||||||
|
# or
|
||||||
|
hana-cli inspectTable -t CUSTOMERS -o sql -q
|
||||||
|
```
|
||||||
|
|
||||||
|
### File Output
|
||||||
|
|
||||||
|
Save to file instead of console:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli querySimple -q "SELECT * FROM T" -o json -f ./output -n data
|
||||||
|
# Creates: ./output/data.json
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Format Compatibility Matrix
|
||||||
|
|
||||||
|
| Source | CDS | SQL | EDMX | GraphQL | OpenAPI |
|
||||||
|
|--------|-----|-----|------|---------|---------|
|
||||||
|
| Tables | Yes | Yes | Yes | Yes | Yes |
|
||||||
|
| Views | Yes | Yes | Yes | Yes | Yes |
|
||||||
|
| Procedures | Partial | Yes | No | No | No |
|
||||||
|
| Functions | Partial | Yes | No | No | No |
|
||||||
|
| Calc Views | Yes | Yes | Yes | Yes | Yes |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
279
references/system-admin.md
Normal file
279
references/system-admin.md
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
# SAP HANA CLI - System Administration Reference
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
Commands for system monitoring, configuration, and administration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## System Information Commands
|
||||||
|
|
||||||
|
### systemInfo
|
||||||
|
|
||||||
|
Display comprehensive system details.
|
||||||
|
|
||||||
|
**Aliases**: `si`, `sysinfo`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli systemInfo
|
||||||
|
```
|
||||||
|
|
||||||
|
**UI Alternative**: `systemInfoUI`
|
||||||
|
|
||||||
|
**Queries**:
|
||||||
|
- `SELECT * FROM M_SYSTEM_OVERVIEW`
|
||||||
|
- `SELECT * FROM M_SERVICES`
|
||||||
|
|
||||||
|
**Output Modes**:
|
||||||
|
| Mode | Description |
|
||||||
|
|------|-------------|
|
||||||
|
| Basic | DB user, HANA version, overview, services |
|
||||||
|
| Environment | Connection options, HDI credentials |
|
||||||
|
| DBX | DB type, credentials for Database Explorer |
|
||||||
|
|
||||||
|
### hostInformation
|
||||||
|
|
||||||
|
Display host details.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli hostInformation
|
||||||
|
```
|
||||||
|
|
||||||
|
### version
|
||||||
|
|
||||||
|
Display hana-cli version.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli version
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Database Features
|
||||||
|
|
||||||
|
### features
|
||||||
|
|
||||||
|
List SAP HANA database features.
|
||||||
|
|
||||||
|
**Aliases**: `fe`, `Features`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli features
|
||||||
|
```
|
||||||
|
|
||||||
|
**Query**: `SELECT * FROM M_FEATURES`
|
||||||
|
|
||||||
|
**UI Alternative**: `featuresUI`
|
||||||
|
|
||||||
|
### featureUsage
|
||||||
|
|
||||||
|
Display feature usage metrics.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli featureUsage
|
||||||
|
```
|
||||||
|
|
||||||
|
**UI Alternative**: `featureUsageUI`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Storage & Resources
|
||||||
|
|
||||||
|
### dataVolumes
|
||||||
|
|
||||||
|
Display data volume information.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli dataVolumes
|
||||||
|
```
|
||||||
|
|
||||||
|
### disks
|
||||||
|
|
||||||
|
Display disk information.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli disks
|
||||||
|
```
|
||||||
|
|
||||||
|
### ports
|
||||||
|
|
||||||
|
List database port assignments.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli ports
|
||||||
|
```
|
||||||
|
|
||||||
|
### reclaim
|
||||||
|
|
||||||
|
Reclaim database resources.
|
||||||
|
|
||||||
|
**Aliases**: `re`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli reclaim
|
||||||
|
```
|
||||||
|
|
||||||
|
**Operations Executed**:
|
||||||
|
1. `ALTER SYSTEM RECLAIM LOB SPACE` - Recover LOB storage
|
||||||
|
2. `ALTER SYSTEM RECLAIM LOG` - Free transaction log space
|
||||||
|
3. `ALTER SYSTEM RECLAIM DATAVOLUME 105 DEFRAGMENT` - Defragment storage
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Configuration Files
|
||||||
|
|
||||||
|
### iniFiles
|
||||||
|
|
||||||
|
List INI configuration files.
|
||||||
|
|
||||||
|
**Aliases**: `if`, `ini`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli iniFiles
|
||||||
|
```
|
||||||
|
|
||||||
|
**Query**: `SELECT * FROM M_INIFILES`
|
||||||
|
|
||||||
|
### iniContents
|
||||||
|
|
||||||
|
Display INI file contents.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli iniContents [file]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Query**: `SELECT * FROM M_INIFILE_CONTENTS`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Tracing & Debugging
|
||||||
|
|
||||||
|
### traces
|
||||||
|
|
||||||
|
List trace files.
|
||||||
|
|
||||||
|
**Aliases**: `tf`, `Traces`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli traces
|
||||||
|
```
|
||||||
|
|
||||||
|
**Query**: `SELECT * FROM M_TRACEFILES`
|
||||||
|
|
||||||
|
### traceContents
|
||||||
|
|
||||||
|
Display trace file contents.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli traceContents [trace]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Data Types
|
||||||
|
|
||||||
|
### dataTypes
|
||||||
|
|
||||||
|
Display HANA data type specifications.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli dataTypes
|
||||||
|
```
|
||||||
|
|
||||||
|
**Query**: `SELECT TYPE_NAME, COLUMN_SIZE, CREATE_PARAMS FROM DATA_TYPES`
|
||||||
|
|
||||||
|
**UI Alternative**: `dataTypesUI`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## System Tables Reference
|
||||||
|
|
||||||
|
| Table | Purpose | Command |
|
||||||
|
|-------|---------|---------|
|
||||||
|
| `M_SYSTEM_OVERVIEW` | System overview | systemInfo |
|
||||||
|
| `M_SERVICES` | Running services | systemInfo |
|
||||||
|
| `M_FEATURES` | Available features | features |
|
||||||
|
| `M_TRACEFILES` | Trace file list | traces |
|
||||||
|
| `M_INIFILES` | INI file list | iniFiles |
|
||||||
|
| `M_INIFILE_CONTENTS` | INI content | iniContents |
|
||||||
|
| `DATA_TYPES` | Type definitions | dataTypes |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Common Workflows
|
||||||
|
|
||||||
|
### Health Check
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# System overview
|
||||||
|
hana-cli systemInfo
|
||||||
|
|
||||||
|
# Check features
|
||||||
|
hana-cli features
|
||||||
|
|
||||||
|
# Review configuration
|
||||||
|
hana-cli iniFiles
|
||||||
|
```
|
||||||
|
|
||||||
|
### Performance Investigation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# View trace files
|
||||||
|
hana-cli traces
|
||||||
|
|
||||||
|
# Check specific trace
|
||||||
|
hana-cli traceContents [tracefile]
|
||||||
|
|
||||||
|
# Review feature usage
|
||||||
|
hana-cli featureUsage
|
||||||
|
```
|
||||||
|
|
||||||
|
### Storage Management
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check volumes
|
||||||
|
hana-cli dataVolumes
|
||||||
|
|
||||||
|
# Check disks
|
||||||
|
hana-cli disks
|
||||||
|
|
||||||
|
# Reclaim space
|
||||||
|
hana-cli reclaim
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Output Examples
|
||||||
|
|
||||||
|
### systemInfo Output
|
||||||
|
|
||||||
|
```
|
||||||
|
Database User: DBADMIN
|
||||||
|
HANA Version: 2.00.059.00
|
||||||
|
|
||||||
|
System Overview:
|
||||||
|
┌────────────────────┬─────────────────────────┐
|
||||||
|
│ NAME │ VALUE │
|
||||||
|
├────────────────────┼─────────────────────────┤
|
||||||
|
│ Database Name │ HXE │
|
||||||
|
│ Database Version │ 2.00.059.00 │
|
||||||
|
│ Start Time │ 2025-11-22 08:00:00 │
|
||||||
|
└────────────────────┴─────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### features Output
|
||||||
|
|
||||||
|
```
|
||||||
|
┌───────────────────────────┬─────────┐
|
||||||
|
│ FEATURE_NAME │ ENABLED │
|
||||||
|
├───────────────────────────┼─────────┤
|
||||||
|
│ Calculation Views │ TRUE │
|
||||||
|
│ Graph Engine │ TRUE │
|
||||||
|
│ Document Store │ TRUE │
|
||||||
|
│ Script Server │ TRUE │
|
||||||
|
└───────────────────────────┴─────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
292
references/troubleshooting.md
Normal file
292
references/troubleshooting.md
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
# SAP HANA CLI - Troubleshooting Guide
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
Common issues, diagnostic commands, and solutions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Diagnostic Commands
|
||||||
|
|
||||||
|
### Connection Status
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli status
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify current connection is active.
|
||||||
|
|
||||||
|
### Privilege Error Analysis
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli privilegeError [guid]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Aliases**: `pe`, `getInsufficientPrivilegeErrorDetails`
|
||||||
|
|
||||||
|
Diagnoses specific privilege errors using the error GUID.
|
||||||
|
|
||||||
|
**System Procedure**: `SYS.GET_INSUFFICIENT_PRIVILEGE_ERROR_DETAILS`
|
||||||
|
|
||||||
|
### User Inspection
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli inspectUser [user]
|
||||||
|
```
|
||||||
|
|
||||||
|
View user metadata and privileges.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Common Issues
|
||||||
|
|
||||||
|
### Connection Problems
|
||||||
|
|
||||||
|
| Error | Cause | Solution |
|
||||||
|
|-------|-------|----------|
|
||||||
|
| Connection refused | Wrong host/port | Verify hostname and port |
|
||||||
|
| SSL handshake failed | Certificate issue | Add `--trustStore` |
|
||||||
|
| Authentication failed | Wrong credentials | Check user/password |
|
||||||
|
| Connection timeout | Network issue | Check firewall rules |
|
||||||
|
| Host not found | DNS issue | Use IP address |
|
||||||
|
|
||||||
|
**Diagnostic Steps**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Check current status
|
||||||
|
hana-cli status
|
||||||
|
|
||||||
|
# 2. Test with explicit credentials
|
||||||
|
hana-cli connect -n "host:443" -u USER -p PASS --encrypt
|
||||||
|
|
||||||
|
# 3. Add trust store if needed
|
||||||
|
hana-cli connect --trustStore /path/to/cert.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
### Permission Errors
|
||||||
|
|
||||||
|
| Error | Cause | Solution |
|
||||||
|
|-------|-------|----------|
|
||||||
|
| Insufficient privilege | Missing role | Grant required roles |
|
||||||
|
| Object not found | Wrong schema | Check schema name |
|
||||||
|
| Access denied | Object ownership | Check privileges |
|
||||||
|
|
||||||
|
**Diagnostic Steps**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Get error GUID from error message
|
||||||
|
# 2. Analyze with privilegeError
|
||||||
|
hana-cli privilegeError <guid>
|
||||||
|
|
||||||
|
# 3. Check user details
|
||||||
|
hana-cli inspectUser
|
||||||
|
|
||||||
|
# 4. Review available roles
|
||||||
|
hana-cli roles
|
||||||
|
```
|
||||||
|
|
||||||
|
### HDI Container Issues
|
||||||
|
|
||||||
|
| Error | Cause | Solution |
|
||||||
|
|-------|-------|----------|
|
||||||
|
| HDI not activated | Service disabled | Run `activateHDI` |
|
||||||
|
| Cannot create container | No admin rights | Get HDI admin role |
|
||||||
|
| Container exists | Name conflict | Use unique name |
|
||||||
|
| Cannot drop group | Not empty | Drop containers first |
|
||||||
|
|
||||||
|
**Diagnostic Steps**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Check HDI status
|
||||||
|
hana-cli containers
|
||||||
|
|
||||||
|
# 2. Verify admin rights
|
||||||
|
hana-cli adminHDI
|
||||||
|
|
||||||
|
# 3. List container users
|
||||||
|
hana-cli createContainerUsers -c CONTAINER --list
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cloud Connection Issues
|
||||||
|
|
||||||
|
| Error | Cause | Solution |
|
||||||
|
|-------|-------|----------|
|
||||||
|
| Instance not found | Wrong name | Verify instance name |
|
||||||
|
| Instance stopped | Not running | Run `hanaCloudStart` |
|
||||||
|
| Service key invalid | Expired/revoked | Regenerate key |
|
||||||
|
| BTP target wrong | Wrong subaccount | Reconfigure with `btp` |
|
||||||
|
|
||||||
|
**Diagnostic Steps**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Check BTP target
|
||||||
|
hana-cli btpInfo
|
||||||
|
|
||||||
|
# 2. List instances
|
||||||
|
hana-cli hanaCloudInstances
|
||||||
|
|
||||||
|
# 3. Start if stopped
|
||||||
|
hana-cli hanaCloudStart <instance>
|
||||||
|
|
||||||
|
# 4. Reconfigure BTP
|
||||||
|
hana-cli btp
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Error Messages Reference
|
||||||
|
|
||||||
|
### Connection Errors
|
||||||
|
|
||||||
|
**"ECONNREFUSED"**
|
||||||
|
```
|
||||||
|
Error: connect ECONNREFUSED 127.0.0.1:30015
|
||||||
|
```
|
||||||
|
Solution: Check host and port, ensure database is running.
|
||||||
|
|
||||||
|
**"SSL_ERROR_SYSCALL"**
|
||||||
|
```
|
||||||
|
Error: SSL_ERROR_SYSCALL
|
||||||
|
```
|
||||||
|
Solution: Enable encryption with `--encrypt` or add trust store.
|
||||||
|
|
||||||
|
**"EHOSTUNREACH"**
|
||||||
|
```
|
||||||
|
Error: connect EHOSTUNREACH
|
||||||
|
```
|
||||||
|
Solution: Check network connectivity, VPN if required.
|
||||||
|
|
||||||
|
### Authentication Errors
|
||||||
|
|
||||||
|
**"Invalid username or password"**
|
||||||
|
```
|
||||||
|
Error: authentication failed
|
||||||
|
```
|
||||||
|
Solution: Verify credentials, check user is not locked.
|
||||||
|
|
||||||
|
**"User is locked"**
|
||||||
|
```
|
||||||
|
Error: user account is locked
|
||||||
|
```
|
||||||
|
Solution: Unlock user via HANA Studio or SQL.
|
||||||
|
|
||||||
|
### Privilege Errors
|
||||||
|
|
||||||
|
**"Insufficient privilege"**
|
||||||
|
```
|
||||||
|
Error: insufficient privilege: Not authorized
|
||||||
|
```
|
||||||
|
Solution: Use `privilegeError` with GUID to diagnose, grant required roles.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Credential File Issues
|
||||||
|
|
||||||
|
### Missing Credentials
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check file discovery order
|
||||||
|
ls -la default-env*.json
|
||||||
|
ls -la .cdsrc-private.json
|
||||||
|
ls -la .env
|
||||||
|
```
|
||||||
|
|
||||||
|
### Invalid JSON
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Validate JSON syntax
|
||||||
|
cat default-env.json | python -m json.tool
|
||||||
|
```
|
||||||
|
|
||||||
|
### Wrong Credentials Priority
|
||||||
|
|
||||||
|
Remember the priority order:
|
||||||
|
1. `default-env-admin.json` (with --admin)
|
||||||
|
2. `.cdsrc-private.json` (cds bind)
|
||||||
|
3. `.env` file
|
||||||
|
4. `--conn` parameter
|
||||||
|
5. `default-env.json`
|
||||||
|
6. `~/.hana-cli/default.json`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## System Resource Issues
|
||||||
|
|
||||||
|
### Reclaim Resources
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Reclaim storage space
|
||||||
|
hana-cli reclaim
|
||||||
|
```
|
||||||
|
|
||||||
|
Executes:
|
||||||
|
- `ALTER SYSTEM RECLAIM LOB SPACE`
|
||||||
|
- `ALTER SYSTEM RECLAIM LOG`
|
||||||
|
- `ALTER SYSTEM RECLAIM DATAVOLUME 105 DEFRAGMENT`
|
||||||
|
|
||||||
|
### Check Storage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# View data volumes
|
||||||
|
hana-cli dataVolumes
|
||||||
|
|
||||||
|
# View disk info
|
||||||
|
hana-cli disks
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Debug Mode
|
||||||
|
|
||||||
|
Enable debug output:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set DEBUG environment variable
|
||||||
|
DEBUG=* hana-cli <command>
|
||||||
|
|
||||||
|
# Or use --debug flag if available
|
||||||
|
hana-cli <command> --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Reporting Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Open issue on GitHub
|
||||||
|
hana-cli issue
|
||||||
|
```
|
||||||
|
|
||||||
|
Opens browser to create GitHub issue with:
|
||||||
|
- Version information
|
||||||
|
- Environment details
|
||||||
|
- Steps to reproduce
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Getting Help
|
||||||
|
|
||||||
|
### In-CLI Help
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli --help
|
||||||
|
hana-cli <command> --help
|
||||||
|
```
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli readMe
|
||||||
|
hana-cli openReadMe # Opens in browser
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changelog
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli changeLog
|
||||||
|
hana-cli openChangeLog # Opens in browser
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example*](https://github.com/SAP-samples/hana-developer-cli-tool-example*)
|
||||||
245
references/web-ui.md
Normal file
245
references/web-ui.md
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
# SAP HANA CLI - Web UI Reference
|
||||||
|
|
||||||
|
**Source**: [https://github.com/SAP-samples/hana-developer-cli-tool-example](https://github.com/SAP-samples/hana-developer-cli-tool-example)
|
||||||
|
|
||||||
|
The hana-cli includes a browser-based Fiori LaunchPad interface for visual operations.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Launching the Web UI
|
||||||
|
|
||||||
|
### Main UI Command
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli UI
|
||||||
|
```
|
||||||
|
|
||||||
|
Opens a browser-based LaunchPad with all available applications.
|
||||||
|
|
||||||
|
### Command-Specific UIs
|
||||||
|
|
||||||
|
Many commands have UI alternatives:
|
||||||
|
|
||||||
|
| Command | UI Command | Purpose |
|
||||||
|
|---------|------------|---------|
|
||||||
|
| `tables` | `tablesUI` | Browse tables visually |
|
||||||
|
| `containers` | `containersUI` | Manage HDI containers |
|
||||||
|
| `massConvert` | `massConvertUI` | Visual mass conversion |
|
||||||
|
| `querySimple` | `querySimpleUI` | Query builder interface |
|
||||||
|
| `systemInfo` | `systemInfoUI` | System dashboard |
|
||||||
|
| `schemas` | `schemasUI` | Schema browser |
|
||||||
|
| `functions` | `functionsUI` | Function browser |
|
||||||
|
| `indexes` | `indexesUI` | Index browser |
|
||||||
|
| `dataTypes` | `dataTypesUI` | Type reference |
|
||||||
|
| `features` | `featuresUI` | Feature dashboard |
|
||||||
|
| `featureUsage` | `featureUsageUI` | Usage metrics |
|
||||||
|
| `inspectTable` | `inspectTableUI` | Table inspector |
|
||||||
|
| `changeLog` | `changeLogUI` | Version history |
|
||||||
|
| `readMe` | `readMeUI` | Documentation |
|
||||||
|
| `hanaCloudInstances` | `hanaCloudHDIInstancesUI` | Cloud instances |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
### Technology Stack
|
||||||
|
|
||||||
|
- **Framework**: SAPUI5 1.142.0
|
||||||
|
- **Shell**: SAP Universal Shell (ushell)
|
||||||
|
- **Libraries**:
|
||||||
|
- `sap.m` - Mobile controls
|
||||||
|
- `sap.ushell` - Shell container
|
||||||
|
- `sap.ui.layout` - Layout components
|
||||||
|
- `sap.ui.rta` - Runtime adaptation
|
||||||
|
- `sap.uxap` - Object page components
|
||||||
|
|
||||||
|
### Theme Support
|
||||||
|
|
||||||
|
Automatic theme detection:
|
||||||
|
- Light mode: `sap_horizon`
|
||||||
|
- Dark mode: `sap_horizon_dark`
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Theme detection
|
||||||
|
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||||
|
sap.ui.getCore().applyTheme('sap_horizon_dark');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## API Endpoints
|
||||||
|
|
||||||
|
### GET /
|
||||||
|
|
||||||
|
Retrieves current prompts configuration.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Returns JSON with current settings
|
||||||
|
{ schema: "MYSCHEMA", limit: 200, ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
### PUT /
|
||||||
|
|
||||||
|
Updates prompts configuration.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Request body
|
||||||
|
{ schema: "NEWSCHEMA", table: "MYTABLE" }
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Web Server Configuration
|
||||||
|
|
||||||
|
### Default Port
|
||||||
|
|
||||||
|
Commands launch on port 3010 by default.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli cds -p 3010
|
||||||
|
hana-cli UI -p 4000 # Custom port
|
||||||
|
```
|
||||||
|
|
||||||
|
### Port Configuration
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Specify custom port
|
||||||
|
hana-cli <command>UI -p <port>
|
||||||
|
```
|
||||||
|
|
||||||
|
Port range: 1-65535
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Route Structure
|
||||||
|
|
||||||
|
| Route | Handler | Purpose |
|
||||||
|
|-------|---------|---------|
|
||||||
|
| `/` | `index.js` | Main prompts API |
|
||||||
|
| `/dfa` | `dfa.js` | Digital Assistant routes |
|
||||||
|
| `/docs` | `docs.js` | Documentation routes |
|
||||||
|
| `/excel` | `excel.js` | Excel export |
|
||||||
|
| `/inspect` | `hanaInspect.js` | Object inspection |
|
||||||
|
| `/list` | `hanaList.js` | Object listings |
|
||||||
|
| `/static` | `static.js` | Static file serving |
|
||||||
|
| `/ws` | `webSocket.js` | WebSocket connections |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Application Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
app/
|
||||||
|
├── README.md
|
||||||
|
├── ui5.yaml
|
||||||
|
├── ui5-local.yaml
|
||||||
|
├── appconfig/
|
||||||
|
│ └── fioriSandboxConfig.json
|
||||||
|
├── dfa/
|
||||||
|
│ ├── library.js
|
||||||
|
│ ├── library-preload.js
|
||||||
|
│ └── help/
|
||||||
|
├── resources/
|
||||||
|
│ ├── index.html
|
||||||
|
│ ├── init.js
|
||||||
|
│ ├── favicon.ico
|
||||||
|
│ ├── WebAssistant.js
|
||||||
|
│ ├── common/
|
||||||
|
│ ├── inspect/
|
||||||
|
│ ├── massConvert/
|
||||||
|
│ ├── systemInfo/
|
||||||
|
│ └── tables/
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
### Interactive Prompts
|
||||||
|
|
||||||
|
The UI provides visual input for all command parameters:
|
||||||
|
- Schema selection dropdowns
|
||||||
|
- Table/view pickers
|
||||||
|
- Output format selectors
|
||||||
|
- Limit/offset controls
|
||||||
|
|
||||||
|
### Real-Time Results
|
||||||
|
|
||||||
|
Results display in formatted tables with:
|
||||||
|
- Sorting
|
||||||
|
- Filtering
|
||||||
|
- Pagination
|
||||||
|
- Export options
|
||||||
|
|
||||||
|
### Swagger/OpenAPI Documentation
|
||||||
|
|
||||||
|
OData and REST endpoints include Swagger UI:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Access API documentation
|
||||||
|
[http://localhost:3010/api-docs](http://localhost:3010/api-docs)
|
||||||
|
```
|
||||||
|
|
||||||
|
### GraphQL Endpoint
|
||||||
|
|
||||||
|
GraphQL support available at:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
[http://localhost:3010/graphql](http://localhost:3010/graphql)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Integration with External Tools
|
||||||
|
|
||||||
|
### Open Database Explorer
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli openDBExplorer
|
||||||
|
```
|
||||||
|
|
||||||
|
Opens HANA Database Explorer with current credentials.
|
||||||
|
|
||||||
|
**Cloud Region Routing**:
|
||||||
|
- us10, us20: US cloud cockpit URLs
|
||||||
|
- eu10, eu20: EU cloud cockpit URLs
|
||||||
|
- ap10, ap11, ap21: APAC cloud cockpit URLs
|
||||||
|
|
||||||
|
**On-Premise**: Queries `M_INIFILE_CONTENTS` for api_url.
|
||||||
|
|
||||||
|
### Open Business Application Studio
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hana-cli openBAS
|
||||||
|
```
|
||||||
|
|
||||||
|
Opens BAS with current BTP target.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
### Namespace Configuration
|
||||||
|
|
||||||
|
Custom UI5 namespace:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
"sap.hanacli.common": "./common"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Flexibility Services
|
||||||
|
|
||||||
|
Runtime UI adaptation via `SessionStorageConnector`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
- Credentials passed via memory (not URL)
|
||||||
|
- Same-origin requests only
|
||||||
|
- Session-based authentication
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Reference: [https://github.com/SAP-samples/hana-developer-cli-tool-example/tree/main/app*](https://github.com/SAP-samples/hana-developer-cli-tool-example/tree/main/app*)
|
||||||
15
templates/cdsrc-private.json
Normal file
15
templates/cdsrc-private.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"requires": {
|
||||||
|
"db": {
|
||||||
|
"kind": "hana",
|
||||||
|
"binding": {
|
||||||
|
"type": "cf",
|
||||||
|
"apiEndpoint": "https://api.cf.<region>.hana.ondemand.com",
|
||||||
|
"org": "<org-name>",
|
||||||
|
"space": "<space-name>",
|
||||||
|
"instance": "<hdi-service-instance-name>",
|
||||||
|
"key": "<service-key-name>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
templates/default-env.json
Normal file
21
templates/default-env.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"VCAP_SERVICES": {
|
||||||
|
"hana": [
|
||||||
|
{
|
||||||
|
"name": "hana-db",
|
||||||
|
"label": "hana",
|
||||||
|
"tags": ["hana", "database", "relational"],
|
||||||
|
"credentials": {
|
||||||
|
"host": "<hostname>",
|
||||||
|
"port": "<port>",
|
||||||
|
"user": "<username>",
|
||||||
|
"password": "<password>",
|
||||||
|
"schema": "<schema>",
|
||||||
|
"encrypt": true,
|
||||||
|
"sslValidateCertificate": true,
|
||||||
|
"sslTrustStore": "<path-to-certificate>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user