Sunday, December 11, 2022

Code ABAP in MS Visual Studio Code

Microsoft Visual Studio Code (Code) is popular programmer’s IDE these days. First, it is a free, open source, cross-platform code editor. It includes support for debugging, syntax highlighting, IntelliSense code completion, and embedded Git. The Code also includes built-in tools for web development such as IntelliSense, code snippets, and refactoring. It can be used for both small and large projects, and is a great choice for developers who want to quickly create applications without having to learn a complex language. It is a lightweight code editor that can be used to write, debug, and test code across many different programming languages, including JavaScript, CSS, Node.js, and HTML.

Wait a bit, what about ABAP? Can I use the VS Code to code in the ABAP? It turns out yes you can! It is possible due to “ABAP remote filesystem for visual studio code” (ABAP FS) plugin to the Code written by Marcello Urbani. Let us have a look how to install this extension to develop in ABAP in MS Visual Studio Code.

Install the Code (e.g. from here). I choose a version for MS Windows OS. Notice that you can even installed in MS Windows machines where you do not have an administrator rights granted. Once it is installed open the extension part of it from left side. Here type ABAP remote filesystem for visual studio code to search for this plug. Once it is found click on little blue Install button to get it installed.

There are few more plugins to be installed as they are dependencies to the ABAP one. Thus also install following ones:

·        ABAP by Lars Hvam

·        ABAP CDS language Support by Frederik Hudak

·        Winregistry by Marcello Urbani

Another requirement is to have installed ABAP Development tools for eclipse (ADT) installed in SAP HANA Studio on a machine where you installed the MS Code. You can install the ADT from here https://tools.hana.ondemand.com/#abap.

One more prerequisite is to enable ADT specific service at SAP ABAP server. Once you log in there via SAP GUI run SICF t-code. Navigate to the service: default_host -> sap -> bc -> adt. If the service is not active just activate it via right click: Activate service.

Now you need to setup the ABAP plugin in the Code. In the Code, navigate to ABAP FS extension and click on little Manage icon and then choose Extension Settings


Here choose Edit in settings.json.


In the JSON file, provide an input into following fields:

·        SID of ABAP NetWeaver system (3 characters abbreviations)

·        url of ABAP NetWeaver system

·        username in the ABAP NetWeaver system

·        password of above user

·        client of ABAP NetWeaver system

Once this is done press F1 and enter following command:

ABAPfs Connect to an ABAP system

Afterwards, there should be a new icon appearing in left part of yoru CODE IDE called ABAP FS. 


Now you can go to Explorer part of the Code and here you can access ABAP repository objects e.g. under $TMP development class that belong to yoru user. From here, you just click on the ABAP object e.g. program and it gets opened in the Editor.


I faced following issues while setting the plugin up:

·        No ABAP filesystem mounted in current workspace – I forgot to update url part of configuration JSON file for the plugin.

·        Unable to get local issuer certificate - I forgot to put SID of my ABAP system in configuration JSON file for the plugin.

  

More information:

MS Visual Studio Code download page

Plugin wiki

Plugin issues

Plugin installation

No comments: