Introduction
This blog is a follow-up to my previously published blog A Cool use of Open AI in SAP GUI Editor | SAP Blogs.
Thanks for all the feedback on this blog.
Two of them were really important:
Here is the link to my eclipse plugin which can work on text editor-based developments and help auto generate code like we saw in SAP GUI. AI Developer Plugin for Eclipse (github.com)
(The plugin is in experimental stage and will get better with your feedback.)
Writing a good prompt is really important to work with generative AI:
Please refer this Prompt engineering techniques with Azure OpenAI – Azure OpenAI Service | Microsoft Learn for some tips on constructing a good prompt.
The plugin is leveraging Chat Completion Api of Azure OpenAI and code generation is relying on codex model and how well prompt is articulated for AI engine.
Chat Completion takes two components for generating response: System Message and User Message.
System Message: It guides the assistant’s behavior. In this case it is setup to work as an AI Assistant to generate code for SAP based developments.
User Message: In this, we provide the actual queries to get the response from AI Assistant.
A query can be a short query with random or creative answers from the assistant. or well constructed to get more definite answers
Sample Query | Sample AI Answer | Answer behavior |
Write a sql query to read customer details. | SELECT kunnr, name1, city, country FROM kna1 INTO TABLE @DATA(customer_details). |
AI will respond with some random query. It may or may not work for your case. But you can use this to try and explore which option works for your case. |
Write a SQL query to read customerno name street city state use following technical field names kunnr name1 stras ort01 regio from KNA1 |
SELECT kunnr AS customerno, name1 AS name, stras AS street, ort01 AS city, regio AS state FROM kna1. |
A more definite answer |
How to Install this plugin
AI-Developer-Plugin-for-Eclipse (github.com) Github has the archive file and a step by step document to guide you through the installation process.
After you install this plugin
You will get this menu in your eclipse.
How to Use this plugin
Some Sample Demos
Create an ABAP report to write data from an SAP table to a comma separated text file on your local system. Provide clear instructions on the program flow like below:
*#START
*Define a select options to take input for customer KNA1-KUNNR and a parameter(p_file) to take local file path as input
*Provide field names with table to declare a structure
*Declare a type with fields and internal table
*customer street city state
*kunnr stras ort01 regio
*from KNA1
*select data from KNA1 to this internal table
*looping in the internal table generate comma separated text and add the text to an internal table
*download this table to the file given in the input
*#END
Now let’s change this program to generate a json string in the file. Locate the loop where it is generating comma separated text and add line below that section. Highlight the code block for loop alongwith below text and press Ctrl + 8 to ask open ai to suggest code for json file download.
*Rewrite above code to concatenate fields from it_customer in json format.
Using Template function, you can generate a template file from existing code. Then you can apply the template file to generate code for similar requirement in a different development object. Below demo shows first how to create a template from an alv report then use the same for generating another report.
Reference:
Getting started with the ABAP in Eclipse SDK | SAP Blogs
Conclusion
While existing open ai codex model is not fully trained on SAP language, still with good prompts you can automate lot of manual efforts. With generate template option you can leverage your existing codebase and also learn how to write a good prompt.
Hope this plugin helps with your AI learning journey.