Joys and sorrows of the ABAP Developer Tools API
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
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:
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)
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.
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
Definitely, I’m gonna try ABAP in vscode !!