Skip to Content
Technical Articles
Author's profile photo Mateusz Skrzyniarz

ChatGPT for SAP developments – threat or an opportunity?

ChatGPT has become big. If the internet is something to go by, it is THE NEXT BIG THING, and I mean like Industry 4.0 + 1. Whatever that might be – Industry 5.0, Internet 5.0, Conversations 5.0? I’ll leave the naming to marketing experts.

We have all seen hundreds of articles on the internet on how ChatGPT is revolutionising the world and how jobs will be taken by it. Ahh well, we’ve been hearing about jobs being taken over by AI for the last few years but, our jobs were always safe – we are programmers! The problem is, this revolution is slightly different – apparently, it affects MAINLY programmers…

This blog post is divided into the following sections:

  • Capabilities of ChatGPT
  • How can ABAP developers start using ChatGPT today – examples
  • What are ChatGPT’s weaknesses and limitations
  • Should ABAP developers worry about their future – 4 key takeaways
  • What could happen next… – Daydreaming session

What are the capabilities of ChatGPT

In order to be able to answer the question of this article, let’s look at the capabilities of ChatGPT, specifically for software developers. If you ask ChatGPT itself, it’ll give you the following answer:

As an AI language model, I do not have the ability to actually write software. However, I can understand and generate natural language text about programming concepts and various programming languages. I can assist with coding by providing information on syntax, code samples, and program outputs.

Oh, how modest… Yet when you ask it to write an ABAP report that takes flight number and departure date as input parameters and presents other connections with the same origin and destination that depart within 10 days before/after the specified date, it presents the following output:

(if you are non-technical, you can scroll past the code 🙂)

Output%20generated%20by%20ChatGPT

Output generated by ChatGPT

So, here is the first thing about ChatGPT – it’s a liar! 😉 It actually is pretty good at writing code much faster than most of the developers would.

Additionally, when I asked it to change this code to be object-oriented and provide an ABAP Unit test class for it, it spat out the following 2 snippets:

  1. Implementation

Output%20generated%20by%20ChatGPT

Output generated by ChatGPT

2. ABAP Unit

Output%20generated%20by%20ChatGPT

Output generated by ChatGPT

Well, at this point, we could get picky and question the fact that both the selection and presentation logic are stuffed into one method, we could also question the fact that it generated a dedicated “alternatives” class instead of a generic flight handler with an alternatives method, or that it named everything as a local class, though we wanted to create a global object. But this isn’t the point…

The point is, that ChatGPT managed to turn a 2-sentence, natural-language excerpt into something that we can copy & paste into ADT (ABAP Development Tools) and develop further. If there is ANYBODY in the world who could do it faster, please message me and I will hire you today for a lot of money.

How can ABAP developers make use of ChatGPT?

I am yet to test this in real life but because I haven’t really been involved in a development project since ChatGPT was published, I can only work on some hypothetical scenarios that I can think of. However, if I was now taking over a new ABAP development requirement, here is what I would use ChatGPT for:

SQL statements on standard tables

I had a shot at asking ChatGPT to create an SQL query for me that accesses sales order data, here is the first attempt:

Output%20generated%20by%20ChatGPT

Output generated by ChatGPT

As you can tell, it isn’t great… Sales_order_header table does not exist and these field names seem too reader-friendly to be SAP!

So, I decided to continue the chat and give ChatGPT more details as to what I want:

The result of this were a lot better! I got the correct field names, the syntax now looks like ABAP and I could pretty much copy&paste this into a report and develop it to what I want.

What about something more complex – CDS Views with a few joins, for example? Here you go:

Output%20generated%20by%20ChatGPT

Output generated by ChatGPT

How much did it take to generate? 20 seconds to write my query, another 20s for the answer. I’m going to repeat – if there is ANYBODY in the world that can write all this in less than a minute, please contact me.

Scaffolding for ABAP & ABAP Unit classes

The next potential use case for ChatGPT in your daily work is to build a scaffolding for your ABAP classes. Let’s imagine we have a scenario where we need a DAO (Data Access Object) class that will act as our only channel that interacts with the data layer. Here is how ChatGPT handles my query:

