Hi all,
I have customised three fields in an assignment block and populated values in do_prepare_output. The values are getting populated in the custom fields and i can see them on the webui. But when i sort i get dump . Reason is the entity attrib_ref is initial. I found the dump is due to the non-updation of changes into BOL. I found lr_core->modify( ) is the solution to update the BOL framework.
After long debug i fould that manually using lr_core->modify( ) itself initialises the attrib_ref.
Below is the BOL code i use fr populating the values.
*" Employee Responsible-custom field
CALL METHOD lr_entity_val->switch_to_change_mode( ).
if lr_entity_val->is_changeable( ) = abap_true.
lr_entity_val->set_property( iv_attr_name = 'Z_EMPLOYEERESPONSIBLE' iv_value = lv_partner_descr ).
ENDIF.
" Responsible Group-custom field
if lr_entity_val->is_changeable( ) = abap_true.
lr_entity_val->set_property( iv_attr_name = 'Z_RESPONSIBLEGROUP' iv_value = lv_partner_descr ).
ENDIF.
CLEAR lv_partner_descr.
call METHOD lr_entity_val->get_property_as_value
EXPORTING
iv_attr_name = 'Z_RESPONSIBLEGROUP'
IMPORTING
ev_result = lv_partner_descr.
**at this line i have values in lv_partner_descr that i pass in set_property
CLEAR lv_partner_descr.
lr_entity_val->activate_sending( ).
lr_core1->modify( ).
call METHOD lr_entity_val->get_property_as_value
EXPORTING
iv_attr_name = 'Z_RESPONSIBLEGROUP'
IMPORTING
ev_result = lv_partner_descr.
**this method call thows error since the attrib_ref is initail
**if i skip the above method call then the flow continues
DATA: lv_transaction TYPE REF TO if_bol_transaction_context.
lv_transaction = lr_core1->get_transaction( ).
IF lv_transaction->check_save_needed( ) = abap_true
AND lv_transaction->check_save_possible( ) = abap_true.
lv_transaction->save( ).
lv_transaction->commit( ).
COMMIT WORK AND WAIT.
ENDIF.
**always the above if condition is false and save and commit does not get execute
**save needed nd save possible are not true
lr_entity_val ?= lr_coll->get_next( ).
ENDWHILE.
CATCH cx_root.
ENDTRY.
The dump is getting raised at the below code during reread( ) while sorting
if iv_entity->my_manager_entry is not bound or iv_entity->container_proxy is not bound.
raise exception type cx_bol_exception
exporting
textid = cx_bol_exception=>entity_already_freed.
endif.
If i use reread( ) after lr_core->modify( ) then exception throws since arrtib_ref is initial.
Please help me in this regard.
Regards,
Karthik