Dear All,
I developed a Odata service using classical scenarios to create Notifications. I have almost 6 fields out of which we can create notification using 4 fields. Is it mandatory to pass values to all 6 parameters while posting them OR can be passed with 4 and rest blank. However, In my case I tried using 4 and 6 but no create entity gets triggered while using Post method from Chrome REST service. I tried testing with X-CSRF token but still couldn't create. Please share an example if you have one. Please help.
This is my structure for my entity type and entity set.
lo_entity_type = model->create_entity_type( iv_entity_type_name = 'Znotif_ty' iv_def_entity_set = abap_false ). "#EC NOTEXT
***********************************************************************************************************************************
*Properties
***********************************************************************************************************************************
lo_property = lo_entity_type->create_property( iv_property_name = 'FunctLoc' iv_abap_fieldname = 'FUNCT_LOC' ). "#EC NOTEXT
lo_property->bind_data_element( 'TPLNR' ).
lo_property->set_conversion_exit( 'TPLNR' ).
*lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Equipment' iv_abap_fieldname = 'EQUIPMENT' ). "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->bind_data_element( 'EQUNR' ).
lo_property->set_conversion_exit( 'ALPHA' ).
*lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'ExternalNumber' iv_abap_fieldname = 'EXTERNAL_NUMBER' ). "#EC NOTEXT
*lo_property->set_is_key( ).
lo_property->bind_data_element( 'QMNUM' ).
lo_property->set_conversion_exit( 'ALPHA' ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'ShortText' iv_abap_fieldname = 'SHORT_TEXT' ). "#EC NOTEXT
lo_property->bind_data_element( 'QMTXT' ).
*lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Priority' iv_abap_fieldname = 'PRIORITY' ). "#EC NOTEXT
lo_property->bind_data_element( 'PRIOK' ).
*lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Planplant' iv_abap_fieldname = 'PLANPLANT' ). "#EC NOTEXT
lo_property->bind_data_element( 'IWERK' ).
*lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'Reportedby' iv_abap_fieldname = 'REPORTEDBY' ). "#EC NOTEXT
lo_property->bind_data_element( 'QMNAM' ).
*lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'NotifType' iv_abap_fieldname = 'NOTIF_TYPE' ). "#EC NOTEXT
lo_property->bind_data_element( 'QMART' ).
*lo_property->set_creatable( abap_false ).
lo_property->set_updatable( abap_false ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_property = lo_entity_type->create_property( iv_property_name = 'NotifNo' iv_abap_fieldname = 'NOTIF_NO' ). "#EC NOTEXT
lo_property->set_is_key( ).
lo_property->bind_data_element( 'QMNUM' ).
lo_property->set_conversion_exit( 'ALPHA' ).
lo_property->set_sortable( abap_false ).
lo_property->set_nullable( abap_false ).
lo_property->set_filterable( abap_false ).
lo_entity_type->bind_structure( iv_structure_name = 'ZCL_NOTIF_CREATE_MPC=>LS_ZNOTIF_TY' ). "#EC NOTEXT
***********************************************************************************************************************************
* ENTITY SETS
***********************************************************************************************************************************
lo_entity_set = lo_entity_type->create_entity_set( 'ZNOTI_SET' ). "#EC NOTEXT
lo_entity_set->set_creatable( abap_true ).
lo_entity_set->set_updatable( abap_true ).
lo_entity_set->set_deletable( abap_false ).
lo_entity_set->set_subscribable( abap_false ).
lo_entity_set->set_filter_required( abap_false ).
Thanks,
Vikram