Skip to main content

Quick Tour

This tour takes about 10 minutes. By the end you will have created a package, added a class with a unit test, checked it into an abapGit repository on disk, and cleaned up. You need:

  • An SAP system you can write to (a local sandbox or BTP trial works best).
  • A user with change authorization.
  • An open transport, or authority to create one.

Assuming DEV is your default system (see auth); every step also works with --sid <SID>.

Step 1 — Sanity check

adt info
adt discovery

info confirms the session. discovery lists the ADT services your system exposes — make sure oo/classes, aunit, and cts/transports are present.

Step 2 — Create a transport

adt cts transport create \
--description "Quick tour demo" \
--type K
Created transport DEVK900555

Save the TR number — later steps use it. See adt cts transport.

tip

On BTP / S/4HANA Cloud use adt gcts branches instead of classical transports. The rest of the tour still works; just skip the CTS steps.

Step 3 — Create a package

adt package create ZTOUR_DEMO \
--description "Quick tour playground" \
--software-component HOME \
--transport DEVK900555

Reference: adt package.

Step 4 — Create a class

adt objects class create ZCL_TOUR_DEMO \
--package ZTOUR_DEMO \
--description "Quick tour class" \
--transport DEVK900555

adt pushes the skeleton via the OO classes contract, then acquires a lock so you can add real source.

Step 5 — Add source code

Write the implementation locally:

mkdir -p tour
cat > tour/zcl_tour_demo.abap <<'ABAP'
CLASS zcl_tour_demo DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
METHODS add IMPORTING a TYPE i b TYPE i RETURNING VALUE(r) TYPE i.
ENDCLASS.

CLASS zcl_tour_demo IMPLEMENTATION.
METHOD add.
r = a + b.
ENDMETHOD.
ENDCLASS.
ABAP

adt objects class source put ZCL_TOUR_DEMO \
--file tour/zcl_tour_demo.abap \
--transport DEVK900555

put runs the full write cycle for you: lock → PUT source → unlock. On failure it always releases the lock.

Now add a unit test include:

cat > tour/zcl_tour_demo.testclasses.abap <<'ABAP'
CLASS ltcl_tour DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS should_add FOR TESTING.
ENDCLASS.

CLASS ltcl_tour IMPLEMENTATION.
METHOD should_add.
cl_abap_unit_assert=>assert_equals(
exp = 7
act = NEW zcl_tour_demo( )->add( a = 3 b = 4 ) ).
ENDMETHOD.
ENDCLASS.
ABAP

adt objects class source put ZCL_TOUR_DEMO \
--include testclasses \
--file tour/zcl_tour_demo.testclasses.abap \
--transport DEVK900555

Reference: adt objects, adt source, adt lock.

Step 6 — Activate

adt objects class activate ZCL_TOUR_DEMO
Activated 1 object: ZCL_TOUR_DEMO

Step 7 — Run the unit test

adt aunit ZCL_TOUR_DEMO --coverage
ZCL_TOUR_DEMO
✓ should_add 4ms
1 passed, 0 failed, 0 skipped Coverage 100%

Reference: adt aunit.

Step 8 — Check out the package as abapGit

mkdir tour-repo && cd tour-repo
adt checkout --package ZTOUR_DEMO --format abapgit .
tour-repo/
src/
ztour_demo.devc.xml
zcl_tour_demo.clas.abap
zcl_tour_demo.clas.testclasses.abap
zcl_tour_demo.clas.xml

You now have a plain-file snapshot of the package in abapGit layout. Diff it, commit it to git, or push it into a gCTS repo.

Reference: adt checkout, adt gcts.

Step 9 — Re-import the other direction

To prove round-trip fidelity:

adt checkin --package ZTOUR_DEMO --format abapgit . \
--transport DEVK900555 --dry-run

--dry-run reports what would change without writing. Drop it to push for real.

Reference: adt checkin.

Step 10 — Clean up

cd ..
adt objects class delete ZCL_TOUR_DEMO --transport DEVK900555
adt package delete ZTOUR_DEMO --transport DEVK900555
adt cts transport release DEVK900555
warning

delete is irreversible and respects ADT's dependency rules. If deletion is rejected, check for referenced objects (adt get --where-used).

What you used

StepCommandReference
Identityadt info / adt discoveryinfo, discovery
Transportsadt cts transport …cts-transport
Structureadt package … / adt objects class …package, objects
Sourceadt objects class source putsource
Testsadt aunitaunit
Repoadt checkout / adt checkincheckout, checkin

Next steps