Hi experts,
I have a view in a UI component using model ONEORDER.
My context node is type BuilHeader (BP attribute data) and I'm trying to save a DOB change to the underlying database tables.
My code:
data: lr_entity type ref to cl_crm_bol_entity,
ls_attr type crmst_header_object_buil,
lr_tx type ref to if_bol_transaction_context,
lr_core type ref to cl_crm_bol_core.
"convenience method that returns a cl_crm_bol_entity with a query
lr_entity ?= me->get_partner_entity( iv_bp_number = '0110000409' ).
lr_core = cl_crm_bol_core=>get_instance( ).
lr_tx ?= lr_core->get_transaction( ).
lr_tx = lr_core->begin_transaction( ).
check lr_entity->lock( ) = if_genil_boolean=>true.
lr_entity->switch_to_change_mode( ).
lr_entity->get_properties( importing es_attributes = ls_attr ).
"Setting new DOB attribute
ls_attr-birthdate = iv_dob.
lr_entity->set_properties( is_attributes = ls_attr ).
lr_core->modify( ).
check lr_tx->check_save_needed( ) eq abap_true.
check lr_tx->check_save_possible( ) eq abap_true.
check lr_tx->save( ) = abap_true.
lr_tx->commit( ).
lr_entity is populated; I can debug and see it's values at runtime (in both lr_entity and ls_attr).
My change (the updated DOB) is shown on the UI, but is not persisted in the database.
I'm not sure why, but 'check_save_needed( )' is always returning abap_false, even though I'm changing a property?
Can anyone point me in the right direction?