Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Extending Standard ABAP CDS View with Custom Fields

durgaprasanth_vemula
Participant
0 Kudos

Hi,

i'm working on extending standard CDS View with custom/standard fields which are available in SAP backend system.

I am working on Extending the Fiori Element App "Manage Supplier Master Data" which was developed using ABAP CDS Views and in the FIori App library they had provided extension in the Back-end For the ABAP CDS View "C_BusinessPartnerPurgOrg" and given Extension include in DDIC "INCL_EEW_LFM1" and I add new Custom Field and same field i am planning to use Extend View for the "C_BusinessPartnerPurgOrg" and I am getting error message "Annotation 'Metadata.allowExtensions' missing in base view 'C_BusinessPartnerPurgOrg'"

As in the Fiori Library they had provided to extend it but in the CDS View 'C_BusinessPartnerPurgOrg'" does not have the Annotation "Metadata.allowExtensions:True" and then how we can proceed to do extension

@Metadata.layer: #PARTNER
annotate view C_BusinessPartnerPurgOrg
with
{



}

4 REPLIES 4

franois_henrotte
Active Contributor

0 Kudos

Hi Francois,

I had gone through this document but when i try to extend the View it is giving error message "Annotation 'Metadata.allowExtensions' missing in base view 'C_BusinessPartnerPurgOrg'" then how i can extend as 'C_BusinessPartnerPurgOrg'" does not have 'Metadata.allowExtensions:true and could you please help me in this.

0 Kudos

Hi DurgaPrasanth,

a CDS Metadata Exstension (short: MDE, Syntax: "...annotate view ....") is meant to enrich an existing CDS view with meta data, not to extend it with custom fields. Thus the error message you're getting since the base view is apparently not enabled for CDS MDE.

For custom field extensions, please create a CDS view using the DDL template Extend View which has following syntax:

@AbapCatalog.sqlViewAppendName: '${sql_view_append_name}'
@EndUserText.label: '${ddl_source_description}'
extend view ${view_name} with ${ddl_source_name_editable} {
	${data_source_name}.${element_name}
}
Check the link provided by François above for the full explanation.

Kind regards,
Carine

0 Kudos

Hi Carine,

Thanks for providing the answer and i have one more question i have a requirement where i need to disable the field in the standard CDS View 'C_PurchaseReqnItem' and as per the below it is displaying the Field PurReqCreationDate in the "Manage Purchase Requisition Professional" Fiori App.

@UI: { fieldGroup: { qualifier: 'QuantityDate02', position: 20, importance: #HIGH } }

Document.PurReqCreationDate,

Now My Requirement i need to disable the field as i had to use annotation

@ObjectModel.readOnly: true

i had done the below code

@AbapCatalog.sqlViewAppendName: 'ZCPURREQNITM'

@EndUserText.label: '${ddl_source_description}'

extend view C_PurchaseReqnItem with zC_PurchaseReqnItem {

@ObjectModel.readOnly: true

Document.PurReqCreationDate }

But I am getting error "View field PURREQCREATIONDATE-C_PURCHASEREQNITEM already exists in parent object (DDL source )" could you please help how to handle this situation.