on ‎2019 Nov 27 9:16 AM
Request clarification before answering.
Hi Deborshi,
this is a known problem.
If you create a SEGW project with Reference Data Source approach you will be able to redefine the DEFINE method of the model provider extension class.
Here you can add the following coding (you have to adapt it to the name of your entity type) so that the appropriate annotation sap:createtable = true will be generated in the $metadata document.
METHOD define.
DATA: lo_entity_type TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
lo_property TYPE REF TO /iwbep/if_mgw_odata_property.
super->define( ).
"Create sap:creatable="true" annotation for product entity set
lo_entity_type = model->get_entity_type( zcl_z_be2ui_###_mpc=>gc_zc_be2ui_product_###type ).
IF lo_entity_type IS NOT INITIAL.
lo_entity_type->set_creatable( abap_true ).
"Create sap:creatable="false" annotation for the key field "Product"
lo_property = lo_entity_type->get_property( 'Product').
IF lo_property IS NOT INITIAL.
lo_property->set_creatable( abap_false ).
ENDIF.
ENDIF.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Andre,
in addition to lo_entity_type->set_creatable( abap_true ),
I noticed that BOPF actions also need to be checked, CREATE comes always disabled after CDS activation, at least in my system
with checkbox clicked and BOPF regenerated, it has finally worked!
my CDS
@AbapCatalog.sqlViewName: 'ZTRYBOPFFIO'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Demo abap for fiori'
@OData.publish: true
@VDM.viewType: #CONSUMPTION
@ObjectModel:
{
modelCategory: #BUSINESS_OBJECT,
compositionRoot: true,
transactionalProcessingEnabled: true,
writeActivePersistence: 'ztry_bopf_fiori',
updateEnabled: true,
deleteEnabled: true
//createEnabled: true added in define method of ZCL_ZTRY_IF_BOPF_FIORI
}
define view ZTRY_IF_BOPF_FIORI
as select from ztry_bopf_fiori
{
@UI:{ selectionField: [{ position: 10 }],
lineItem : [{ position: 10 }],
identification: [{ position: 10 , label: 'Sales Order' }] }
key so_id,
@UI:{ selectionField: [{ position: 20 }],
lineItem : [{ position: 20 }],
identification: [{ position: 20 , label: 'Billing Status' }] }
billing_status,
@UI:{ selectionField: [{ position: 30 }],
lineItem : [{ position: 30 }],
identification: [{ position: 30 , label: 'Gross Amount' }] }
gross_amount,
@UI:{ selectionField: [{ position: 40 }],
lineItem : [{ position: 40 }],
identification: [{ position: 40 , label: 'Currency Code' }] }
currency_code
}
//Important: if cds is changed define method will be regenerated and changes will be lost, so redefine again-add below code
// METHOD define.
// DATA: lo_entity_type TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
//
// lo_property TYPE REF TO /iwbep/if_mgw_odata_property.
//
//
// super->define( ).
// "Create sap:creatable="true" annotation for entity set
//
// lo_entity_type = model->get_entity_type( 'ZTRY_IF_BOPF_FIORIType' ).
// IF lo_entity_type IS NOT INITIAL.
//
// lo_entity_type->set_creatable( abap_true ).
//
// ENDIF.
//
//
// ENDMETHOD.


You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 11 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.