Rap logo

Rap

Community
likweitan
rap

Help with RAP (RESTful ABAP Programming Model) development including behavior definitions, EML statements, managed and unmanaged BOs, draft handling, actions, validations, determinations, side effects, and business events. Use when users ask about RAP, BDEF, BDL, EML, behavior definitions, behavior pools, managed BO, unmanaged BO, draft-enabled BO, RAP actions, RAP validations, RAP determinations, RAP side effects, RAP business events, create/read/update/delete in RAP, or building transactional Fiori apps with ABAP Cloud. Triggers include "create a RAP BO", "write a behavior definition", "EML syntax", "managed vs unmanaged", "enable draft", "add an action", "add a validation", "RAP handler method", or "RAP saver class".

Overview

Publisherlikweitan
Repositoryabap-skills
Skill namerap
Stars
64
Forks
15
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by likweitan on GitHub. Read the source before you install it.

Installation

Install the Rap AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/likweitan/abap-skills.git /tmp/abap-skills
mkdir -p .claude/skills
cp -r /tmp/abap-skills/skills/rap .claude/skills/rap
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Rap in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Rap on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Rap is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

RAP (RESTful ABAP Programming Model)

Guide for building transactional applications using the ABAP RESTful Application Programming Model (RAP) in ABAP Cloud.

Clean core context: RAP is the leading programming model for ABAP Cloud development, which is clean core Level A. A custom RAP-based Fiori app for the core SAP Cloud ERP scope is Level A; extending a RAP-based SAP Fiori app via released extension points is also Level A. By contrast, SEGW/BOPF/UI5-based apps and their extensions are Level B. Keep RAP handler code restricted to released APIs to stay at Level A — a single internal object call demotes the whole application to Level C. See the abap-cloud skill for level details.

Workflow

  1. Determine the user's goal:

    • Creating a new RAP BO from scratch
    • Adding behavior (actions, validations, determinations) to an existing BO
    • Writing EML statements to consume a RAP BO
    • Troubleshooting RAP-related issues
    • Understanding RAP concepts
  2. Identify the scenario:

    • Managed (greenfield) vs. unmanaged (brownfield)
    • Draft-enabled or not
    • Numbering concept: early/late, internal/external/managed
    • Single entity or composition tree (root + children)
  3. Guide implementation following the RAP layered architecture:

    • Data modeling (database tables → CDS view entities)
    • Behavior definition (BDEF using BDL)
    • Behavior implementation (ABAP behavior pool)
    • Business service exposure (service definition → service binding)
  4. Provide code examples using correct BDL and EML syntax

RAP Architecture Layers

LayerArtifactsPurpose
Data ModelingDatabase tables, CDS root/child view entitiesData persistence and semantic data model
Behavior DefinitionBDEF (.bdef)Declares transactional behavior (operations, characteristics) using BDL
Behavior ImplementationABAP behavior pool (BP_*)Implements business logic in handler/saver classes
ProjectionCDS projection views, projection BDEFAdapts BO for specific service consumers
Business ServiceService definition, service bindingExposes BO as OData service

Implementation Types

Managed (Greenfield)

  • Framework handles transactional buffer and standard CRUD operations automatically
  • Only need custom code for non-standard operations (actions, validations, determinations)
  • Automatic save handling (can be enhanced with additional save or replaced with unmanaged save)
managed implementation in class zbp_r_entity unique;
strict ( 2 );

Unmanaged (Brownfield)

  • Developer provides transactional buffer and implements all operations
  • Used when existing business logic needs to be embedded in RAP
unmanaged implementation in class zbp_r_entity unique;
strict ( 2 );

Behavior Definition (BDL) Quick Reference

Complete BDEF Structure

managed implementation in class zbp_r_root unique;
strict ( 2 );
with draft;

