05-09-2018 8:17 AM
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.
06-12-2018 2:37 PM
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
.
.
}
05-09-2018 4:03 PM
Can you try adding:
@ObjectModel.transactionalProcessingEnabled: true
05-11-2018 6:57 AM
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
06-12-2018 2:37 PM
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
.
.
}
06-19-2019 10:21 AM
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:
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.
---------- 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.
03-10-2021 12:53 AM
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.
03-14-2022 12:21 PM
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...