Output%20generated%20by%20ChatGPT

Output generated by ChatGPT

Not perfect – the definition part is missing the methods and has some strange public create private statement within it, there is no check for entries in lt_materials before the VBAK call. But still, it can be copied&pasted into an IDE and developed further. The actual selection logic is pretty spot on. Time needed: Around 90 seconds in total.

Report selection screens

Now, let’s use the DAO class we created above and wrap it in a report that takes the required parameters as user input. The results should be shown in an ALV grid.

Output%20generated%20by%20ChatGPT

Output generated by ChatGPT

I will say one thing – WOW. It handled the radio button, created a well structured case statement and even put the results in an ALV grid. Though I’m not sure if this ALV would actually work correctly, I still think it’s pretty impressive, especially because it took me around 40 seconds to get to!

Note: I did not actually run any of the code so if there are errors in it that I’d overlooked – I’m sorry.

What is ChatGPT still pretty weak at?

But, it’s not all that beautiful. ChatGPT is fairly fresh and it has its flaws and limitations. Here are a few we should all keep in the back of our heads, when using it.

Outdated model

The current version of ChatGPT is based on 2021 training data that’s available on the internet. Because it’s already 2 years old and the SAP ecosystem has evolved a lot since then, there might be minor discrepancies in the results it provides. ChatGPT-4 which is rumoured to launch in 2023 is even more advanced. What improvements to writing ABAP will it bring? Let’s wait and see.

Quality of answers

ChatGPT is “just” a language model, it will inevitably provide wrong answers. Therefore, relying solely on its output might not be a good idea just yet. I would recommend cross-checking the answers it provides with either a reliable source. In ABAP programming, a simple copy & paste to ADT/ABAP Workbench would most likely already highlight the major issues.

Note: It might still be too early to try to ace that job interview for a role you have no clue about!

Understanding of input

As you can see above, when I asked ChatGPT to create an SQL statement for me, without giving it enough context, it did not reply saying “I’m not sure if I understood you correctly, could you please provide more context” to eliminate the guesswork. Instead, it simply replied with what it thought was the best match. It takes a bit of practice to get these queries to enough level detail so again, it’s best to have at least some sort of an idea of the expected output.

It’s all text

The results delivered by ChatGPT are in text format. Which means that we still need somebody to take care of non-code configurations, filling of customising tables, transporting changes, copying and pasting code into an ABAP editor and potentially debugging to find problems.

Should ABAP developers worry about their future?

No, they shouldn’t. They should not worry about their future just yet, providing they pass the innovation check, i.e., embrace the evolution of ChatGPT and start using its capabilities to their advantage. Here are my 4 key takeaways for ABAP developers:

  1. Customers, managers and architects will gradually start adjusting their effort estimations based on how quickly easy things can be achieved with ChatGPT. They’ll no longer accept 5 days of effort on your timesheet labeled “Creation of ABAP classes and ABAP Unit test classes”. The sooner you start using ChatGPT, the better it’ll be for you. Remember, writing good-context queries also takes some getting used to.
  2. A ChatGPT-focused ABAP developer will soon become a lot more valued than one that ignores it.
  3. Direct connection of ChatGPT to SAP systems to actually trigger actions is highly unlikely. There is too much undiscovered security risk in this area right now and unless it can be carefully governed, it’ll not be easy to execute. So, for the time-being, ChatGPT will remain “just” your chatbot friend who can answer your questions.
  4. SAP ecosystem is extremely integrated and replacing developers would not only be about replacing the person that hits the keys on his/her keyboard to produce code. It would also have to replace people that are responsible for configuring connections, customising standard modules, creating extensions, etc. A lot of it is still click-based.

Daydreaming – what if….

How far can it get? How much can Chat-GPT potentially evolve? These are 2 questions that many IT professionals ask themselves nowadays. The roadmap of Chat-GPT & SAP is still unclear but here are some of my far-fetched thoughts on it…

No-code/low-code

