Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 3 of 6

Generating code and RAP scenarios

8 min

Listen to this lesson

0:00 / 7:57

Joule for Developers generates code at three sizes: the next few tokens as you type, a method body from a description, and a whole RAP service from a conversation. Each size needs a different level of review. This lesson walks through all three with Contoso's core agreement app, the RAP business object ZR_CMC_CoreAgreement in software component ZCMC_CLOUD (see sap-abp-202).

Small: predictive code completion

Predictive code completion shows an AI prediction as ghost text ahead of the cursor. Press Tab to accept it, keep typing to ignore it, or press Esc to dismiss it. SAP lists support for ABAP classes (definition and implementation), interfaces and programs, covering source code, comments and ABAP Doc comments. It shares the editor with two other completion features, and SAP defines the precedence: keyword completion is evaluated first; predictive completion appears only when no keyword matches; and Ctrl+Space replaces both with classic semantic code completion.

SAP's disclaimer on this page is worth reading: suggestions are AI-generated without human influence, so review the code before accepting it. SAP also states that it retains intellectual property rights over its fine-tuning data, filtered personal information out of it and used no third-party data.

Medium: RAP business logic prediction and chat

RAP business logic prediction helps implement a determination or validation in the behavior implementation class. You write a natural-language description of the method's purpose and checks, and Joule generates the implementation from it. SAP lists it for the ABAP environment, Public Edition and Private Edition 2025 or higher. The quality of the description decides the quality of the code, so write it like a small specification: the trigger, the fields read, the rule, the message and the failed keys.

The Joule chat is the general-purpose route: ask for a code snippet, a refactoring, or an explanation of an error. Answers appear in the chat view, and you insert or copy what you keep. Treat chat output like a code snippet from a colleague's message: read it, adapt it, then test it.

Large: the OData UI Service from Scratch wizard

The OData UI Service from Scratch wizard creates a RAP business object and all service-related repository objects without an existing artifact. Its only prerequisite is an existing package. You describe the business object in the Joule chat, and the wizard generates the stack: tables, CDS views, behavior definitions, service definition and binding. SAP lists it for the ABAP environment, Public Edition and Private Edition 2025 or higher. The CDS annotation generation capability can then add UI annotations.

One wizard run creates a whole RAP stack, so review effort grows with it.
The Sign-Off Table · thesignofftable.com/academy/sap-aid-201
Generation sizeJ4D capabilityReview you owe
A few tokensPredictive code completionRead before pressing Tab
One methodRAP business logic prediction, chatRead line by line; write or run a unit test
A whole serviceOData UI Service from ScratchCheck names, keys, draft, authorization and ATC; full unit tests
AnnotationsCDS annotation generationPreview the Fiori app; check labels and field order
The bigger the generated piece, the more structured the review must be.
The Sign-Off Table · thesignofftable.com/academy/sap-aid-201

Prompting the Joule chat well

  • Name the object and the goal: "In ZBP_R_CMC_COREAGREEMENT, add a validation for…" beats "write a validation".
  • Give the rule as the business states it, including the status values (OPEN, CLOSED) and the message text.
  • State the constraints: ABAP Cloud only, released APIs, EML IN LOCAL MODE inside the behavior pool, no COMMIT WORK.
  • Ask for one thing at a time. SAP's own best practices for agent prompts say to break tasks into steps and keep context focused.
  • Ask it to list its assumptions. Assumptions you can see are assumptions you can correct.

Naming and clean core

Generated objects follow whatever names you or the wizard choose. Contoso's naming guide for the core agreement app uses ZI_ for interface views, ZR_ for the business object, ZC_ for projections, ZBP_R_ for the behavior pool and ZUI_ for the service. Tell Joule the names up front. And because the work happens in ZCMC_CLOUD, which uses the ABAP for Cloud Development language version, the syntax check and ATC will reject any non-released API Joule suggests. That's a feature: the language version catches a whole class of generated mistakes for you (see sap-abp-203).

What would you do?

A Contoso developer used the OData UI Service from Scratch wizard to create a prototype "core return inspection" app. It activated cleanly, and the Fiori preview works. She wants to assign everything to the transport for the next release. What should Kenji ask for first?

Key points
  • Predictive completion: ghost text; Tab accepts, Esc dismisses; keyword completion takes precedence.
  • RAP business logic prediction turns a method description into a determination or validation.
  • The OData UI Service from Scratch wizard builds a whole RAP service from a package and a chat.
  • Review effort scales with the size of what was generated.
  • Give Joule your naming rules, and let the ABAP Cloud language version catch non-released APIs.

Check your understanding · not graded

Lesson check

  1. 1. In the ABAP editor, which completion appears first when you type a keyword prefix?

  2. 2. What is the only prerequisite SAP lists for the OData UI Service from Scratch wizard?

  3. 3. What does RAP business logic prediction use as the basis for generated code?