ABAP Guide: Set Up a Local ABAP Playground

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Checked on 2026-11-13 against open-abap (transpiler 2.14.30, open-abap-core a9acc41), abaplint 2.120.103 and Node.js 24.21.

What you build

You build a small project folder, named abap-lab, in which ABAP programs run on your own computer. You install Node.js, write the four configuration files of the project, add two sample ABAP objects (a report named zhello and a class named zcl_greeter with one unit test), and run them with three commands: npm test runs the unit test, npm run lint checks the code with abaplint, and npm run run:hello runs the report.

The playground is open-abap, a community open-source project, not SAP software. A tool called a transpiler translates your ABAP files into JavaScript, and Node.js runs the JavaScript. It implements only a part of the ABAP language and has no SAP GUI, no ABAP Dictionary tools, no CDS and no RAP, so a program that works here still needs a check on a real SAP system before you rely on it there.

Terminal with the command npm run run:hello followed by the transpiler’s file counts and the line Hello from the local ABAP playground

Before you start

  • No account is needed: Node.js, the abaplint tools and open-abap install from the public npm registry and from GitHub without signing in. The licences you accept by installing (MIT for the abaplint packages and for open-abap-core) are listed in the README of the ABAP lab. The computer needs an internet connection for the installation and for the first transpile, which downloads the open-abap library from GitHub.

  • You need a terminal (a window where you type commands) and a text editor. The steps use Visual Studio Code, a free editor, but any editor that saves plain text files works for everything except the extension step.

  • The files of this guide are also in the folder modules/ROOT/examples/abap-lab/ of the documentation sources. Type them yourself rather than copying them, so that you meet each command and its output on your own screen.

  • Read Getting Started first if you have never seen an ABAP program. The guide Your First ABAP Program is the next one, and it adds a class of your own to this project.

  • The figures are drawings of the editor and the terminal, not screenshots. A highlighted box with a number marks the file or line of the step with the same number.

Steps

Install Node.js

Node.js is a program that runs JavaScript outside a browser. It comes with npm, a tool that downloads packages (ready-made programs) and runs the scripts of a project.

  1. Install a current Node.js, version 22.12 or newer, from the Node.js download page, with the installer for your operating system. Then open a terminal and ask for the two versions:

    node --version
    npm --version

    Each command prints a version number. This guide was checked with v24.21.0 and 11.19.0; yours may be newer.

    Terminal with the command node --version, which prints v24.21.0, and npm --version, which prints 11.19.0; callout 1 marks the node command

Create the project

A project is a folder with a package.json file. That file is the project’s list of needs: its name, the packages it uses and the scripts (named commands) you can run with npm run.

  1. In the terminal, create the folder and go into it. Open the same folder in your editor (in Visual Studio Code: File, then Open Folder).

    mkdir abap-lab
    cd abap-lab
  2. In the folder, create the file package.json with this content. The devDependencies are the four packages of the playground: the transpiler (@abaplint/transpiler-cli), its runtime (@abaplint/runtime), the in-memory database that ABAP SQL uses later (@abaplint/database-sqlite) and the checker abaplint (@abaplint/cli). The four scripts are the commands you run in this guide.

    {
      "name": "abap-lab",
      "version": "1.0.0",
      "private": true,
      "scripts": {
        "transpile": "abap_transpile abap_transpile.json",
        "test": "npm run transpile && node output/index.mjs",
        "run:hello": "npm run transpile && node output/project/zhello.prog.mjs",
        "lint": "abaplint abaplint.json"
      },
      "devDependencies": {
        "@abaplint/cli": "2.120.103",
        "@abaplint/database-sqlite": "2.14.12",
        "@abaplint/runtime": "2.14.30",
        "@abaplint/transpiler-cli": "2.14.30"
      },
      "engines": {
        "node": ">=22.12"
      }
    }

    Notice that test and run:hello start with npm run transpile &&. The two ampersands mean "and then, only if that worked", so a command never runs old output after a failed transpile.

    Visual Studio Code with the empty abap-lab folder holding only the new file package.json, which lists the four scripts transpile, test, run:hello and lint and the four abaplint packages; callout 3 marks package.json in the explorer
  3. Install the packages. This downloads them into a new folder node_modules and creates the file package-lock.json, which records the exact versions. It prints a short summary:

    npm install
    added 8 packages, and audited 9 packages in 3s
    
    3 packages are looking for funding
      run `npm fund` for details
    
    found 0 vulnerabilities

    The timing differs on your computer. Source: npm install (npm documentation)

