sap-abap

安装量: 130
排名: #6611

安装

npx skills add https://github.com/secondsky/sap-skills --skill sap-abap

This skill includes 28 comprehensive reference files covering all aspects of ABAP development:

  • sap-abap-cds: For CDS view development and ABAP Cloud data modeling

  • sap-btp-cloud-platform: For ABAP Environment setup and BTP deployment

  • sap-cap-capire: For CAP service integration and ABAP system connections

  • sap-fiori-tools: For Fiori application development with ABAP backends

  • sap-api-style: For API documentation standards and best practices

Quick Access

  • Reference Guide: references/skill-reference-guide.md - Complete guide to all reference files

  • Internal Tables: references/internal-tables.md - Complete table operations

  • ABAP SQL: references/abap-sql.md - Comprehensive SQL reference

  • Object Orientation: references/object-orientation.md - Classes and interfaces

Development Topics

  • references/constructor-expressions.md - VALUE, NEW, COND, REDUCE

  • references/rap-eml.md - RAP and EML operations

  • references/cds-views.md - CDS view development

  • references/string-processing.md - String functions and regex

  • references/unit-testing.md - ABAP Unit framework

  • references/performance.md - Optimization techniques

  • ... and 18 more specialized references

Common Patterns

Safe Table Access (Avoid Exceptions)

" Using VALUE with OPTIONAL
DATA(line) = VALUE #( itab[ key = value ] OPTIONAL ).

" Using VALUE with DEFAULT
DATA(line) = VALUE #( itab[ 1 ] DEFAULT VALUE #( ) ).

" Check before access
IF line_exists( itab[ key = value ] ).
  DATA(line) = itab[ key = value ].
ENDIF.

Functional Method Chaining

DATA(result) = NEW zcl_builder( )
  ->set_name( `Test` )
  ->set_value( 123 )
  ->build( ).

FOR Iteration Expressions

" Transform table
DATA(transformed) = VALUE itab_type(
  FOR wa IN source_itab
  ( id = wa-id name = to_upper( wa-name ) ) ).

" With WHERE
DATA(filtered) = VALUE itab_type(
  FOR wa IN source WHERE ( status = 'A' )
  ( wa ) ).

" With INDEX INTO
DATA(numbered) = VALUE itab_type(
  FOR wa IN source INDEX INTO idx
  ( line_no = idx data = wa ) ).

ABAP Cloud Compatibility

" Use released APIs only
DATA(uuid) = cl_system_uuid=>create_uuid_x16_static( ).
DATA(date) = xco_cp=>sy->date( )->as( xco_cp_time=>format->iso_8601_extended )->value.
DATA(time) = xco_cp=>sy->time( )->as( xco_cp_time=>format->iso_8601_extended )->value.

" Output in cloud (if_oo_adt_classrun)
out->write( result ).

" Avoid: sy-datum, sy-uzeit, DESCRIBE TABLE, WRITE, MOVE...TO

Error Catalog

CX_SY_ITAB_LINE_NOT_FOUND

Cause: Table expression access to non-existent line Solution: Use OPTIONAL, DEFAULT, or check with line_exists( )

CX_SY_ZERODIVIDE

Cause: Division by zero Solution: Check divisor before operation

CX_SY_RANGE_OUT_OF_BOUNDS

Cause: Invalid substring access or array bounds Solution: Validate offset and length before access

CX_SY_CONVERSION_NO_NUMBER

Cause: String cannot be converted to number Solution: Validate input format before conversion

CX_SY_REF_IS_INITIAL

Cause: Dereferencing unbound reference Solution: Check IS BOUND before dereferencing

Performance Tips

  • Use SORTED/HASHED tables for frequent key access

  • Prefer field symbols over work areas in loops for modification

  • Use PACKAGE SIZE for large SELECT results

  • Avoid SELECT in loops - use FOR ALL ENTRIES or JOINs

  • Use secondary keys for different access patterns

  • Minimize CORRESPONDING calls - explicit assignments are faster

Source Documentation

All content based on SAP official ABAP Cheat Sheets:

返回排行榜