Hi,
I have a scenario where when a button is clicked on Quote header page, it will direct to a non sap page where user will add configuration details and click on SEND TO QUOTE button. Once this button is clicked, those config details should be updated as line items in Quote
I have written RFC to update the line items in Quote.
Now the problem here is when config details are added, it is not updating the line items ( P.S this scenario used to work before few days now it suddenly stopped working). When i debugged, i see that btorder entiy is not being locked and when i am trying to create
lr_create ?= lr_btitems->create_related_entity( iv_relation_name = 'BTOrderItemAll' ).
it returns initial and unable to update line items.
lr_bol_core = cl_crm_bol_core=>get_instance( ).
TRY .
CALL METHOD lr_bol_core->load_component_set(
EXPORTING
iv_component_set_name = 'ONEORDER' ).
CATCH cx_crm_genil_general_error cx_sy_ref_is_initial.
ENDTRY.
lr_dquery = cl_crm_bol_dquery_service=>get_instance( iv_query_name = 'BTQ1Order' ).
IF lr_dquery IS BOUND.
lr_dquery->add_selection_param( iv_attr_name = 'OBJECT_ID'
iv_sign = 'I'
iv_option = 'EQ'
iv_low = v_trans_id ).
lr_result ?= lr_dquery->get_query_result( ).
IF lr_result IS BOUND.
lr_pr_entity ?= lr_result->if_bol_bo_col~get_current( ).
lr_btorder ?= lr_pr_entity->get_related_entity( iv_relation_name = 'BTADVS1Ord' ).
CHECK lr_btorder->is_locked( ) EQ abap_false.
lr_btorder->switch_to_change_mode( ).
lr_btorder->lock( ).
IF lr_btorder->lock( ) EQ abap_true.
IF lr_btorder IS BOUND.
lr_btadminh ?= lr_btorder->get_related_entity( iv_relation_name = 'BTOrderHeader' ).
IF lr_btadminh IS BOUND.
lr_btitems ?= lr_btadminh->get_related_entity( iv_relation_name = 'BTHeaderItemsExt' ).
IF lr_btitems IS BOUND.
* lr_btitems->lock( ).
lr_btitems_all ?= lr_btitems->get_related_entities( iv_relation_name = 'BTOrderItemAll' ).
IF lr_btitems_all IS BOUND.
lr_btitems1 ?= lr_btitems_all->get_first( )." IF lr_btitems->lock( ) EQ abap_true .
IF lr_btitems1 IS NOT BOUND.
lr_create ?= lr_btitems->create_related_entity( iv_relation_name = 'BTOrderItemAll' ).
when i manually execute the same fm (without opening quote in webui) giving the quote id and config details in variant, line item details are being updated.
Please let me know why the entity is not getting locked though the quote is in display mode.
Thanks in advance,
Regards,
Prathyusha VJ.