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 🙂)
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:
2. ABAP Unit
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:
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:
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:
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.
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.
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:
- 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.
- A ChatGPT-focused ABAP developer will soon become a lot more valued than one that ignores it.
- 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.
- 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…
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?
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!