Attila, S/4HANA, BTP Fullstack Developer (EN, DE, HU)

Create ABAP Cloud UI Service with Business Application Studio using a RAP BO Interface
Introduction
The aim of this article is to purely use BAS to generate a custom UI OData v4 service on top of a standard RAP BO. The given environment is S/4HANA Cloud Public Edition with Clean Core approach. The same works on BTP ABAP Environment as well. We do our excercise on BTP ABAP Environment this time.
Development scenarios and tools of ABAP Full Stack development
Finding the path in the of growing list of tools and development approaches is sometimes not easy. This is the context where developers need to navigate. One single point in the business requirement can change the solution architecture and the required tools and programming models on BTP completely. Jumping from on-stack to side-by-side extensibility approach requires to redo the feasibility and change your tools.
SAP Build Code (BAS) and ADT is connected with variety of ways to S/4HANA Cloud embedded and BTP ABAP environments nowadays. Also new possibilities like toolbridges arrive to do a quick task execution initaited by either of the development environments only. We can trigger creation of Fiori Elements UIs by BAS from ADT, and we can trigger ABAP related stuff from BAS on the ABAP Instance without using ADT at all.
As an SAP Fullstack Developer You have more way to trigger code generators provided by SAP. One of that is called ABAP Repository Object Generator as part of the ABAP System, which is enhanced day to day to perform common development tasks like creating CDS and Service entities in variety of layers of a RAP BO Service automatically.
Clean core approach reusing RAP BO Interface
In case the on-stack extensibility options of a RAP BO enabled by SAP is not sufficient, or you have different needs, you can go one step further. Reusing an existing RAP BO Interface – which is released system internally – building your custom UI service on top of it is also possible. SAP ensures upgrade stability. This will be still an on-stack solution.
Looking at the developer extensibility options in RAP, our activity is related to the red box

