Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
m-skrzyniarz
Participant
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 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 generated by ChatGPT


2. ABAP Unit


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 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 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 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 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!
28 Comments
Angelcruzg
Explorer
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.

 
felipe_dimmu23
Participant
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!
Sandra_Rossi
Active Contributor

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

0 Kudos
ChatGPT should access to the source code of all SAP products, and as many Z-enhancement examples as possible that would help a lot.
johna69
Product and Topic Expert
Product and Topic Expert
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.

 
suketu_dave
Employee
Employee
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 šŸ™‚
Manjunath
Product and Topic Expert
Product and Topic Expert

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.

WolfgangJanzen
Product and Topic Expert
Product and Topic Expert

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.

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.
Deepti
Explorer
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!!
matt
Active Contributor
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.
matt
Active Contributor
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.
m-skrzyniarz
Participant
0 Kudos
Start playing with it - it costs nothing but can lead to acquiring some valuable experience šŸ™‚ Looking forward to reading your article on ChatGPT! šŸ™‚
m-skrzyniarz
Participant
0 Kudos
That would definitely teach it a bit more about SAP but I can't see anybody opening an SAP system for ChatGPT just yet šŸ™‚
m-skrzyniarz
Participant
Let it take over the work we DON'T want to do. Programming is cool, tickets are not! šŸ™‚
pmarechal
Explorer
It is only a question of time.
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. šŸ˜‰
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.
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. šŸ™‚
xavisanse
Active Participant
0 Kudos
In a future we'll "code / define" the flow and/or Unit Tests and then IA will works untill success on the process.
calodia
Discoverer
I am taking a course in abap. I began to take the statement of the exercises and put them to Chatgpt. So far I have done it about 10 times and it is about simple exercises (Options of the select clause for example). In one case I had to rewrite the statement to get an acceptable result. All the code produced worked for me. All the proposed code I had to tweak a bit but it saved me a huge amount of time. If I was working (I worked a long time as a programmer years ago) I would use it as a helper. In fact as a student I do. By the way, some small details of the proposed code helped me learn and I would never have proposed them since they did not appear in the course.
Sergiu
Contributor
0 Kudos

ChatGPT šŸ¤– writes object-oriented reports with parameters, most of the reports require select options. šŸ˜‰

Here is my human code.  šŸ§‘

*&---------------------------------------------------------------------*
*& Purpose: Object Oriented Implementation for a report with select-opotins
*& Author : Sergiu Iatco | 2023.04.07
*& URL : https://blogs.sap.com/2023/02/15/chatgpt-for-sap-developments-threat-or-an-opportunity/comment-page-...
*&---------------------------------------------------------------------*
REPORT MARA_OO_SELECT_OPTIONS.

CLASS LCL_MARA DEFINITION.
PUBLIC SECTION.
TYPES:
TY_MATNR TYPE MATNR,
TY_MTART TYPE MTART,

* TY_R_MATNR TYPE RANGE OF MATNR,
* TY_R_MTART TYPE RANGE OF MTART,

TY_R_MATNR TYPE RANGE OF TY_MATNR,
TY_R_MTART TYPE RANGE OF TY_MTART,

TY_T_MARA TYPE STANDARD TABLE OF MARA.
DATA: C_T_DATA TYPE STANDARD TABLE OF MARA READ-ONLY.

CLASS-DATA: C_SEL_MATNR TYPE TY_MATNR,
c_SEL_MTART TYPE TY_MTART.

METHODS:
CONSTRUCTOR IMPORTING C_R_MATNR TYPE TY_R_MATNR OPTIONAL
C_R_MTART TYPE TY_R_MTART,

GET_DATA EXPORTING M_T_DATA TYPE TY_T_MARA,
DISPLAY_DATA.
PRIVATE SECTION.
DATA: M_R_MATNR TYPE TY_R_MATNR,
M_R_MTART TYPE TY_R_MTART.

ENDCLASS.

CLASS LCL_MARA IMPLEMENTATION.
METHOD CONSTRUCTOR.
M_R_MATNR[] = C_R_MATNR[].
M_R_MTART[] = C_R_MTART[].
ENDMETHOD.

METHOD GET_DATA.
SELECT * FROM MARA
INTO TABLE M_T_DATA
WHERE MATNR IN M_R_MATNR AND
MTART IN M_R_MTART.


C_T_DATA = M_T_DATA.
ENDMETHOD.

METHOD DISPLAY_DATA.
CL_DEMO_OUTPUT=>DISPLAY( C_T_DATA ).
ENDMETHOD.
ENDCLASS.

TABLES: MARA.
*DATA: SEL_MATNR TYPE LCL_MARA=>TY_MATNR. "TYPE from class
*DATA: SEL_MTART TYPE LCL_MARA=>TY_MTART. "TYPE from class

*DATA: T_DATA TYPE STANDARD TABLE OF MARA.
DATA: T_DATA TYPE LCL_MARA=>TY_T_MARA. "TYPE from class

*TYPES TY_R_MATNR TYPE RANGE OF MARA-MATNR.
*TYPES TY_R_MTART TYPE RANGE OF MARA-MTART.

*DATA: R_MATNR TYPE TY_R_MATNR.
*DATA: R_MTART TYPE TY_R_MTART.

DATA: R_MATNR TYPE LCL_MARA=>TY_R_MATNR. "TYPE from class
DATA: R_MTART TYPE LCL_MARA=>TY_R_MTART. "TYPE from class

SELECT-OPTIONS:
* S_MATNR FOR MARA-MATNR,
* S_MTART FOR MARA-MTART.

* S_MATNR FOR SEL_MATNR,
* S_MTART FOR SEL_MTART.

