Hi all,
Iam trying to update object with header and items to perform deep entity insert.But the create_entity method is only triggered and not the Create_deep_entity.
Head entity definition in MPC
*Head entity----------------------------------------------------------------
*-----------------------------------------------------------------------------------------
lcr_delhead_entity = model->create_entity_type( 'delhead' )."delivery items
"create needed properties of entity "Spool"
build_props_by_structname( iv_structname = 'GOODS_RCPT_SI_S'
icr_entity = lcr_delhead_entity ).
"enhance property behaviour
lo_property = lcr_delhead_entity->get_property( iv_property_name = 'DEL_NUM' ).
lo_property->set_is_key( ).
lo_property->set_type_edm_string( ).
lo_property = lcr_delivery_entity->get_property( iv_property_name = 'PRD_NUM' ).
lo_property->set_is_key( ).
lo_property->set_type_edm_string( ).
lcr_delhead_entity->bind_structure( 'GOODS_RCPT_SI_S' ).
"create entity sets of entity
lcr_entity_set_del_head = lcr_delhead_entity->create_entity_set( 'deliveryhead' ).
"set annotations for entity set behaviour
lcr_entity_set_del_head->set_creatable( abap_true ).
lcr_entity_set_del_head->set_updatable( abap_true ).
lcr_entity_set_del_head->set_deletable( abap_true ).
lcr_entity_set_del_head->set_addressable( abap_true ).
Item entity definition in MPC
* items entity----------------------------------------------------------------
*-----------------------------------------------------------------------------------------
lcr_delivery_entity = model->create_entity_type( 'delitems' )."delivery items
"create needed properties of entity "Spool"
build_props_by_structname( iv_structname = 'GOODS_RCPT_SI_S'
icr_entity = lcr_delivery_entity ).
"enhance property behaviour
lo_property = lcr_delivery_entity->get_property( iv_property_name = 'DEL_NUM' ).
lo_property->set_is_key( ).
lo_property->set_type_edm_string( ).
lo_property = lcr_delivery_entity->get_property( iv_property_name = 'PRD_NUM' ).
lo_property->set_is_key( ).
lo_property->set_type_edm_string( ).
lo_property = lcr_delivery_entity->get_property( iv_property_name = 'DEL_ITEM_NUM' ).
lo_property->set_is_key( ).
lo_property->set_type_edm_string( ).
lcr_delivery_entity->bind_structure( 'GOODS_RCPT_SI_S' ).
"create entity sets of entity
lcr_entity_set_del = lcr_delivery_entity->create_entity_set( 'deliverylist' ).
"set annotations for entity set behaviour
lcr_entity_set_del->set_creatable( abap_true ).
lcr_entity_set_del->set_updatable( abap_true ).
lcr_entity_set_del->set_deletable( abap_true ).
lcr_entity_set_del->set_addressable( abap_true ).
Navigation and associations
***********************************************************************************************************************************
* ASSOCIATIONS
***********************************************************************************************************************************
lo_association = model->create_association(
iv_association_name = 'delheadsettodelitemset' "#EC NOTEXT
iv_left_type = 'delhead' "#EC NOTEXT
iv_right_type = 'delitems' "#EC NOTEXT
iv_right_card = cardinality_feed"'N' "#EC NOTEXT
iv_left_card = cardinality_entity )."#EC NOTEXT
"iv_def_assoc_set = abap_false ). "#EC NOTEXT
"item to head
lo_association = model->create_association(
iv_association_name = 'delitemsettodeleadset' "#EC NOTEXT
iv_left_type = 'delitems' "#EC NOTEXT
iv_right_type = 'delhead' "#EC NOTEXT
iv_right_card = cardinality_entity"'N' "#EC NOTEXT
iv_left_card = cardinality_entity )."#EC NOTEXT
"iv_def_assoc_set = abap_false ). "#EC NOTEXT
***********************************************************************************************************************************
* NAVIGATION PROPERTIES
***********************************************************************************************************************************
* Navigation Properties for entity - delhead
"lo_entity_type = model->get_entity_type( iv_entity_name = 'delhead' ). "#EC NOTEXT
lcr_delhead_entity->create_navigation_property( iv_property_name = 'delheadtodellist' "#EC NOTEXT
iv_association_name = 'delheadsettodelitemset' ).
"lo_entity_type = model->get_entity_type( iv_entity_name = 'delitems' ). "#EC NOTEXT
lcr_delivery_entity->create_navigation_property( iv_property_name = 'dellisttodelhdead' "#EC NOTEXT
iv_association_name = 'delitemsettodeleadset' ).
UI code to update the deep entity
- my navigation name delheadtodellist
var requestORderHeader = {}; requestORderHeader.PRD_NUM = "01"; requestORderHeader.DEL_NUM = "01"; requestORderHeader.DEL_ITEM_NUM = "01"; requestORderHeader.ARTI_NUM = "P010"; requestORderHeader.DEL_DESC = "200"; requestORderHeader.SUB_DIV = null; requestORderHeader.COLL_TYPE = null; requestORderHeader.SEASON = null; requestORderHeader.MAIN_CLASS = null; requestORderHeader.CLASS = null; requestORderHeader.GEN_ARTI_NUM = null; requestORderHeader.DEL_QUAN = null; requestORderHeader.QUANTITY = null; var itemData = []; itemData.push({ PRD_NUM: "01", DEL_NUM: "01" , DEL_ITEM_NUM: "01", ARTI_NUM: "P010", DEL_DESC: "200", SUB_DIV: null, COLL_TYPE: null, SEASON: null, MAIN_CLASS: null, CLASS: null, GEN_ARTI_NUM: null, DEL_QUAN: null , QUANTITY: null }); //my navigation name delheadtodellist requestORderHeader.delheadtodellist = itemData;
// Retrieve model from controller var oModel = sap.ui.getCore().getModel(); oModel.create('/deliverylist', requestORderHeader, null, function(oData, oResponse) { debugger; alert ('Order creation succeed !'); }, function(error) { debugger; alert('Call service creation failed'); } );
but still only create_entity method is called and not the CREATE_DEEP_ENTITY method
what might be wrong in my code help me out
Thanks
Deepan