Prerequisites
- Required CDS Annotations present
- BAS is connected to the ABAP Instance via a BTP Destination (usually done by your BTP Admin colleague)
- Open Workbench Request
To confirm that generating a UI service on top of the RAP BO Interface is supported by SAP, check presence of this annotation in the header the root CDS entity:
@ObjectModel.supportedCapabilities : [ #UI_PROVIDER_PROJECTION_SOURCE ]
If you find this, You are good to continue to generate a UI service automatically.
The chosen tool
There are two ways to generate a UI service automatically:
We will go with the 1st option, purely in BAS only. Yes, no ADT will be involved until some catasthrophic event happens during generation, which can be fixed afterwards in ADT only.
Our example is based on the Bank Master Data CDS Entity I_BankTP, that is available even on the Free Tier BTP ABAP Environment.
@ObjectModel.supportedCapabilities : [ #UI_PROVIDER_PROJECTION_SOURCE ]
@VDM: {
lifecycle.contract.type: #PUBLIC_LOCAL_API,
viewType: #TRANSACTIONAL
}
@ObjectModel:{
usageType: {
serviceQuality: #C,
sizeCategory: #M,
dataClass: #TRANSACTIONAL }
}
@AccessControl.authorizationCheck: #MANDATORY
@ObjectModel.sapObjectNodeType.name: 'Bank'
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: 'Bank - TP'
define root view entity I_BankTP
provider contract transactional_interface
as projection on R_BankTP as Bank
{
Another prerequisite is that the subaccount where your BAS instance is running connects to the subaccount of the ABAP Instance via a destination already. Simply: BAS is connected to the system.
In case of the Free Tier BTP ABAP Environment You will need to perform several steps, and subscribe to Business Application Studio (Free plan or buy another version), in case not done already. When creating destination by yourself, ensure that the HTML5.Timeout property is set to 300000 to avoid broken connection during execution.

Business Application Studio
Dev Space
There is a new Dev Space template available called Full-Stack ABAP Application. In further we will be using that, why not ? Might we found some interesting undocumented feature.

Service Center
Next You need the Service Center choosing the corresponding destination to the ABAP system (BAS_to_ABAP in this demo) selecting the Business Object/CDS option.

As You see this is approaching the solution from UI development perspective, because in the subsequent steps most probably a new Fiori Element app will be generated on top of the new UI service we are going to generate now.
After identifying the corresponding – SAP only, custom is not supported – CDS artifacts, You can continue to run a Fiori Tools command.

Fiori Tools – Generate UI Service
Ctrl + Shift + D on Windows, or simply click inside the prompt field at the top.

Select the BTP destination pointing to the ABAP Instance, enter the package and transport request for the generated artefacts.


We will not generate a UI Project at the same time. Select No, then press Finish.
Crash in ABAP backend by the Repository Object Generator
The generation process failed in the middle. To find the root cause You need open the Output pane in BAS and analyze the log.
Generating the UI Service can take a few minutes. Please be patient.
No change to package.json was detected. No package manager install will be executed.
Generating UI service...
The UI Service creation process failed. For more information, see the log in the `Application Wizard.Generators` output.
[2025-08-27 10:04:32] ERROR: Error generating service: Request failed with status code 422
....
If "use draft" is used with "strict", the draft action "Edit" must be included explicitly in the projection.
...
ABAP Development Tools – ADT
The Wrong Behavior Projection and Access Controls
If "use draft" is used with "strict", the draft action "Edit" must be included explicitly in the projection.
As RAP developer this error should be known to You, however seems the ABAP Repository Object Generator does not know the right syntax. You can confirm this looking at the details in ADT.

So instead of being a helping hand, the ABAP Repository Object exposed by the Fiori Toolkit causes rather trouble, because You’ll need to fix the mistakes made by SAP in your customer codebase. Either You need to cleanup everything manually, or finish the behavior projection and a service at your own.
This error message is not a surprise ! Everyone touching a RAP BO after an upgrade to 2023 knows that strict mode is necessary. It has mandatory elements inside the structure of the RAP BO. Seems only SAP is not aware of that, but the compiler…
Remark
Despite delivering and advertising many supercool functionality, SAP still uses customers and developers as their beta testers of their unfinished features. This was the case with SAP WebIDE and UI5, where endless and painful errors happened during implementations. I am happy we got rid of that and utilize VSCode today, but as You see new problems appear always. Lot of features are available but useless, and can be considered as baby or prototype level toys only. Another aspect is the future visioning that CDS, RAP and Fiori Elements most wanted features, which are advertised years before, but not available onPremise. No wonder, because SAP internal policy is cloud-first but in many cases cloud-only. Of course this is never advertised to lovely customers, that SAP is dealing with separate module codebases for Cloud and onPremise in the background. Never mind, developer creativity fills those gaps, but the effort required for workarounds can be very high individually. Here comes in the picture what should be respected, the community work outside SAP.
One more memo: Good Bye CAP, you are chained to BTP with the new developer license!
Fixing the SAP generated artefacts
Simply do what the compilers tells You to fix in the Behavior Projection ZC_BANKTP. Add the usage of the required draft related actions. Then Activate.
define behavior for ZC_BANKTP alias Bank
extensible
{
use create;
use update;
use action Edit;
use action Activate;
use action Discard;
use action Prepare;
use action Resume;
use association _bankaddress { create; with draft; }
}
We still need to add the missing repository objects manually, because the generation was broken and the objects on top of the projection are still missing. These are
- service definition
- service binding
Service Definition
Define service ZUI_BANKTP_O4

Expose the BO entities as their alias name defined in the Behavior Projection.
@EndUserText.label: 'Bank Master Data'
@ObjectModel.leadingEntity.name: 'ZC_BANKTP'
define service ZUI_BANKTP_O4
provider contracts odata_v4_ui {
expose ZC_BANKTP as Bank;
expose ZC_BANKSCRIPTEDADDRESSTP as BankScriptedAddress;
expose ZC_BANKADDRESSTP as BankAddress;
}
In a real life scenario, You need to add value helps to the projection CDS entity and expose them as well in the service definition.
Service Binding
Create a service binding as well to have an endpoint for your service at the end. For draft enabled applications the Binding Type OData V4 – UI is the right choice because of Fiori Elements capabilities.


The Wrong access controls

Long story short: Access controls on top of CDS entities does not have Release Contracts (C1), but reside in different software component than your Access Control, which wants to inherit from that SAP standard Access Control indirectly. This is prohibited in ABAP Cloud.
To overcome this limitation, there is a workaround. You need to point your projection entity ZC_BANKTP with an [1..1] association to the SAP standard interface entity I_BANKTP using the key fields. This has to be done for each entity ZC_BANKADDRESSTP and ZC_BANKSCRIPTEDADDRESSTP as well.
This was done by the ABAP Repository Object generator actually, but one more step is missing. You need to utilize this association with a very specific workaround syntax in your ZC_BANKSCRIPTEDADDRESSTP and ZC_BANKADDRESSTP CDS Access Controls.
@EndUserText.label: 'Bank Address'
@MappingRole: true
define role ZC_BANKSCRIPTEDADDRESSTP {
grant select on ZC_BANKSCRIPTEDADDRESSTP
where INHERITING CONDITIONS FROM ENTITY I_BANKSCRIPTEDADDRESSTP REPLACING { ROOT WITH _BaseEntity };
}
If you want to read about it, check this out.
Now Activate all the remaining Inactive Objects.
Publishing the UI Service
First in ADT press the Publish button to expose the service endpoint in development system. Hold on patiently, not to mess ADT.
This is a Cloud ABAP Instance ! In onPremise systems transaction /IWFND/V4_ADMIN has to be used in general to not mess the import and publishing process with wrong namespaces and packaging.


Really wait until ADT automatically updates the view ! You can check the status of Publishing Process in the F5377 – Display Publishing Process application.

Live Preview in ADT
We definitely did not wanted to execute so much additional activities in ADT, but failed ABAP Repository Object generation demanded Us to do so.


The next step is to generate and deploy a Fiori Elements UI to ABAP UI Repository Instance for this Service.