S_MATNR FOR LCL_MARA=>C_SEL_MATNR, "CLASS-DATA
S_MTART FOR LCL_MARA=>C_SEL_MTART. "CLASS-DATA

START-OF-SELECTION.
R_MATNR[] = S_MATNR[].
R_MTART[] = S_MTART[].

DATA: LO_MARA TYPE REF TO LCL_MARA.
LO_MARA = NEW LCL_MARA( C_R_MATNR = R_MATNR
C_R_MTART = R_MTART ).
* LO_MARA = NEW LCL_MARA( C_R_MTART = R_MTART ). "optional C_R_MATNR
LO_MARA->GET_DATA( ).
* It would help a lot of works if standard SAP reports provided get data
T_DATA[] = LO_MARA->C_T_DATA[]. "get data and use for other requirements
* BREAK-POINT.
LO_MARA->DISPLAY_DATA( ).
vimalv
Active Participant

m-skrzyniarz - Thank you for this article. I did try ABAP generation with ChatGPT and results were not bad. I believe it has learnt the code from StackOverflow, because the generated code was quite low complexity. If it were to learn from SCN, it would have generated much better code.

Also, operations on data types such as dates which ABAP developers write in a single step are often generated in multiple lines. For example try "Write code to find day of the week from a given date".

ABAP help is much better if you look for it on SCN or just google it.

@calodia - I like the way you are using it to learn. I would still recommend SCN and help.sap.com, these would have way more to offer than ChatGPT. But you can still teach it better code and it will learn. I have tried to teach ChatGPT and it does generate better code after the learning sessions. 

It could still generate better code for UI5 and Fiori use cases.

I also see a rather smart way to use both SCN and ChatGPT together - get code snippets from SCN and ask ChatGPT to understand and adapt it to my use case, and it does all the thinking and code writing for me, and tada! Complex code completed in much lesser time šŸ™‚

Having said this, I believe we should be looking at more creative opportunities to use ChatGPT, for example use the "Prompts" to drive actions using ABAP.

For example, I will very much like to improve the Co-pilot using ChatGPT and maybe it will on an instruction automate processes for me, for example in an utopian future when I utter something like "Please order 20 HP Inkjet Cartridges from the vendor who quotes the least" to a GPT driven system- it could understand it and write an execute a BAPI call to create a PR, may be do a vendor evaluation on the Response, understand the cheapest quote , and write an execute a BAPI call to create a PO for the vendor.

Just a thought.

27sargeant
Explorer
0 Kudos

I like that it somehow managed to repurpose a product table

The SNWD_PD table is a demo table that is provided with the SAP NetWeaver demo data. It contains data related to planets in a fictional universe. This table is often used as a sample data source for demonstration purposes in various SAP products and solutions.

The SNWD_PD table contains the following fields:

NODE_KEY: A unique identifier for the planet.
PARENT_KEY: A reference to the parent node in the hierarchy.
NODE_LEVEL: The level of the node in the hierarchy.
NODE_TYPE: The type of node (e.g., "Planet", "Star", "Galaxy").
CATEGORY: The category of the node (e.g., "Planet", "Star").
CREATED_AT: The date and time the node was created.
CHANGED_AT: The date and time the node was last changed.
NODE_NAME: The name of the planet.
DESCRIPTION: A description of the planet.
SURFACE_AREA: The surface area of the planet.
DISTANCE_LY: The distance of the planet from Earth in light years.
CLIMATE: The climate of the planet.
ATMOSPHERE: The atmosphere of the planet.
GRAVITY: The gravity of the planet in meters per second squared.
Note that the SNWD_PD table is a demo table and is not intended for use in production systems. It is often used as a sample data source for demonstration and training purposes only.

 

As far as I know, this table is part of EPM and the name is not borrowed for any kind of demo system (I doubt such a table would be of any use in a production system for a few millennia to come). Which is kind of scary because ChatGPT is presenting this as a "fact" (yes, there are disclaimers about misinformation etc). It was only because I thought this was not the case that I looked into it.

It has a tremendous use case. In terms of putting coders out of work, that would mainly be due to reducing the amount of labour required for producing and testing the code. Those who can use AI assistants effectively will thrive.

The potential would be even greater if the AI could be integrated. Take debugging - it's extremely hard to debug something like a CRM system that uses GUID's up the wazzoo because they are not particularly human readable, but an AI would have no problem spotting an iffy GUID. Instead of spending a couple of hours in repeated manual debug runs, just tell the AI debugger to run until it hits the problem, keeping track of what happened on the way then figure out the cause.

Got a dump where the cause it not apparent? Give it to AI - which may take the source code and the dump signature and figure out the defect.

Warning: don't allow it to be trained on any of the code behind ERP HR or Time and Expenses.

 

 

Vitaliy-R
Developer Advocate
Developer Advocate
It is trained on examples, but it is not a web search. It can generalize and generate from examples it was fed... and this is where it can "hallucinate", ie. write code that contains calls to non-existing functions šŸ¤“
Vitaliy-R
Developer Advocate
Developer Advocate
0 Kudos
vimal.vidyadharan , you made my day with
If it were to learn from SCN, it would have generated much better code.

šŸ¤“
Vitaliy-R
Developer Advocate
Developer Advocate
0 Kudos
m-skrzyniarz , it would be interesting as well to hear your opinion in the discussion pekala started here: https://groups.community.sap.com/t5/katowice-discussions/dyskusja-o-chatgpt/m-p/254596#M58 šŸ¤“
matt
Active Contributor
Hallucinating - love it.

I recently asked it:

Please turn the following into something readable.

It answered

I cn't undrstand wht yu'r sayin. Pls spln it btr.