Skip to Content
Technical Articles

Joys and sorrows of the ABAP Developer Tools API

Introduction

The ADT is the basis of ABAP in eclipse, and it’s a bit of a strange beast.

It’s basically a RESTful API delivered over RFC. So you don’t give Eclipse an URL to access to but a SAPGUI connection.

 

This is well known and explained in this old blog from Jerry Wang which has been a great starting point for tinkering with it. Looking at the ABAP communication log is very easy to figure out how the API works

One think it doesn’t tell is that the same API is also available over regular http(s) once the right endpoint is enabled in SICF

Which allows us to use it from any platform that can do rest calls.

A few months ago I started using it to create the vscode extension I recently wrote about

 

Accessing ADT from Node.js

After a friend made me notice the API interface per se could be useful for other projects, I extracted and refactored the API in an NPM module. It’s far from comprehensive, but does allow to access a good share of it from javascript or typescript.

 

The sorrows

While it’s great to be able to access this API, and most calls are rather straightforward, I did get my share of headaches running around this or that quirk. A quick catalogue of the worst:

Stateful sessions

While http was designed to be stateless, ADT locks files before saving them and unlocks them after. This requires stateful connections, which SAP/BSPs has been supporting for a while.

Sadly the ADT plugin started honouring this only around basis 7.51.

Eclipse doesn’t have this issue as RFC is stateful by nature

To overcome this I wrote a small plugin which makes it possible for older systems (tested on a 7.31)

 

Stateless operations

Like saving or deleting an object require a stateful connection, creating one require a stateless call.

Weird things happens if you use a stateful session to create an object, like closing the session (which invalidates all links) and not being able to search for the object until the connection is dropped

A statelessClone property allows to use a secondary connection for stateless calls.

Format changes

API went through quite a few changes over the years.

Some subtle, like the different type IDs for usage references found in methods.

Some fundamental like a method which returns HTML in 7.31 and XML in 7.5x, or an object type only supported

The library is a bit inconsistent about how much

Conclusions

While for many applications PyRfc is probably a better option, I hope this will be valuable as a libary if you want to access the ADT API from javascript, or as an example for other languages. Should be possible doing it from a browser too but I never tried

2 Comments
You must be Logged on to comment or reply to a post.