Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keller-michael/markdown_table_via_abap_cds_and_abap_sql
⚗️ create a Markdown table via ABAP CDS and ABAP SQL statement SELECT
https://github.com/keller-michael/markdown_table_via_abap_cds_and_abap_sql
abap abap-cds cds example experimental fun learning-by-doing markdown markdown-table
Last synced: 2 months ago
JSON representation
⚗️ create a Markdown table via ABAP CDS and ABAP SQL statement SELECT
- Host: GitHub
- URL: https://github.com/keller-michael/markdown_table_via_abap_cds_and_abap_sql
- Owner: Keller-Michael
- License: mit
- Created: 2024-01-27T07:42:36.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-11T06:52:41.000Z (5 months ago)
- Last Synced: 2024-10-10T02:23:44.290Z (2 months ago)
- Topics: abap, abap-cds, cds, example, experimental, fun, learning-by-doing, markdown, markdown-table
- Language: ABAP CDS
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⚗️ Markdown table via ABAP CDS and ABAP SQL
Just a small, non-serious free time SAP BTP project along the lines of: “Is that actually possible?” The answer is: "Yes it is!". You can use ABAP CDS and ABAP SQL statement SELECT to get data from the database directly as a Markdown table. I can't think of a business case for this scenario, but it's nice that it's possible 😂
## Design
There are 4 different ABAP CDS to create a Markdown table output for entries in database table /DMO/AIRPORT:
1) [ZI_MD_HEADER](/src/zi_md_header.ddls.asddls): Headline with needed columns
2) [ZI_MD_ALIGNMENT](/src/zi_md_alignment.ddls.asddls): Alignment of columns
3) [ZI_MD_LINES](/src/zi_md_lines.ddls.asddls): Lines from database table /DMO/AIRPORT
4) [ZC_MD_TABLE](/src/zc_md_table.ddls.asddls): Combines the other 3 ABAP CDS from 1) to 3) by UNIONAs UNION has no given sort order I solved this problem via ABAP SQL SELECT ... ORDER BY ...:
```abap
METHOD if_oo_adt_classrun~main.
SELECT * FROM zc_md_table ORDER BY AirportID INTO TABLE @DATA(markdown_table).
out->write( markdown_table ).
ENDMETHOD.
```## Output example
### Raw Markdown table
```Markdown
| **Airport ID** | Name | City | Country |
| :--- | :--- | :--- | :--- |
| ACA | General Juan N. Álvarez Int. Airport | Acapulco, Guerrero | MX |
| ACE | Lanzarote Airport | Lanzarote, Canary Islands | ES |
| BKK | Suvarnabhumi Airport | Bangkok | TH |
| BOS | Logan International Airport | Boston, Massachusetts | US |
| CDG | Charles de Gaulle Airport | Paris | FR |
```### GitHub interpreted Markdown table
| **Airport ID** | Name | City | Country |
| :--- | :--- | :--- | :--- |
| ACA | General Juan N. Álvarez Int. Airport | Acapulco, Guerrero | MX |
| ACE | Lanzarote Airport | Lanzarote, Canary Islands | ES |
| BKK | Suvarnabhumi Airport | Bangkok | TH |
| BOS | Logan International Airport | Boston, Massachusetts | US |
| CDG | Charles de Gaulle Airport | Paris | FR |