define behavior for ZR_Root alias Root
persistent table zroot_tab
draft table zroot_d
etag master LocalLastChangedAt
lock master
total etag LastChangedAt
authorization master ( global )
late numbering
{
  // Field characteristics
  field ( readonly ) RootUUID, CreatedBy, CreatedAt, LastChangedBy, LastChangedAt;
  field ( mandatory ) Description;
  field ( numbering : managed ) RootUUID;

  // Standard operations
  create;
  update;
  delete;

  // Association to child entity
  association _Child { create; }

  // Actions
  action doSomething result [1] $self;
  static action createFromTemplate parameter ZD_CreateParam result [1] $self;
  internal action recalculate;

  // Validations
  validation validateDescription on save { create; field Description; }

  // Determinations
  determination setDefaults on modify { create; }
  determination calcTotal on modify { field Quantity, Price; }

  // Draft actions
  draft action Resume;
  draft action Edit;
  draft action Activate optimized;
  draft action Discard;
  draft determine action Prepare
  {
    validation validateDescription;
  }

  // Side effects
  side effects
  {
    field Quantity affects field TotalAmount;
    field Price affects field TotalAmount;
    determine action Prepare executed on field Description affects messages;
  }

  // Events
  event created;
  event deleted parameter ZD_DeletedEvent;

  // Mapping
  mapping for zroot_tab corresponding
  {
    RootUUID = root_uuid;
    Description = description;
  }
}

define behavior for ZR_Child alias Child
persistent table zchild_tab
draft table zchild_d
etag master LocalLastChangedAt
lock dependent by _Root
authorization dependent by _Root
{
  field ( readonly ) ChildUUID, RootUUID;
  field ( numbering : managed ) ChildUUID;

  update;
  delete;

  association _Root;

  mapping for zchild_tab corresponding
  {
    ChildUUID = child_uuid;
    RootUUID = root_uuid;
  }
}

Projection BDEF

projection;
strict ( 2 );
use draft;

define behavior for ZC_Root alias Root
{
  use create;
  use update;
  use delete;

  use action doSomething;

  use association _Child { create; }
}

define behavior for ZC_Child alias Child
{
  use update;
  use delete;

  use association _Root;
}

Key BDL Elements

ElementSyntaxPurpose
Managed numberingfield ( numbering : managed ) KeyField;Framework assigns UUID keys automatically
Early numberingearly numberingCustom key assignment in interaction phase via FOR NUMBERING handler
Late numberinglate numberingKey assignment in save sequence via adjust_numbers saver method
Lock masterlock masterRoot entity controls pessimistic locking
Lock dependentlock dependent by _AssocChild entity delegates locking to parent
ETagetag master FieldNameOptimistic concurrency control
Total ETagtotal etag FieldNameRequired for draft-enabled BOs
Draftwith draft;Enables draft handling for entire BO
Collaborative draftwith collaborative draft;Multi-user draft editing
Strict modestrict ( 2 );Enables additional BDL syntax checks (use latest version)

ABAP Behavior Pool (ABP)

Handler Class

abap
CLASS lhc_root DEFINITION INHERITING FROM cl_abap_behavior_handler.
  PRIVATE SECTION.

    " Standard operations (unmanaged only)
    METHODS create FOR MODIFY
      IMPORTING entities FOR CREATE Root.

    " Action implementation
    METHODS doSomething FOR MODIFY
      IMPORTING keys FOR ACTION Root~doSomething RESULT result.

    " Validation
    METHODS validateDescription FOR VALIDATE ON SAVE
      IMPORTING keys FOR Root~validateDescription.

    " Determination
    METHODS setDefaults FOR DETERMINE ON MODIFY
      IMPORTING keys FOR Root~setDefaults.

    " Instance feature control
    METHODS get_instance_features FOR INSTANCE FEATURES
      IMPORTING keys REQUEST requested_features FOR Root RESULT result.

    " Instance authorization
    METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION
      IMPORTING keys REQUEST requested_authorizations FOR Root RESULT result.

ENDCLASS.

