Technical Articles
ABAP Development in VS Code
When I started learning ABAP I found myself getting increasingly frustrated with the speed at which the SAP GUI for Java responded and I looked for other options, this is how I found that you can mount your SAP system as a filesystem in VS Code. This blog will cover how you can get started with developing ABAP from VS Code.
Note: If you are not running Netweaver v7.51+ you will have to install a patch that can be found as part of the first plugin install options.
Getting the right plugins
VS Code is required for this tutorial along with the following plugins:
Once you have installed these plugins you can begin configuring your SAP System as a Remote FileSystem.
Note: In this blog I will only cover the configuration of the ABAP Remote FileSystem plugin. For further information on configuring the other plugins listed, please review the VS Code Marketplace/GitHub repositories.
Configuring your SAP system
In order to connect to your SAP system you will need to enable the ABAP Development Tools (ADT) ICF node, this is the same service that tools such as the SAP Hana Studio use.
Open your SAP GUI and connect to the target system, run the transaction SICF and then activate the ADT_SRV service as shown below.
This enables the service that allows code editors and IDEs to connect to your SAP system.
Configuring VS Code
Configuring this plugin to connect to your SAP system is straightforward, just open up your VS Code settings by pressing “Control/Command + ,” select “Extensions” in the menu and then in the “ABAP-FS” plugin, click on “Edit in settings.json”.
Then you need to update the below block of json to include your SAP system and user details. You can find the URL details by right-clicking the node in SICF on the SAP System (like when we turned the service on, earlier) and selecting “Test Service”.
This will open the ADT service and you can copy the top-level domain and port number from there.
"abapfs.remote": {
"My SAP System label": {
"url": "https://my-sap-system:8012/",
"username": "my-username",
"password": "my-password",
"client": "920",
"language": "EN",
"allowSelfSigned": true
}
}
Note: The usual rules apply… if you’re on an SAP system that’s only accessible on a specific network then you’ll still need to be on that network to connect!
This will create a system profile for you to connect to in VS Code, once you’ve saved your settings press F1 (the shortcut to launch a command) and start typing “ABAP” and you should see the “ABAPfs Connect to an ABAP system” command appear, click on this. Then select the profile you just set-up and you will connect to your system.
Writing ABAP in VS Code
Now that you’re connected to your SAP system, you can start creating your own reports, classes and structures in VS Code. To get started, make sure that you already have a transport open for your user, you cannot create transports from VS Code.
Transport Management
You can view transports assigned to you (or a colleague) by opening the SAP plugin in the sidebar as pictured below:
Creating an ABAP Object
To create an ABAP object in VS Code, you simply right-click somewhere in your workspace and select “ABAPfs Create object”.
You will then have to select one of the supported object types, these include Core Data Services (CDS) objects. Once you have selected the type of object you are creating, you must write a name and description for the object and then assign it to a package and transport.
Activating changes to an object
When you edit an ABAP object in VS Code, you don’t need to bounce back into the SAP GUI to activate your changes. You can do this in VS Code by clicking on the “activate” wand in the top right corner of your object editor.
The breadcrumbs along the top of your editor full support navigation to related objects just like any other language.
Using VS Code for ABAP day-to-day
Now you’re setup to write ABAP in VS Code! Congratulations and I hope you make use of VS Code’s “Zen Mode” (shortcut: Ctrl+K Z) to minimise distractions.
I will leave you with a word of warning, I don’t think that his setup is quite “production-ready” yet… The major issue I found using this for 5 weeks or so, is that your object-locking can be a little volatile and require a restart of VS Code and that there’s no SAP GUI integration like you have with Eclipse. That said, it’s still great for just sitting down and getting on with some code.
I hope you’ve enjoyed getting setup and that this makes you at least a little more productive, let me know how you get on in a comment.
Thanks for this post Leon!
That's really a nice plugin for all the ABAP'ers out there!
Welcome to the bleeding edge of ABAP development!
A small note: the ABAP and CDS highlighting plugins do not need to be installed separately as they are dependencies of abap-remote-fs.
By the way, did anyone try using remote fs with visual studio live share? If it works like I imagine, I think that by sharing the remote workspace, you could achieve live centralized development without the downside of locking files (I'm missing a friend with 15 minutes of spare time to try this out).
Hi Leon Hassan,
Thanks a lot for your detailed blog! It was really helpful!
After configuring everything as you mentioned, I am getting an error message stating 'Error: No ABAP server connection active for <SID>'. Could you please help me resolving this problem?
Hi Akhilesh,
Are ABAP Development Tools (ADT) enabled on the system?
Nice blog!
I have test this way. If it can debug abap code,I will drop Eclipse .
Hello,
This looks amazing! I'm trying to configure this but I'm having the following error:
Failed to connect to <my-sap-label>:Error: Invalid protocol: <server_host>
The system I'm trying to connect is reachable via Eclipse IDE.
Thank you
Sérgio
You need 2 things:
Eclipse connects over RFC, so the connection requirements are quite different
Hi Marcello Urbani, Thanks for your guidance on this. I'm having a similar issue but I'm not 100% clear on point 2 and 3. Are you saying that VSCode has to run over HTTP(s)?
Yes. Eclipse uses RFC, which would be easy enough to support and would allow connecting using your existing sapgui configuration.
But binary dependencies are forbidden in code extensions, and distributing the required rfc library is forbidden by sap
Thanks for the advertising and the helpful tutorial.
Will probably add a link in my wiki
Hi ,
after installing the plugin and configuring my system i got message: command 'abapfs.connect' not found .
dose someone have this issue also ?
Did you restart vscode?
sweet ... love a bit of VSCode!!!
stupid question, how do you do a data preview for a CDS view in VScode?
Not supported at the moment
Thank you for this informative blog! I am currently exploring how to use VS Code in ABAP and this post is very timely!
My system is currently running on NW 7.3 and not 7.5. Can this be the reason why I don't see the ADT_SRV odata service in SICF? Can I create this service on my own?
Hello
Did you find a solution to your problem?
I don't have the ADT_SRV on my system aswell but i was able to connect VScode to the SAP Sytem using the ADT service default_host -> sap -> bc -> adt.
But i do run into the problem that i can't find my package (own Namespace) with the CDS Views i would like to activate.
I'm not sure if my problem lies in the "wrong" service or if i have a problem with the Namespace.
Thanks for this great tutorial, vs code is more pure and cool env to code.
One more thing to mention, when anyone encounter a error to connect ABAP system, I think it can be solved by change the setting.json file as bellow :
Hello Jerry,
I also have the same configuration, and I was able to connect to my SAP system ($TMP folder is now visible), but there are no contents inside. When VSCode is trying to retrieve code, I am getting the 403: Forbidden error. Could you please point me to the right direction on how to resolve this?
Hi Jini,
Yes, I am also facing same issue, still seeking solution, will update if any finding.
Can you access the url in a browser?
Hi there!
Very nice feature!
I'm getting the following error:
Connecting to <my-sap-label> via Eclipse IDE is possible.
Any ideas?
Thank you!
Hi
I managed to connect by following your blog. Thank you.
I am however concerned about hardcoding user login credentials. Is there a way to hide login credentials in the settings?
Thank you
You could set up an environments file that contains a variable for your username and password, this should work without having to install any additional tools
Hi
will be single-sign-on supported in the future?
I think I need this too.
In the eclipse I connect easly, but VS Code I got error.
Hello Everyone,
Had a chance to play around with this plugin, It is allowing me to surf the packages but while doing a save, the plugin throws me the following error. I understand that i will have to use zabapgit_full to gain a write access since my SAP version is less than 7.5. Can you anyone help me on the flow pls.
Failed to save 'ZMANUPROG_CHAT_BOX.prog.abap': Unable to write file 'adt://npl/System Library/ZTESTINGPROG/Source Library/Programs/ZMANUPROG_CHAT_BOX/ZMANUPROG_CHAT_BOX.prog.abap' (TypeError: Cannot read property 'asx:values' of undefined)
Thanks
Manu
If before 7.5 you need a plugin linked in the plugin Readme.
This error though looks like a bigger issue, might be that your system is just too old. I did manage on a 7.31 one.
Hi Leon,
I configured the vs code as you said, and run normally, but I can't access the program that other user created in local or in package $tmp under other account.
Should I configure some other things?
Chad
Hi Leon,
I configured the VS Code as you said, but VS Code can't connect to ABAP remote system. The follow is error message:
Please let me know how to fix that error.
Thanks,
Thang
If you can access the url via the browser, you'll have to open an issue with the developer of the plugin. If you can't access via the browser either, it is likely a permissions issue
Hi,
I have the following error :
How can I solve this ???
Alex Glorie
Have you tried clearing your browser cookies and data and revalidating your login in VS Code?
Hi,
I am getting the error as below
“Failed to connect to npl:Error: write EPROTO 1253944680:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:”
Please advice me to solve this?
Note: I am able to access the same system using Eclipse.
Thanks,
SS
Restarted the VS editor and it worked.
Nice to see all these comments. But for technical support I would recommend you to use the github issues page
https://github.com/marcellourbani/vscode_abap_remote_fs/issues
Hi Guys,
I finally managed to get things up and running. I made a short video on the subject as well if anyone needs any more help.
Youtube link – https://youtu.be/hzjNnRcYmqY
Thanks again for the brilliant blog post!
Great post!
Nice Blog Post. Awesome. Leon but I faced one error in releasing Transport Task. Maybe the tool is not supporting all functionalities. But if I missed something then please guide me.
Error in Transport Task release
Great stuff. I was wondering if we can we add abap on cloud trial system to VS code ? 🙂
yes, you can do this really easily now. it's covered in my book: https://www.sap-press.com/visual-studio-code-for-sap_5605/
Hi Leon,
cool stuff! Do you know if it is possible to do the same with the Business Application Studio (BAS), that is based on Eclipse Theia?
Thx. & BR
Aleks
hey aleks, it's unfortunately not possible as the extension is not compatible. however. you can use the in-built tools to access an ABAP BTP trial, as you do with vs code using the fiori extension pack.
it might be worth reaching out to Marcello, the extension author for VS Code and asking if it could be made compatible with BAS 🙂
Hi Leon,
I connected to my system but cant find any files in #tmp and system library path, can yu please help ?
it might be a network issue where there are so many objects that it is taking a very long time to load, leave it in the background and see if that sorts the issue. If not, raise an issue on Marcello's github in an earlier comment 🙂
Hi,
I can't see ADT_SRV in my system Netweaver 7.50.
What could be the reason? Also I don't see ABAP-FS . I have installed plugin with name ABAP remote filesystem. Is it same ?
Hi ,
After installing the plugin and configuring the extension i got message: command 'abapfs.connect' not found .
dose someone have this issue also ?
I've already restart vscode
got the same...
two things could be the reason why it is working now:
After that it worked for me
Hi Leon Hassan,
Great blog on ABAP in VS Code. I just have a small suggestion, can you please change
to SAP System ID, and also add a little comment to tell that this is the ID of the system one is connecting to. Not sure if it matters that much but I did spent some nice hours on resolving an issue that was coming because I thought that My SAP System Label means a label I am giving to the system I am adding in the config file.
Error: Failed to connect to XXX:Error: connect ETIMEDOUT XXXXXXXX
Nice post Leon. I tried at in to VS Code at Mac (OS X) and worked fine.
Very cool 😉
If someone doesn't want to write the password in the json file, you can leave the password as a empty string. Later when you connect to the system, you'll be asked to type in your password.
using ENV files is also an option, just a local file on your computer that you can point the configuration to 🙂
Hi,
I'm getting error for Extension v1.6.3
Failed to connect to XXX:AxiosError: Request failed with status code 403
I've tested with Extension v0.8.5 and get the error:
Failed to connect to XXX:Error: Forbidden
ADT_SRV in SICF is working fine and I can see the expected response in the browser.
I'm using http. As I've seen is some examples this should work.
Any ideas where is the root cause of the problem?
Thanks.
Hi...
FYI, I've found the problem...
I had to activate the service /sap/bc/adt in SICF as explained in:
https://github.com/marcellourbani/vscode_abap_remote_fs/wiki/installation
I only had before /sap/opu/odata/sap/adt_srv where I set the credential.
Regards,
Alfonso.
Thank you, i need to activate service in /sap/bc/adt
Hi !
I was able to connect to connect to the system , but the list of objects is not expanded in the folder .
Also I get the following error .
What could be the problem ?
HI ,
I have the following error :
how do I solve this problem?
very nice extension!
but is it possible to create and edit includes?
with reports and classes it worked fine for me but includes seems to not be supported yet, is it true?