Write the configuration files

Three more files tell the tools where your ABAP sources are and how to check them. Create each in the abap-lab folder.

  1. Create abap_transpile.json, the settings of the transpiler. It reads the ABAP files from the folder src, writes JavaScript into the folder output, loads the open-abap library from GitHub (libs), writes the code that runs ABAP Unit tests (write_unit_tests) and names the setup file of step 6.

    {
      "input_folder": "src",
      "input_filter": [],
      "output_folder": "output",
      "libs": [
        { "url": "https://github.com/open-abap/open-abap-core" }
      ],
      "write_unit_tests": true,
      "write_source_map": true,
      "options": {
        "ignoreSyntaxCheck": false,
        "addFilenames": true,
        "addCommonJS": true,
        "setup": {
          "filename": "../setup.mjs",
          "preFunction": "setup"
        }
      }
    }
  2. Create setup.mjs. It runs before every program and test, and connects the in-memory database that open-abap uses in place of a real SAP database. The sample here does not read any table, but the later guides do.

    import {SQLiteDatabaseClient} from "@abaplint/database-sqlite";
    import {MemoryDataset} from "@abaplint/runtime";
    
    export async function setup(abap, schemas, insert) {
      abap.context.databaseConnections["DEFAULT"] = new SQLiteDatabaseClient();
      await abap.context.databaseConnections["DEFAULT"].connect();
      await abap.context.databaseConnections["DEFAULT"].execute(schemas.sqlite);
      await abap.context.databaseConnections["DEFAULT"].execute(insert);
      abap.context.dataset = new MemoryDataset();
    }
  3. Create abaplint.json, the settings of abaplint. files says which files to check, syntax says which ABAP release to check against, and rules lists the checks to run. Without a rules section abaplint reports nothing, so the list matters.

    {
      "global": {
        "files": "/src/**/*.*",
        "skipGeneratedGatewayClasses": true
      },
      "dependencies": [
        { "url": "https://github.com/open-abap/open-abap-core", "files": "/src/**/*.*" }
      ],
      "syntax": {
        "version": "v758",
        "errorNamespace": "^(Z|Y|LCL_|TY_|LIF_)"
      },
      "rules": {
        "parser_error": true,
        "check_syntax": true,
        "unknown_types": true,
        "unused_variables": true,
        "keyword_case": { "style": "upper" },
        "line_length": { "length": 120 },
        "indentation": true,
        "whitespace_end": true
      }
    }

    Source: abaplint and abaplint rules

    Visual Studio Code with abap_transpile.json open: it names the src folder, the output folder, the open-abap-core library and the setup module; callout 5 marks abap_transpile.json, callout 6 marks setup.mjs and callout 7 marks abaplint.json in the explorer

Add the sample ABAP objects

An ABAP object in the playground is stored as two files with the same name, the layout of the abapGit project: a .abap file with the source and a .xml file with the object’s attributes. A report is <name>.prog.abap and <name>.prog.xml. A class is <name>.clas.abap and <name>.clas.xml, and its unit tests go in a third file, <name>.clas.testclasses.abap. Create a folder src and add these files to it.

  1. Create the report src/zhello.prog.abap with its attribute file src/zhello.prog.xml. The REPORT statement names the program, and WRITE prints a line in a classic list.

    REPORT zhello.
    
    WRITE / 'Hello from the local ABAP playground'.
    <?xml version="1.0" encoding="utf-8"?>
    <abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
     <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
       <PROGDIR>
        <NAME>ZHELLO</NAME>
        <SUBC>1</SUBC>
        <RLOAD>E</RLOAD>
        <UCCHECK>X</UCCHECK>
       </PROGDIR>
      </asx:values>
     </asx:abap>
    </abapGit>
  2. Create the class src/zcl_greeter.clas.abap with a method greet that builds a greeting, its test file src/zcl_greeter.clas.testclasses.abap and its attribute file src/zcl_greeter.clas.xml. The test class ltcl_greeter is marked FOR TESTING; its method creates the class, calls greet and compares the answer with the expected text.

    CLASS zcl_greeter DEFINITION PUBLIC FINAL CREATE PUBLIC.
      PUBLIC SECTION.
        METHODS greet
          IMPORTING name          TYPE string
          RETURNING VALUE(result) TYPE string.
    ENDCLASS.
    
    CLASS zcl_greeter IMPLEMENTATION.
      METHOD greet.
        result = |Hello, { name }!|.
      ENDMETHOD.
    ENDCLASS.
    CLASS ltcl_greeter DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
      PRIVATE SECTION.
        METHODS greets_by_name FOR TESTING.
    ENDCLASS.
    
    CLASS ltcl_greeter IMPLEMENTATION.
      METHOD greets_by_name.
        DATA(cut) = NEW zcl_greeter( ).
        cl_abap_unit_assert=>assert_equals( act = cut->greet( `World` ) exp = `Hello, World!` ).
      ENDMETHOD.
    ENDCLASS.
    <?xml version="1.0" encoding="utf-8"?>
    <abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
     <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
       <VSEOCLASS>
        <CLSNAME>ZCL_GREETER</CLSNAME>
        <LANGU>E</LANGU>
        <DESCRIPT>Greeter</DESCRIPT>
        <STATE>1</STATE>
        <CLSCCINCL>X</CLSCCINCL>
        <FIXPT>X</FIXPT>
        <UNICODE>X</UNICODE>
       </VSEOCLASS>
      </asx:values>
     </asx:abap>
    </abapGit>
    Visual Studio Code with the src folder holding the report zhello and the class zcl_greeter, and the report file zhello.prog.abap is open and shows its single WRITE statement; callout 8 marks the report file and callout 9 marks the test file of the class in the explorer