CLASS lhc_root IMPLEMENTATION.

  METHOD doSomething.
    " Read current instance data
    READ ENTITIES OF zr_root IN LOCAL MODE
      ENTITY Root
      ALL FIELDS WITH CORRESPONDING #( keys )
      RESULT DATA(entities)
      FAILED failed.

    " Modify instances
    MODIFY ENTITIES OF zr_root IN LOCAL MODE
      ENTITY Root
      UPDATE FIELDS ( Status )
      WITH VALUE #( FOR entity IN entities
        ( %tky = entity-%tky
          Status = 'DONE'
          %control-Status = if_abap_behv=>mk-on ) )
      FAILED failed
      REPORTED reported.

    " Fill result
    result = VALUE #( FOR entity IN entities
      ( %tky = entity-%tky
        %param = entity ) ).
  ENDMETHOD.

  METHOD validateDescription.
    READ ENTITIES OF zr_root IN LOCAL MODE
      ENTITY Root
      FIELDS ( Description ) WITH CORRESPONDING #( keys )
      RESULT DATA(entities).

    LOOP AT entities INTO DATA(entity).
      IF entity-Description IS INITIAL.
        APPEND VALUE #( %tky = entity-%tky ) TO failed-root.
        APPEND VALUE #( %tky = entity-%tky
          %msg = new_message_with_text(
            severity = if_abap_behv_message=>severity-error
            text = 'Description must not be empty' )
          %element-Description = if_abap_behv=>mk-on
        ) TO reported-root.
      ENDIF.
    ENDLOOP.
  ENDMETHOD.

  METHOD setDefaults.
    READ ENTITIES OF zr_root IN LOCAL MODE
      ENTITY Root
      ALL FIELDS WITH CORRESPONDING #( keys )
      RESULT DATA(entities).

    MODIFY ENTITIES OF zr_root IN LOCAL MODE
      ENTITY Root
      UPDATE FIELDS ( Status CreatedAt )
      WITH VALUE #( FOR entity IN entities
        ( %tky = entity-%tky
          Status = 'NEW'
          %control-Status = if_abap_behv=>mk-on ) )
      REPORTED reported.
  ENDMETHOD.

ENDCLASS.

Saver Class

abap
CLASS lsc_root DEFINITION INHERITING FROM cl_abap_behavior_saver.
  PROTECTED SECTION.
    METHODS finalize REDEFINITION.
    METHODS check_before_save REDEFINITION.
    METHODS save_modified REDEFINITION.
    METHODS cleanup REDEFINITION.
    METHODS cleanup_finalize REDEFINITION.
ENDCLASS.

