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: 

The bopf does not generated after cds view activated

former_member267947
Participant

Hi all

I have a CDS view and I would like to generate in addition a BOPF object. The CDS view looks as the following:

@AbapCatalog.sqlViewName: 'ZPOC_CDS_ORDERS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Order for VALEAN POC'
@ObjectModel.compositionRoot: true
@ObjectModel.modelCategory: #BUSINESS_OBJECT 
@ObjectModel.semanticKey: ['DraftId', 'DraftItem']
@ObjectModel.representativeKey: 'DraftId'
@ObjectModel.writeActivePersistence: 'ZPOC_ORDERS'
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true
@OData: {
    publish: true
}
define view ZPOCCDSORDERS as 
    select from zpoc_orders
   {
    key draft_id as DraftId,
    key draft_item as DraftItem,
        order_id as OrderId,
        sales_org as SalesOrg,
        sales_dist as SalesDist,
        sales_div as SalesDiv,
        customer_id as CustomerId,
        recipient_id as RecipientId,
        po_ref as PoRef,
    }

In the transaction /n/BOBF/CONF_UI, I was searching for new generated Z* BOPF object but could not find anything.

What am I doing wrong?

Thanks very much.

1 ACCEPTED SOLUTION

Hi,

Don't give alias for the filed names in your ZPOCCDSORDERS CDS view and try. It should work.

Eg:
define view ZPOCCDSORDERS as select from zpoc_orders

   {
key draft_id,
key draft_item,
order_id 
sales_org
.
.
}

6 REPLIES 6

sathyags
Active Participant
0 Kudos

Can you try adding:

@ObjectModel.transactionalProcessingEnabled: true

former_member267947
Participant
0 Kudos

I changed it to:

@AbapCatalog.sqlViewName: 'ZPOC_CDS_ORDERS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Order for VALEAN POC'
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@ObjectModel.compositionRoot: true
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.writeActivePersistence: 'ZPOC_ORDERS'
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true

@OData: {
publish: true
}
define view ZPOCCDSORDERS as 
select from zpoc_orders
   {
key draft_id as DraftId,
key draft_item as DraftItem,
order_id as OrderId,
sales_org as SalesOrg,
sales_dist as SalesDist,
sales_div as SalesDiv,
customer_id as CustomerId,
recipient_id as RecipientId,
po_ref as PoRef,
po_date as PoDate,
incoterms as Incoterms,
material as Material,
description as Description, 
@Semantics.quantity.unitOfMeasure: 'SalesUnit' 
quantity as Quantity,
@Semantics.unitOfMeasure
sales_unit as SalesUnit,
@Semantics.amount.currencyCode: 'Currency'
price as Price,
@Semantics.currencyCode: true
currency as Currency,
@Semantics.quantity.unitOfMeasure: 'WeightUnit' 
net_weight as NetWeight,
@Semantics.quantity.unitOfMeasure: 'WeightUnit' 
gross_weight as GrossWeight,
@Semantics.unitOfMeasure
weight_unit as WeightUnit,
delivery_date as DeliveryDate, 
plant as Plant,
stor_loc as StorLoc,
dispatch_pl as DispatchPl
}

And I've got the error message:

[BO check] Element DRAFTID is no DB field, no storage (view ZPOCCDSORDERS, table ZPOC_ORDERS)
[BO check] Element DRAFTITEM is no DB field, no storage (view ZPOCCDSORDERS, table ZPOC_ORDERS) 


What am I doing wrong? Thanks


Hi,

Don't give alias for the filed names in your ZPOCCDSORDERS CDS view and try. It should work.

Eg:
define view ZPOCCDSORDERS as select from zpoc_orders

   {
key draft_id,
key draft_item,
order_id 
sales_org
.
.
}

Hello Anujit,

You might have figured out the root cause as the post is more than a year old - I came accross this post recently. Anyway I'm answering here thinking it might help the community.

I believe the issue "Element DRAFTID is no DB field,no storage " is caused when the name alias of the field defined in the interface view (in your case ZPOCCDSORDERS) differs from the name in the underlying data base table ( in your caes zpoc_orders). When the activation happens, the SADL I believe takes into account the name alias instead of the field name and hence the issue.

Workaround:

  • Maintain the same alias as the table field ( or you may not maintain an alias at all) and create a new draft table.

For Example:

Instead of order_id as OrderId,

make it order_id as order_id or just order_id

You can maintain an alias in the consumption view as you please.

  • In order to apply the above work around, delete the draft table from the interface view - For this to happen, comment out all the fields on the interface view ( as the alias still points to the draft ).
  • If there are any parent or child associations, comment out those associations as well.
  • go to the consumption view comment out the associations to the interface view.
  • then activate the consumption view and the interface view.

---------- by now, you would have got rid of the draft table.

Change the alias names as suggested above and change the draft table to a new one.

uncomment all the associations and fields which were commented before.

------> Activate.

**** THE END ***** 🙂

PS: Dont get discouraged with the amount of information above. It might only take 10 mins to follow the process.

With Regards,

Pradeep.

jasonmuzzy
Active Participant
0 Kudos

I realize this question is old, but I found it while looking for a solution to the same problem. I noticed that if I activated the CDS view as a local object then it would generate the BOPF object. Based on that I found and implemented note 2948149 which allowed the BOPF object to generate even though the package was assigned to transport layer SAP.

former_member420390
Discoverer
0 Kudos

For those who still suffering from that issue with aliases used that approach should help - https://help.sap.com/products/ABAP_PLATFORM_2021/cc0c305d2fab47bd808adcad3ca7ee9d/563f9fa4c9c24b579c...