abap-sql-amdplisted
Help with modern ABAP SQL features and AMDP (ABAP Managed Database Procedures) including inline declarations, window functions, GROUP BY, HAVING, PRIVILEGED ACCESS, string functions, aggregate expressions, common table expressions (CTE), AMDP classes, AMDP procedures, AMDP table functions, CDS table functions, and AMDP scalar functions. Use when users ask about ABAP SQL, modern SQL, SELECT, window functions, CTE, common table expression, AMDP, SQLScript, AMDP table function, CDS table function, aggregate, GROUP BY, HAVING, UNION, INTERSECT, EXCEPT, PRIVILEGED ACCESS, ABAP SQL expressions, built-in SQL functions, or database procedures. Triggers include "ABAP SQL query", "window function", "CTE", "AMDP", "table function", "GROUP BY", "aggregate", "PRIVILEGED ACCESS", "inline SELECT", or "SQLScript".
williamcorrea23/sap-router-skill · ★ 1 · API & Backend · score 66
Install: claude install-skill williamcorrea23/sap-router-skill
# ABAP SQL & AMDP
Guide for writing modern ABAP SQL statements and ABAP Managed Database Procedures (AMDP) in ABAP Cloud and Standard ABAP.
## Workflow
1. **Determine the user's goal**:
- Writing or optimizing ABAP SQL queries
- Using advanced SQL features (window functions, CTEs, aggregates)
- Creating AMDP procedures or functions
- Implementing CDS table functions via AMDP
- Understanding PRIVILEGED ACCESS for authorization bypass
2. **Identify the context**:
- ABAP for Cloud Development vs. Standard ABAP (affects available syntax)
- Performance optimization needs
- Whether AMDP is justified (prefer ABAP SQL when possible)
3. **Guide implementation** using modern ABAP SQL syntax
## Modern ABAP SQL Quick Reference
### Basic SELECT with Inline Declaration
```abap
"Single record
SELECT SINGLE FROM ztravel
FIELDS travel_id, description, total_price, currency_code
WHERE travel_id = @lv_travel_id
INTO @DATA(ls_travel).
"Multiple records into internal table
SELECT FROM ztravel
FIELDS travel_id, description, total_price, currency_code
WHERE status = 'O'
ORDER BY total_price DESCENDING
INTO TABLE @DATA(lt_travels)
UP TO 100 ROWS.
```
### Expressions in SELECT List
```abap
SELECT FROM zflight
FIELDS carrier_id,
connection_id,
flight_date,
seats_max - seats_occupied AS seats_free,
CASE WHEN seats_occupied > seats_max * 80 / 100
THEN 'FULL'
ELSE 'AVAILABLE'
END