Cost accounting CDS view not pulling custom fields after extension

I extended the standard CDS view C_COSTCENTERACTUALCOSTS to include two custom fields (ZZPROJECT and ZZREGION) from table COEP for our cost center reporting app. The extension compiles without errors, but when I test the Fiori app, the custom fields don’t appear in the UI.

Here’s my extension definition:


@AbapCatalog.sqlViewAppendName: 'ZCOSTCTREXT'
extend view C_COSTCENTERACTUALCOSTS with Z_COSTCTR_EXTENSION {
  coep.zzproject,
  coep.zzregion
}

The CDS view activates successfully in Eclipse, and when I preview the data in transaction SE16 for the SQL view ZCOSTCTREXT, I can see the custom fields with correct values. However, the OData service shows only standard fields. Am I missing a UI annotation step?

Here’s the complete solution covering all three technical areas:

CDS Extension (Data Layer): Your CDS extension syntax is correct, but you need to add exposure annotations. Update your extension:


@AbapCatalog.sqlViewAppendName: 'ZCOSTCTREXT'
extend view C_COSTCENTERACTUALCOSTS with Z_COSTCTR_EXTENSION {
  @EndUserText.label: 'Project'
  coep.zzproject,
  @EndUserText.label: 'Region'
  coep.zzregion
}

The @EndUserText.label annotation is important for OData metadata generation.

UI Annotation Usage (Presentation Layer): Create a metadata extension to define UI annotations. This is the critical missing piece. Create file Z_COSTCTR_EXTENSION.MDE:


@Metadata.layer: #CUSTOMER
annotatе view Z_COSTCTR_EXTENSION with {
  @UI: {
    lineItem: [{ position: 100, importance: #HIGH }],
    identification: [{ position: 100 }],
    selectionField: [{ position: 10 }]
  }
  zzproject;

  @UI: {
    lineItem: [{ position: 110, importance: #MEDIUM }],
    identification: [{ position: 110 }]
  }
  zzregion;
}

These annotations tell Fiori Elements to:

  • Display fields in the list report (@UI.lineItem)
  • Show fields in the object page (@UI.identification)
  • Make zzproject available as a filter (@UI.selectionField)

OData Service Activation: Complete these steps in sequence:

  1. Activate both the CDS extension and metadata extension in Eclipse ADT.

  2. In transaction /IWFND/MAINT_SERVICE, find your service (probably ZC_COSTCENTERACTUALCOSTS_CDS or similar).

  3. Click “Regenerate Runtime Objects” button. This rebuilds the service implementation based on the updated CDS definition.

  4. Go to transaction /IWFND/CACHE_CLEANUP:

    • Select “Model Cache”
    • Select “Data Cache”
    • Enter your service name
    • Execute cleanup
  5. Test the OData service in /IWFND/GW_CLIENT:

    • Execute a GET request to the EntitySet
    • Verify that zzproject and zzregion appear in the response
    • Check the $metadata URL to confirm the fields are in the EntityType definition with proper labels
  6. If using Fiori Launchpad, clear the app cache:

    • Go to transaction /UI2/FLP
    • Navigate to “Cache Management”
    • Clear cache for your cost center app
  7. For the Fiori app configuration:

    • Open the app in Web IDE or BAS
    • If it’s a Fiori Elements app, the fields should now auto-appear based on the UI annotations
    • If it’s a freestyle UI5 app, add the custom fields to the columns aggregation in the SmartTable or AnalyticalTable control
  8. Verify authorization: Check transaction SU53 after testing to ensure no authorization failures for the custom fields. If needed, add field-level authorization in transaction SUIM.

After implementing all three layers, test the complete flow: CDS preview in Eclipse → OData service test in /IWFND/GW_CLIENT → Fiori app in browser. This layered approach ensures the fields flow correctly from database through OData to UI.


This draft is based on general SAP S/4HANA knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.

Did you regenerate the OData service after activating the CDS extension? Go to transaction /IWFND/MAINT_SERVICE and regenerate the service model. Also check if your custom fields are marked as @UI.hidden: false in the extension.

I checked the base CDS view and it does have @AbapCatalog.extensibility.extensible: true. I regenerated the OData service in /IWFND/MAINT_SERVICE but still no custom fields in the UI. When I look at the service metadata in transaction /IWFND/GW_CLIENT, the EntityType definition includes my custom fields, so they’re making it to the OData layer. But the Fiori app configuration doesn’t show them as available columns.

If the fields are in the OData metadata but not showing in the app, check the Fiori app’s manifest.json file. For Fiori Elements apps, you need to explicitly add custom fields to the annotation configuration. Also verify that your user role has authorization to view the custom fields - sometimes field-level authorization can hide columns even if they’re technically in the service.

Tested this on S/4HANA 2022 FPS02 and the @EndUserText.label annotation on the CDS view extension was indeed required for the custom fields to surface in OData metadata.

Clear the gateway cache and metadata cache after regenerating the service. Use transaction /IWFND/CACHE_CLEANUP and select both model cache and data cache options. Then clear the browser cache and test again. We’ve seen cases where stale cache causes new fields not to appear even though the service definition is correct.

Check if the base CDS view has a metadata extension that’s overriding your field visibility. Sometimes standard SAP CDS views come with restrictive metadata extensions that explicitly list allowed fields, and any fields not in that list get hidden. Look for a corresponding metadata extension file with the same name pattern as the base view.