Run the sample

  1. Run the unit test. The transpiler first translates the ABAP files into JavaScript, then Node.js runs the tests. The first run also downloads the open-abap library, so it takes a little longer. The transpiler prints how many files it found and how many output files it wrote (the figure shows one example run; your counts will differ); the last line comes from the test:

    npm test
    ZCL_GREETER: running ltcl_greeter->greets_by_name

    The command ends without an error message, which means the test passed. The figure leaves out the lines that name the cloned library version.

    Terminal after npm test: the transpiler counts its source and library files and reports the output files written (one example run), and the test run prints ZCL_GREETER: running ltcl_greeter→greets_by_name; callout 10 marks the command
  2. Check the code with abaplint. It prints its version, the configuration file it used and the ABAP release it checked against, and ends with a count of findings:

    npm run lint
    abaplint: 0 issue(s) found, 5 file(s) analyzed

    The figure leaves out the release lines and the blank lines.

    Terminal after npm run lint: abaplint prints its version and configuration lines and ends with abaplint: 0 issue(s) found, 5 file(s) analyzed; callout 11 marks the command
  3. Optional: install the abaplint extension in Visual Studio Code. In the Extensions view, search for abaplint and install the one published by Lars Hvam; it comes from the Visual Studio Code Marketplace and needs no account. It reads the same abaplint.json and, according to its Marketplace page, offers linting with a problems view, go to definition, find references and quick fixes. Open an .abap file of the project to use it. The commands of the other steps do not depend on it. Source: abaplint (Visual Studio Marketplace)

  4. Run the report:

    npm run run:hello

Check the result

npm run run:hello ends without an error and, after the transpiler’s file counts, prints Hello from the local ABAP playground. npm test prints the test line and ends without an error, and npm run lint prints abaplint: 0 issue(s) found, 5 file(s) analyzed. If all three work, the playground is ready for Your First ABAP Program.

Variations

  • Change the text in src/zhello.prog.abap and run npm run run:hello again.

  • Change the expected text in the test file from Hello, World! to Hello, Mars! and run npm test to watch a test fail. The guide on ABAP Unit tests covers this in detail.

  • Add a line such as DATA unused TYPE i. to the report and run npm run lint to see abaplint report an unused variable.

What can go wrong

Symptom Cause Fix

sh: abap_transpile: command not found

The packages are not installed: npm install did not run, or it ran in another folder.

Run npm install in the abap-lab folder.

npm error enoent Could not read package.json

The terminal is in a folder without a package.json.

Change into the abap-lab folder with cd and run the command again.

Error: Cannot find module with the path output/index.mjs

You ran node output/index.mjs yourself before the first transpile, so the output folder does not exist.

Run npm test: it transpiles first.

Error: Cannot find module with the path output/project/zhello.prog.mjs although the transpiler finished

The report file has a different name, for example zhello.abap instead of zhello.prog.abap, so no JavaScript file was made for it.

Rename the file to <name>.prog.abap and keep the name layout <name>.<type>.abap.

abaplint: 0 issue(s) found for code that has a problem

abaplint.json has no rules section, so abaplint has nothing to check.

Add the rules section of step 7.

Where to go next