Amplifying ABAP Development with AI

Objectives

After completing this lesson, you will be able to:
  • Explain how ABAP AI Capabilities can assist ABAP developers during application development.
  • Briefly describe how the ABAP AI SDK can be used to add AI features to business applications.

Joule for Developers: Your AI Assistant

Introduction

Imagine you are a new ABAP developer on a project. You are faced with understanding existing code, generating initial versions of ABAP code, or implementing new features. Instead of spending a lot of time manually analyzing code or writing everything from scratch, you can use ABAP AI Capabilities to help you speed up your development and improve the quality of your code from the start.

Generative AI is changing ABAP development by providing tools that can help developers be more productive and create smarter business applications. This lesson will give you a general idea of how you can use these AI features in your ABAP projects.

AI Coding Assistance - Main Features of Joule

Joule for Developers is a set of AI-powered tools that are built into the ABAP development tools in Eclipse. It acts like your assistant, helping you with different development tasks to make you more efficient.

You can converse with the Joule chat in natural language, asking it any development-related questions and tasks.

You can chat with an AI to get help with development-related questions. Ask questions, request explanations, or generate code examples using simple language. To open the Joule chat view, choose WindowShow ViewOther...Joule.

As you type ABAP code, the AI suggests code to complete what you are writing.

You can incorporate ghost text in your source code during your writing process. Ghost texts are predicted based on your cursor position and the content in the ABAP source code editor. The predictive code completion currently supports the following object types:

  • Classes
  • Interfaces
  • Programs

The predictive code completion is enabled by default, but you can disable it manually if you prefer. When enabled, ghost text appears continuously during your coding process and is displayed in grey in the ABAP source code editor.

Select Toggle Automatic Triggering of Predictive Code Completion from the toolbar in ABAP development tools for Eclipse to enable or disable the predictive code completion.

Begin typing in the source code editor and take a short break. If predictive code completion is enabled, ghost text appears in the ABAP source code editor at the point where you paused. You can then incorporate it into your code.

To use the Explain capability, you can select lines of code in the editor and then choose Joule → Explain from the context menu.

The Explain capability enables you to get detailed explanations of selected development objects or lines of source code.

To open the Explain capability, select a development object from the Project Explorer, the source code editor (by selecting lines of code), or other views such as the Outline view.

Then choose JouleExplain from the context menu or open the Joule chat view and select /explain located in the input field at the bottom of the view.

Using the Explain capability is a collaborative process. You can specify to the Explain capability in natural language how the explanation should be generated, for instance, whether it should be detailed or concise, with or without examples.

The Explain's answer will appear in the Joule chat view with the selected development object listed under Used objects.

The Explain's answer will appear in the Joule chat view with the selected development object listed under Used objects. The explanations are marked with /explain to distinguish them from the default Joule chat answers. Via the Joule chat view you have the option of follow-up questions. For some development object types, you will even get the option to guide the conversation to a specific outcome with quick replies. These quick replies will appear at the end of the Explain’s response in the Joule chat view. For example, you may have the option to generate a more detailed or more understandable explanation through the use of such quick replies.

In addition, SAP Joule for Developers offers the following ABAP AI capabilities:

  • ABAP Unit Test Generation

    The AI can help you generate ABAP Unit Tests. This allows you to create tests that check your code more easily.

  • CDS Test Generation

    The AI can help you create test classes for CDS entities. This ensures the quality and correctness of your CDS views.

  • OData UI Service from Scratch

    Create all RAP service-related repository objects from scratch with the aid of the Joule chat.

  • RAP Business Logic Prediction

    Implement determinations or validations in the implementation class of your behavior definition.

  • Consume

    Generate an OData request and ABAP code for consuming a corresponding OData call via the OData Client Proxy.

  • GenAI-Driven Extensibility Assistant

    The extensibility assistant can answer questions related to field extensibility and field logic. It can assist you in various tasks related to field extensibility, including creating custom fields and finding value help views.

Caution

Important points to remember:
  • AI results may vary.
  • Always check AI-generated code for correctness.
  • Make sure AI-generated code meets your requirements.

Building Your Own AI-Enabled Applications

ABAP AI SDK

While Joule provides AI help inside the development environment, the ABAP AI SDK (Software Development Kit) lets you add AI features directly into your own business applications.

The ABAP AI SDK provides an ABAP library that allows you to use large language models (LLMs).

With the ABAP AI SDK, you can:

  • Use LLMs from your ABAP code.
  • Add GenAI features to your apps or services.
  • Utilize features like prompt completion and function calls.

The ABAP AI SDK enables you to use the following features:

  • Completion API

    This API provides access to the completion API functionality of LLMs, meaning that it uses an LLM to generate a text response from a prompt.

  • Prompt Library API

    Using the prompt library API, you can use predefined prompt templates to generate new prompts.

  • Tracing

    If you encounter problems when calling the API, you can initiate the ABAP Cross Trace. You could do this for instance with the completion API to inspect the call stack, to identify the cause of the error.

Setting Up the ABAP AI SDK

To use the ABAP AI SDK, your system administrator needs to set up system connections with the generative AI hub. As a developer, you will define the LLM to be used and create intelligent scenarios and models.

Summary

  • ABAP AI Capabilities help developers be more productive by providing AI assistance within the ABAP development environment.
  • Key features of Joule include Joule Chat, Predictive Code Completion, and Explain, which simplify development tasks.
  • The ABAP AI SDK allows developers to build custom AI-enabled business applications by using large language models.