abap-cds-model-check
Optional intended usage such as analytical, transactional, reuse, value-help, or extraction
Converts between standalone SQLScript procedures and AMDP class implementations
$ npx -y skills add secondsky/sap-skills --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/sqlscript-convertContext preview
What this command does when you run it.
Converts between standalone SQLScript procedures and AMDP class implementations
name: sqlscript-convert description: Converts between standalone SQLScript procedures and AMDP class implementations allowed-tools: - Read - Grep argument-hint: "<file_path> --to <amdp|standalone|cds-function>"
Return a conversion plan, compatibility risks, generated snippet if requested, validation checklist, and confirmation points before writes. Default to read-only conversion guidance; write converted files only when the user explicitly confirms the target path.
Convert SQLScript code between different formats: standalone procedures to AMDP, AMDP to standalone, and CDS integration patterns.
/sqlscript-convert [file_path] --to amdp /sqlscript-convert [file_path] --to standalone /sqlscript-convert [file_path] --to cds-function
Converts a standalone SQLScript procedure or function into an AMDP class with proper:
Extracts SQLScript from an AMDP method into a standalone procedure with:
Converts an AMDP table function for CDS view consumption with:
1. **Analyze source code**:
2. **Generate target code**:
3. **Validate result**:
## SQLScript Conversion Result **Source**: [original file] **Source Type**: [Standalone Procedure/AMDP/Table Function] **Target Type**: [AMDP/Standalone/CDS Function] ### Type Mappings Used | Original | Converted | Notes | |----------|-----------|-------| | INTEGER | i | ABAP integer | | NVARCHAR(100) | string | ABAP string | ... ### Tables Referenced - [table1] - Added to USING clause - [table2] - Added to USING clause ### Generated Code #### [Class Definition / Procedure Header] ```abap/sql [code]
[code]
[How to call the converted code]
1. [Any manual steps needed] 2. [E.g., Create types in ABAP]
## Examples ### Convert Procedure to AMDP
/sqlscript-convert src/procedures/calc_totals.sql --to amdp
### Convert AMDP to Standalone
/sqlscript-convert src/classes/zcl_orders.abap --to standalone
### Convert to CDS Function
/sqlscript-convert src/procedures/get_data.sql --to cds-function
## Type Mapping Reference ### SQLScript to ABAP (for --to amdp) | SQLScript | ABAP Type | Notes | |-----------|-----------|-------| | INTEGER | i | Standard integer | | BIGINT | int8 | 8-byte integer | | DECIMAL(p,s) | p LENGTH p DECIMALS s | Packed number | | DOUBLE | f | Floating point | | NVARCHAR(n) | c LENGTH n or string | Character | | DATE | d | Date (YYYYMMDD) | | TIME | t | Time (HHMMSS) | | TIMESTAMP | utclong | UTC timestamp | ### ABAP to SQLScript (for --to standalone) | ABAP Type | SQLScript | Notes | |-----------|-----------|-------| | i | INTEGER | Standard integer | | int8 | BIGINT | 8-byte integer | | p | DECIMAL | Preserve precision | | f | DOUBLE | Floating point | | c, string | NVARCHAR | Use appropriate length | | d | DATE | Convert from YYYYMMDD | | t | TIME | Convert from HHMMSS | | utclong | TIMESTAMP | UTC timestamp | ## Conversion Templates ### Standalone to AMDP Template **Source (Standalone)**: ```sql CREATE PROCEDURE "SCHEMA"."GET_ORDERS"( IN iv_customer_id INTEGER, OUT et_orders TABLE (id INTEGER, amount DECIMAL(15,2)) ) LANGUAGE SQLSCRIPT AS BEGIN et_orders = SELECT id, amount FROM orders WHERE customer_id = :iv_customer_id; END;
**Target (AMDP)**:
CLASS zcl_orders DEFINITION PUBLIC FINAL.
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
TYPES: BEGIN OF ty_order,
id TYPE i,
amount TYPE p LENGTH 15 DECIMALS 2,
END OF ty_order,
tt_orders TYPE STANDARD TABLE OF ty_order.
CLASS-METHODS get_orders
IMPORTING VALUE(iv_customer_id) TYPE i
EXPORTING VALUE(et_orders) TYPE tt_orders.
ENDCLASS.
CLASS zcl_orders IMPLEMENTATION.
METHOD get_orders BY DATABASE PROCEDURE
FOR HDB LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
USING orders.
et_orders = SELECT id, amount
FROM orders
WHERE customer_id = :iv_customer_id;
ENDMETHOD.
ENDCLASS.When this command is invoked:
1. **Parse source file**:
2. **Map types**:
3. **Generate target structure**:
4. **Identify tables**:
5. *
40 SAP development plugins with evidence-tracked verification SAP development plugins for AI coding assistants, with public-source or package-registry verification tracked where available.
Repo: secondsky/sap-skills
Optional intended usage such as analytical, transactional, reuse, value-help, or extraction
Optional target ABAP platform or SAP BTP ABAP Environment release
Optional runtime or scenario name, such as orchestration, serving, training, or batch
Optional scenario lens such as extension, integration, analytics, or AI