CDS - Use Conversion Exits Directly at Element Level

👋 Hello Everyone!

We often face scenarios where a user enters an ID without leading zeros, but the system needs to store it with leading zeros while still displaying it without them. Usually, this is handled using a domain with a conversion exit (like VBELN), assigning that domain to the data element, and then to the field.

But sometimes we work with existing data elements or predefined types (like ABAP.CHAR(10)) that don’t have conversion exits. In those cases, we usually add zeros manually using RAP determinations and trim the leading zeros in CDS.

Now it’s much simpler! With the annotation:

@AbapCatalog.typeSpec.conversionExit: 'ALPHA'

In the example below, consider a table field for a 10-digit mobile number (predefined type CHAR(10)). With this annotation, leading zeros will be automatically added during processing.

Note: This supports all available conversion exits. The annotation is available in SAP BTP ABAP Environment (Steampunk), SAP S/4HANA Public Cloud, and from S/4HANA 2025 Private Cloud onward.

For more information, please check the official documentation: ABAP Help

Comments

Popular posts from this blog

Fiori URL Generation and Navigation Using CL_LSAPI_MANAGER

RAP - Real Time UI Updates Using Event-Driven Side Effects

ABAP - Create CSV Files Easily Using CL_CSV_FACTORY