SAP is investing a lot of effort in no-code/low-code tools. These tools aren’t meant to completely replace developers but instead, they are supposed to open the world of software to non-technical users. What if we could integrate them with Chat-GPT, would they eventually become strong enough to completely do away with the need for software developers? Could Chat-GPT eventually become the developer you’d need the odd time, when using no-code/low-code tools?

BTP CLI & SAP system access

Can Chat-GPT get so advanced and so trusted that it’ll eventually get direct access to on-premise systems and the BTP? Can you imagine asking Chat-GPT to create a Fiori Elements app and host it on BTP and the result would be a fully functional, deployed application?

Security vulnerability

At the end of the day, Chat-GPT is an extremely smart model that can cause havoc. How do we remain safe after we let this undiscovered guest into our systems?

I would love to hear your thoughts on Chat-GPT. Do you use it already or are you planning to start? How do you see its future? Let me know in the comments below!

Assigned Tags

      20 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Angel Cruz Gonzalez
      Angel Cruz Gonzalez

      From my point of view this kind of AI tools may be a help for us when we want to generate some quick source code to avoid wasting time on some repeated tasks, but human interaction always will be needed the to give it sense to things created by the bots. At this moment is not perfect but this can serve us as an starting point when we don't have enough time to code and use this time to think better how the proposed solution will bring value to our business.

       

      Author's profile photo Felipe Silva
      Felipe Silva

      Ha, thank you for this article. I was wondering what was possible with chagtp and abap. Looks promising!

      I absolutely cannot wait to become an AI assisted developper!

      Author's profile photo Mateusz Skrzyniarz
      Mateusz Skrzyniarz
      Blog Post Author

      Start playing with it - it costs nothing but can lead to acquiring some valuable experience 🙂 Looking forward to reading your article on ChatGPT! 🙂

      Author's profile photo Sandra Rossi
      Sandra Rossi

      Thank you for providing some real use cases. I have another case where the result of ChatGPT was not worth considering. One month ago, I had analyzed ChatGPT code from a SAP blog post by someone else, which was unfortunately removed for some reason, so I just posted all the comments I had posted in my own blog post: How ChatGPT answer made me lose my time | SAP Blogs

      Author's profile photo Tamas Marton Becker
      Tamas Marton Becker

      ChatGPT should access to the source code of all SAP products, and as many Z-enhancement examples as possible that would help a lot.

      Author's profile photo Mateusz Skrzyniarz
      Mateusz Skrzyniarz
      Blog Post Author

      That would definitely teach it a bit more about SAP but I can't see anybody opening an SAP system for ChatGPT just yet 🙂

      Author's profile photo John Astill
      John Astill

      Loved the blog, a great read. I don't think programmers should fear assisted programming like this but embrace it. I am using Github copilot in VS Code, it's suggestions, much like the ABAP examples you show, may not be 100% correct, but I find it's like having a buddy sat giving me suggestions, virtual pair programming. I can look at the suggestion, and if I like it, it's a huge performance boost for me. If I don't like it, I continue coding, and my buddy continues making suggestions.

      Where I find it really valuable is when I am working with a new framework, recently React, the suggestions I get from copilot are akin to real time inline documentation, again saving me time digging around for documentation.

      I think the future with these assistive technologies is exciting, even more so that they can be used in Neovim, the old (vi) and the new (assistive programming) creating magic together.

       

      Author's profile photo Suketu Dave
      Suketu Dave

      Nice article. Beautifully put across multiple perspectives!

      While ChatGPT is still in it's early days, let's wait for time to unfold what it brings ahead 🙂

      Author's profile photo Manjunath GUDISI
      Manjunath GUDISI

      The real benefit would be: train the ChatGPT with sap support tickets, and deploy in production. Lot of time saving for both customers and SAP support teams.

      Author's profile photo Mateusz Skrzyniarz
      Mateusz Skrzyniarz
      Blog Post Author

      Let it take over the work we DON'T want to do. Programming is cool, tickets are not! 🙂

      Author's profile photo Wolfgang Janzen
      Wolfgang Janzen

      Honestly, I'm impressed - I would not have expected ChatGPT to know that much about ABAP (since the majority of human developers have less knowledge in that domain).

      Well, same as for car navigation systems: they are extremely helpful and better than most human co-drivers, but you should never 100% rely on them since sometimes they can be terribly wrong (but in most cases then it's at least pretty obvious). Yet: I do not want to miss them.

      When developing something new, ChatGPT can be very helpful - and I'm sure that it will even further improve (same as the car assistant systems do).

      But in reality, quite often features just have to be "added" to an existing bunch of software.
      And the art of programming is to ensure that this will be done in a non-disruptive (downwards-compatible) way. It's like real estate projects: raising a new building on the green field is much easier than shaping a new building that fits into an already existing environment - with all the boundary conditions that (not so modern) bureaucracy demands (keyword: monument protection).

      Well, definitely we should keep a close eye on ChatGPT.
      The only worry I do have: when you are working on some "secret project" it might not be good to use a public service - since you never know who might benefit from providing such training material.

      Author's profile photo Matthew Billingham
      Matthew Billingham

      ChatGPT does not learn from your chat sessions. It only keeps context within the session. I know, I asked it. Although it could be lying...

      So when I asked whether the current conflict UA/RU will lead to nuclear war, it replied that since both countries have nuclear weapons...

      I corrected it, and it apologised and gave another answer that was more realistic.

      But in a new session, if I ask the same question, I may well get the first answer again.

      Initially, it's impressive, but as you dig a bit you realise it's only very good at chatting. Accuracy and truthfulness (or in the case of programming, correctness) don't come into it.

      Author's profile photo Pierre Maréchal
      Pierre Maréchal

      It is only a question of time.

      Author's profile photo VenuGopal Subramani
      VenuGopal Subramani

      Thank you for this blog. In my opinion it is a really great achievement what AI is able to do.
      I am very curios about the next evolution steps of ChatGPT.

      Author's profile photo Deepti Dhingra
      Deepti Dhingra

      This will definitely be beneficial for citizen developers and its right time for SAP to create its own generative pre trained transformer and add to its portfolio!!

      Author's profile photo Matthew Billingham
      Matthew Billingham

      ChatGPT is good at contextual chatting. It is not a developer assistant AI.

      Its answers are based on the information it's been fed - presumably a whole host of example ABAP programs.

      Author's profile photo Marc-Etienne Desjardins
      Marc-Etienne Desjardins

      Nice Blog, very interesting.

      I can't help myself but thinking about the future of developers and how this will impact our day to day.

      Set aside all the security and privacy concerns(Which could be addressed by having kind of an SAP version of ChatGPT inside the system itself), ChatGPT could be an incredible assistant at debugging and troubleshooting bugs and issues.

      Let's say you ask: "ChatGPT, in this XYZ pricing report, could you tell me why this customer received a net price of 16.82$ for that material. I was excepting 16.28$."

      What about: "ChatGPT, could you get me all the user-exits and BAdIs available for a Production Order". I wonder if it's not already possible!

      That same assistant could also be useful for a business analyst or a user to troubleshoot various issues.

      As stated above, to be really effective at generating code templates, the session should be persisted and personalized per user. That way it could learn and keep preferences about syntax, modulation, naming conventions, etc....

      I'm sure that what we are seeing now is only the tip of the iceberg and the possibilities are endless! In all cases, I'm jumping in! There is no other way around. 😉

      Author's profile photo Egbert Venema
      Egbert Venema

      Thanks for this article! We've been playing around with ChatGPT and were just as impressed with what it could generate already. Not flawless, we developers love to argue about preferences, but still a very solid starting point.

      Good examples, down to earth analysis, nice read.

      Author's profile photo Ramesha Kalammanavar
      Ramesha Kalammanavar

      It's nice article, first when I heard about Chatgpt , i asked to write a report program which roughly given decent codes.

      As per me ABAP developers should be happy , such AI application might made there life enjoyable  rather spending day and night  with codes. 🙂

      Author's profile photo Xavier San Sebastián Torralba
      Xavier San Sebastián Torralba

      In a future we'll "code / define" the flow and/or Unit Tests and then IA will works untill success on the process.