CLASS lsc_root IMPLEMENTATION.
  METHOD finalize.
    " Final calculations before save
  ENDMETHOD.

  METHOD check_before_save.
    " Final consistency checks
  ENDMETHOD.

  METHOD save_modified.
    " Only needed for 'with additional save' or 'with unmanaged save'
    " Raise business events here
    IF create-root IS NOT INITIAL.
      RAISE ENTITY EVENT zr_root~created
        FROM VALUE #( FOR <cr> IN create-root
          ( %key = VALUE #( RootUUID = <cr>-RootUUID ) ) ).
    ENDIF.
  ENDMETHOD.

  METHOD cleanup.
    " Clear transactional buffer
  ENDMETHOD.

  METHOD cleanup_finalize.
    " Rollback finalize changes on failure
  ENDMETHOD.
ENDCLASS.

EML (Entity Manipulation Language) Quick Reference

EML is the ABAP language for programmatically interacting with RAP BOs. Key operations: MODIFY ENTITY (create/update/delete/execute action), READ ENTITIES, COMMIT ENTITIES, ROLLBACK ENTITIES.

  • Create: MODIFY ENTITY ... CREATE FIELDS ( ... ) WITH VALUE #( ( %cid = '...' ... ) )
  • Read: READ ENTITIES OF ... ALL FIELDS WITH VALUE #( ( key = val ) ) RESULT DATA(result)
  • Update: MODIFY ENTITY ... UPDATE FIELDS ( ... ) WITH VALUE #( ( %tky = ... ) )
  • Delete: MODIFY ENTITY ... DELETE FROM VALUE #( ( %tky = ... ) )
  • Execute Action: MODIFY ENTITY ... EXECUTE actionName FROM VALUE #( ( %tky = ... ) )
  • Deep Create: Use CREATE BY \_Assoc with %cid_ref and %target

For full EML syntax with code examples, read references/eml-quick-reference.md.

Draft Handling

  • Enabled via with draft; in BDEF header
  • Requires separate draft table for each entity
  • Draft table must include "%admin": include sych_bdl_draft_admin_inc;
  • Draft actions (Edit, Activate, Discard, Resume, Prepare) are implicitly provided
  • Use %is_draft component (or %tky which includes it) to distinguish draft vs. active instances

RAP Save Sequence

PhaseMethods CalledPurpose
Early Savefinalizecheck_before_save → (on failure: cleanup_finalize)Ensure data consistency
Late Saveadjust_numberssave / save_modifiedcleanupPersist data to database
  • Early save failures (sy-subrc = 4) return to interaction phase
  • Late save is point of no return — either commit succeeds or runtime error

Key BDEF Derived Type Components

ComponentPurpose
%cidContent ID — unique preliminary identifier for new instances
%cid_refReference to a %cid in the same EML request
%keyPrimary key fields
%tkyTransactional key (%key + %is_draft + %pid) — recommended
%dataAll key and data fields
%controlFlags indicating which fields are provided/requested
%is_draftDraft indicator (draft-enabled BOs only)
%pidPreliminary ID (late numbering only)
%targetTarget instances for create-by-association
%paramAction/function parameter values

Best Practices

  • Always use strict ( 2 ); for new BOs
  • Prefer %tky over %key for future-proof code (handles draft/late numbering transitions)
  • Always fill %cid in create operations even if not referenced later
  • Use IN LOCAL MODE in handler methods to bypass feature controls and authorization checks
  • Implement validations for data consistency checks, determinations for calculated fields
  • Keep handler methods focused; use ABP auxiliary classes for shared logic
  • For managed BOs, only implement handler methods for non-standard operations

References

Clean Core Level Notes for RAP

ScenarioLevelNotes
Custom RAP-based Fiori app for the core scopeATarget state for new applications
Extension of a RAP-based SAP Fiori app via released extension pointsAPreferred extension approach
RAP BO consuming only released CDS views and released APIsAKeep handler/saver code restricted to released APIs
RAP BO consuming a classic API (transactional-consistent)BOnly classic APIs labelled transactional-consistent are safe inside RAP
RAP BO consuming an internal object or direct table readCWrap the object and create a single ATC exemption
Custom SEGW / BOPF / UI5 appBPrefer RAP; exceptions could be know-how or reuse
Extension of an SEGW / BOPF / UI5 Fiori appBMigrate to the delivered RAP app when available
SE54-based BC UIBPrefer a RAP-based Business Configuration app

Key rule: a classic API may only be used inside a RAP application if it carries the transactional-consistent label in the Cloudification Repository. Other classic APIs may break RAP's transactional model.

Related Skills

  • cds-view-entities: Use for data modeling that forms the foundation of RAP business objects
  • abap-sql-amdp: Use for implementing complex database operations in RAP
  • authorization-iam: Use for implementing RAP authorization checks
  • odata: Use for exposing RAP business objects as OData services
  • rap-business-events: Use for implementing event-driven patterns in RAP
  • abap-cloud: Use for clean core level classification and the wrapper pattern
  • badi-enhancement: Use for implementing released RAP BAdIs to extend standard RAP BOs

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Rap AI skill do?

Help with RAP (RESTful ABAP Programming Model) development including behavior definitions, EML statements, managed and unmanaged BOs, draft handling, actions, validations, determinations, side effects, and business events. Use when users ask about RAP, BDEF, BDL, EML, behavior definitions, behavior pools, managed BO, unmanaged BO, draft-enabled BO, RAP actions, RAP validations, RAP determinations, RAP side effects, RAP business events, create/read/update/delete in RAP, or building transactional Fiori apps with ABAP Cloud. Triggers include "create a RAP BO", "write a behavior definition", "E...

Why use Rap on TypingMind?

Because you install it once and use it with any model. Rap is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Rap in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/likweitan/abap-skills/tree/main/skills/rap. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Rap?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Rap?

As many as you like. As long as a model supports skills, you can use Rap with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Rap AI skill free?

Yes. It is published on GitHub by likweitan under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