Write clean ABAP code with modern syntax, CDS views, and best practices
✓Works with OpenClaudeYou are an ABAP developer. The user wants to write clean, maintainable ABAP code using modern syntax, CDS (Core Data Services) views, and SAP best practices.
What to check first
- Verify your SAP system version supports CDS views (NetWeaver 7.50 or higher)
- Check if you're using SAP GUI, ADT (ABAP Development Tools), or VS Code with ABAP extension
- Confirm access to the data dictionary and necessary development namespaces
Steps
- Define a CDS data model with
@AccessControl.authorizationCheck: #CHECKannotation for security - Use
@Metadata.allowExtensions: trueto enable analytical queries on the view - Create semantic annotations (
@Semantics.amount.currencyCode,@Semantics.businessDate.at) for proper data interpretation - Write SELECT statements using
open SQLsyntax instead of deprecatednative SQLorexec sql - Apply filtering with
WHEREclauses in CDS views rather than in application code for better performance - Use
ASSOCIATIONSin CDS to define relationships instead of manual joins in ABAP code - Implement input validation using
@Validation.allowedValuesannotations in the view - Structure your ABAP classes with clear separation: model layer (CDS), service layer, and presentation layer
Code
@EndUserText.label: 'Sales Order Header CDS View'
@AccessControl.authorizationCheck: #CHECK
@Metadata.allowExtensions: true
define view ZC_SalesOrderHeader
as select from vbak as Header
association [0..1] to ZI_Customer as _Customer on Header.kunnr = _Customer.kunnr
association [1..*] to ZC_SalesOrderItem as _Items on Header.vbeln = _Items.vbeln
{
@Semantics.businessDate.at: true
Header.erdat as CreatedDate,
@Semantics.amount.currencyCode: 'waerk'
Header.netwr as NetAmount,
Header.waerk as CurrencyCode,
Header.vbeln as SalesOrderNumber,
Header.kunnr as CustomerNumber,
Header.auart as DocumentType,
_Customer,
_Items
}
@OData.publish: true
define service ZUI_SalesOrderService {
expose ZC_SalesOrderHeader as SalesOrder;
expose ZC_SalesOrderItem as SalesOrderItem;
}
CLASS zcl_sales_order_processor DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
METHODS get_sales_orders
IMPORTING
iv_customer_number TYPE kunnr
EXPORTING
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related SAP Skills
Other Claude Code skills in the same category — free to download.
SAP Fiori App
Build SAP Fiori applications with SAPUI5 and Fiori Elements
SAP BTP Setup
Set up and deploy applications on SAP Business Technology Platform
SAP HANA Query
Write and optimize SAP HANA SQL queries and calculation views
SAP OData Service
Create and consume OData services in SAP (V2 and V4)
SAP RFC Connector
Connect to SAP via RFC/BAPI from external applications
SAP CDS Model
Create Core Data Services models and annotations for SAP
SAP CAP App
Build full-stack applications with SAP Cloud Application Programming Model
SAPUI5 Component
Build reusable SAPUI5 components with MVC pattern
Want a SAP skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.