Skip to Content
author's profile photo Former Member
Former Member

Status is not changing instantly after clicking on 'Change Status' button

Hello CRM Gurus,

I have a z-component which is activity search component. In the Result List tool bar, one button 'Change Status' is there. When i click on this button, Status is not updated instantly. Second time when i click on that button, then it is updated. my questio is why it is not updating the status instantly. I have added the following code for refreshing the result lkist:

Data : lr_col_all TYPE REF TO if_bol_bo_col

lr_col_all = me->typed_context->btqract->collection_wrapper->get_copy( ).

me->typed_context->btqract->collection_wrapper->set_collection( lr_col_all ).

Can u plz solve this issue.

thanks & regards

Madhusudan

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jun 17, 2008 at 03:33 PM

    Hello Madhu,

    Can you paste full code of the event handler 'Change Status'?

    There can be multiple explanations for this problem, one of them BOL error. The code would help to see what is going on. The code you added for refreshing is just resetting the collection to its copy which is probably not helping to resolve the problem.

    Best Regards,

    Yevgen

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Yevgen,

      plz find full code for the following events:

      Method : EH_ONCHANGESTATUS " Change Status";

      *method EH_ONCHANGESTATUS.*

      data: lt_col_def type tableviewcontroltab,

      ls_col_def type line of tableviewcontroltab,

      lt_ddlb type bsp_wd_dropdown_table,

      ls_ddlb type bsp_wd_dropdown_line,

      ls_tj30 type tj30,

      ls_status_wrk type crmt_status_wrk.

      data: lr_entity type ref to cl_crm_bol_entity,

      lr_msgsrv type ref to cl_bsp_wd_message_service,

      lr_collection type ref to if_bol_bo_col.

      • load status...

      field-symbols:

      <ls_status> type crms_status_activity_ui.

      data:

      lv_window type string,

      lv_title type string,

      lv_lines_selected type integer,

      lv_popup_allowed type crmt_boolean,

      ls_proc_type type crmc_proc_type,

      lv_status_profile_new type j_stsma,

      lv_status_profile_old type j_stsma,

      lv_process_type type crmt_process_type,

      lv_process_type_new type crmt_process_type,

      lv_process_type_old type crmt_process_type,

      ls_ddlb_options type crms_thtmlb_search_ddlb_nvp,

      lt_status type table of crms_status_activity_ui,

      ls_status type crms_status_activity_ui,

      lv_description type crmt_description.

      • Code Changes for Mass Status Change by Sunita

      data: lr_current type ref to cl_crm_bol_entity,

      lv_status_set type ref to if_bol_bo_col,

      lr_status type ref to cl_crm_bol_entity,

      lv_status type string,

      gv_status type string,

      lv_processtype type string,

      gv_processtype type string,

      lv_size type i.

      data: begin of wa_tab,

      proc_type type string,

      status type string,

      end of wa_tab,

      itab like standard table of wa_tab.

      CLEAR gt_status.

      lv_popup_allowed = abap_true.

      lr_collection ?= me->typed_context->btqract->collection_wrapper->if_bol_bo_col_multi_sel~get_marked( ).

      lv_size = lr_collection->size( ).

      do lv_size times.

      if sy-index = 1.

      lr_entity ?= lr_collection->get_first( ).

      check lr_entity is bound.

      lv_processtype = lr_entity->get_property_as_string( iv_attr_name = 'PROCESS_TYPE' ).

      me->typed_context->btorder->on_new_focus( focus_bo = lr_entity ).

      lr_current ?= me->typed_context->btorder->collection_wrapper->get_current( ).

      check lr_current is bound.

      lr_current ?= lr_current->get_related_entity( iv_relation_name = 'BTOrderHeader' ).

      check lr_current is bound.

      lr_current ?= lr_current->get_related_entity( iv_relation_name = 'BTHeaderStatusSet' ).

      check lr_current is bound.

      lr_current ?= lr_current->get_related_entity( iv_relation_name = 'BTStatusHCurrent' ).

      lv_status = lr_current->get_property_as_string( iv_attr_name = 'STATUS' ).

      wa_tab-proc_type = lv_processtype.

      wa_tab-status = lv_status.

      append wa_tab to itab.

      else.

      lr_entity ?= lr_collection->get_next( ).

      check lr_entity is bound.

      lv_processtype = lr_entity->get_property_as_string( iv_attr_name = 'PROCESS_TYPE' ).

      me->typed_context->btorder->on_new_focus( focus_bo = lr_entity ).

      lr_current ?= me->typed_context->btorder->collection_wrapper->get_current( ).

      check lr_current is bound.

      lr_current ?= lr_current->get_related_entity( iv_relation_name = 'BTOrderHeader' ).

      check lr_current is bound.

      lr_current ?= lr_current->get_related_entity( iv_relation_name = 'BTHeaderStatusSet' ).

      check lr_current is bound.

      lr_current ?= lr_current->get_related_entity( iv_relation_name = 'BTStatusHCurrent' ).

      lv_status = lr_current->get_property_as_string( iv_attr_name = 'STATUS' ).

      read table itab with key proc_type = lv_processtype

      status = lv_status transporting no fields.

      if sy-subrc = 0.

      continue.

      else.

      lv_popup_allowed = abap_false.

      lr_msgsrv = cl_bsp_wd_message_service=>get_instance( ).

      lr_msgsrv->add_message(

      iv_msg_type = 'I'

      iv_msg_id = 'CRM_ACTIVITY_H'

      iv_msg_number = '809'

      iv_important_info = abap_true

      ).

      return.

      • exit.

      endif.

      endif.

      enddo.

      • if no line was selected...

      if lr_entity is not bound.

      lv_popup_allowed = abap_false.

      endif.

      data: lv_object_guid TYPE crmt_object_guid,

      lv_object_kind TYPE crmt_object_kind,

      lt_status_ui TYPE crmt_status_ui_tab.

      FIELD-SYMBOLS:

      <status_ui> TYPE crmt_status_ui.

      *if lv_popup_allowed = abap_true.

      lr_current->get_property_as_value( EXPORTING iv_attr_name = 'GUID'

      IMPORTING ev_result = lv_object_guid ).

      lr_current->get_property_as_value( EXPORTING iv_attr_name = 'KIND'

      IMPORTING ev_result = lv_object_kind ).

      CALL METHOD cl_crm_uiu_status_info=>get_status_info

      EXPORTING

      iv_object_guid = lv_object_guid

      iv_object_kind = lv_object_kind

      RECEIVING

      rt_status_ui = lt_status_ui

      EXCEPTIONS

      error_occurred = 1

      OTHERS = 2.

      LOOP AT lt_status_ui ASSIGNING <status_ui>.

      ls_status-status = <status_ui>-status.

      ls_status-txt30 = <status_ui>-txt30.

      append ls_status to gt_status.

      ENDLOOP.

      refresh lt_col_def.

      ls_col_def-columnname = 'TXT30'. "#EC NOTEXT

      ls_col_def-title = 'STATUS'. "#EC NOTEXT

      append ls_col_def to lt_col_def.

      clear ls_col_def.

      lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_ACTIVITY/MASSCHANGE_ACT_TITLE' ).

      lv_window = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/CHANGE_STATUS' ).

      gt_status_popup = comp_controller->window_manager->create_decision_popup(

      iv_title = lv_title

      iv_description = lv_window

      iv_visible_row_count = 7

      iv_display_table = gt_status

      iv_visible_columns = lt_col_def

      ).

      gt_status_popup->set_on_close_event( iv_event_name = 'STATUS_CLOSE' iv_view = me )."#EC NOTEXT

      gt_status_popup->open( ).

      *endif.

      endmethod.

      *Method : "Status Close"*

      method EH_ONSTATUS_CLOSE.

      DATA: lv_outputnode TYPE REF TO cl_bspwdcmp_bspwdcomponen_cn01,

      lv_rowindex TYPE string,

      lv_event_name TYPE string,

      lv_op TYPE seocmpname,

      ls_status TYPE crms_status_activity_ui,

      lv_value TYPE string,

      lr_cuco_bt126 TYPE REF TO ZL_Z_DFLT_A_QUERYCUCO_IMPL.

      • Get popup results

      lv_outputnode ?= gt_status_popup->get_context_node( 'OUTPUTNODE' ).

      lv_rowindex = lv_outputnode->get_selectedrowindex( ).

      lv_event_name = lv_outputnode->get_event_name( ).

      IF lv_event_name = 'OK'.

      lv_outputnode->init_attributes( ).

      READ TABLE gt_status INDEX lv_rowindex INTO ls_status.

      lv_value = ls_status-status.

      • lr_cuco_bt126 ?= me->get_custom_controller(

      • controller_id = ZL_Z_DFLT_A_QUERYCUCO_IMPL=>global_cuco_name ).

      lr_cuco_bt126 ?= me->get_custom_controller(

      controller_id = ZL_Z_DFLT_A_QUERYCUCO_IMPL=>global_cuco_name ).

      CALL METHOD me->process_update

      EXPORTING

      iv_status = 'X'

      iv_value = lv_value

      ir_cuco_bt126 = lr_cuco_bt126.

      ENDIF.

      endmethod.

      Method : process_update

      method PROCESS_UPDATE.

      DATA: lo_sel_act TYPE REF TO cl_bsp_wd_collection_wrapper,

      lo_marked TYPE REF TO if_bol_bo_col,

      lo_iterator TYPE REF TO if_bol_bo_col_iterator,

      lv_size TYPE i,

      lv_index TYPE i,

      lo_object TYPE REF TO if_bol_bo_property_access,

      lo_activity_list TYPE REF TO cl_crm_bol_entity,

      lo_activity TYPE REF TO cl_crm_bol_entity,

      lo_header TYPE REF TO cl_crm_bol_entity,

      lo_act_ext TYPE REF TO cl_crm_bol_entity,

      lv_core TYPE REF TO cl_crm_bol_core,

      lv_transaction TYPE REF TO if_bol_transaction_context,

      lv_success TYPE crmt_boolean,

      lo_related TYPE REF TO cl_bsp_wd_collection_wrapper,

      lv_guid TYPE crmt_genil_object_guid,

      lo_tx_ctxt TYPE REF TO cl_crm_bol_custom_tx_ctxt,

      lo_transaction TYPE REF TO if_bol_transaction_context,

      lo_status_set TYPE REF TO cl_crm_bol_entity,

      lo_status TYPE REF TO cl_crm_bol_entity,

      lv_attr_name TYPE name_komp,

      lt_guid_name_val TYPE crmt_guid_name_val_comb_t,

      ls_guid_name_val TYPE crmt_guid_name_val_comb,

      lv_value TYPE string,

      ls_status TYPE crms_status_activity_ui,

      lr_col_all TYPE REF TO if_bol_bo_col.

      IF iv_value IS INITIAL.

      RETURN.

      ENDIF.

      CREATE OBJECT lo_tx_ctxt.

      lo_sel_act = me->typed_context->btqract->get_collection_wrapper( ).

      lo_marked = lo_sel_act->get_marked( ).

      lo_iterator = lo_marked->get_iterator( ).

      lv_size = lo_iterator->size( ).

      lv_core = cl_crm_bol_core=>get_instance( ).

      IF lv_size = 0.

      RETURN.

      ENDIF.

      lv_index = 1.

      DO lv_size TIMES.

      lo_object = lo_iterator->get_by_index( lv_index ).

      lo_activity_list ?= lo_object.

      CALL METHOD lo_activity_list->get_property_as_value

      EXPORTING

      iv_attr_name = 'GUID'

      IMPORTING

      ev_result = lv_guid.

      lo_activity = lv_core->get_root_entity( iv_object_name = 'BTOrder' iv_object_guid = lv_guid )."#EC NOTEXT

      lo_activity->switch_to_change_mode( ).

      TRY.

      lo_header = lo_activity->get_related_entity( 'BTOrderHeader' )."#EC NOTEXT

      CATCH cx_crm_genil_model_error.

      ENDTRY.

      TRY.

      lo_act_ext = lo_header->get_related_entity( 'BTHeaderActivityExt' )."#EC NOTEXT

      CATCH cx_crm_genil_model_error.

      ENDTRY.

      • set value..

      IF NOT iv_category IS INITIAL.

      lv_attr_name = 'CATEGORY'. "#EC NOTEXT

      lo_act_ext->switch_to_change_mode( ).

      CALL METHOD lo_act_ext->if_bol_bo_property_access~set_property

      EXPORTING

      iv_attr_name = lv_attr_name

      iv_value = iv_value.

      lv_value = iv_value.

      ELSEIF NOT iv_priority IS INITIAL.

      lv_attr_name = 'PRIORITY'. "#EC NOTEXT

      lo_act_ext->switch_to_change_mode( ).

      CALL METHOD lo_act_ext->if_bol_bo_property_access~set_property

      EXPORTING

      iv_attr_name = lv_attr_name

      iv_value = iv_value.

      lv_value = iv_value.

      ELSEIF NOT iv_status IS INITIAL.

      lv_attr_name = 'STATUS'. "#EC NOTEXT

      TRY.

      lo_status_set = lo_header->get_related_entity( 'BTHeaderStatusSet' ).

      CATCH cx_crm_genil_model_error.

      ENDTRY.

      IF lo_status_set IS BOUND.

      TRY.

      lo_status = lo_status_set->get_related_entity( 'BTStatusHCurrent' ).

      CATCH cx_crm_genil_model_error.

      ENDTRY.

      ENDIF.

      IF lo_status IS BOUND.

      lo_status->switch_to_change_mode( ).

      CALL METHOD lo_status->if_bol_bo_property_access~set_property

      EXPORTING

      iv_attr_name = 'ACT_STATUS' "#EC NOTEXT

      iv_value = iv_value.

      READ TABLE gt_status INTO ls_status

      WITH KEY status = iv_value.

      lv_value = ls_status-txt30.

      ENDIF.

      ENDIF.

      lv_core->modify( ).

      lo_transaction = lo_activity->get_transaction( ).

      IF lo_transaction IS BOUND.

      lo_tx_ctxt->add_tx_context( lo_transaction ).

      ENDIF.

      lv_index = lv_index + 1.

      ls_guid_name_val-guid = lv_guid.

      ls_guid_name_val-name = lv_attr_name.

      ls_guid_name_val-value = lv_value.

      INSERT ls_guid_name_val INTO TABLE lt_guid_name_val.

      ENDDO.

      TRY.

      lv_success = lo_tx_ctxt->if_bol_transaction_context~save( ).

      IF NOT lv_success IS INITIAL.

      lo_tx_ctxt->if_bol_transaction_context~commit( ).

      LOOP AT lt_guid_name_val INTO ls_guid_name_val.

      READ TABLE ir_cuco_bt126->gt_guid_name_val

      TRANSPORTING NO FIELDS

      WITH KEY guid = ls_guid_name_val-guid

      name = ls_guid_name_val-name.

      IF sy-subrc = 0.

      MODIFY ir_cuco_bt126->gt_guid_name_val

      INDEX sy-tabix FROM ls_guid_name_val

      TRANSPORTING value.

      ELSE.

      INSERT ls_guid_name_val INTO TABLE ir_cuco_bt126->gt_guid_name_val.

      • lo_sel_act = me->typed_context->btqract->get_collection_wrapper( ).

      • lo_marked = lo_sel_act->get_marked( ).

      • lo_iterator = lo_marked->get_iterator( ).

      ENDIF.

      ENDLOOP.

      lr_col_all = me->typed_context->btqract->collection_wrapper->get_copy( ).

      me->typed_context->btqract->collection_wrapper->set_collection( lr_col_all ).

      ENDIF.

      CATCH cx_root.

      IF lv_success IS INITIAL.

      • debugging code.

      ENDIF.

      ENDTRY.

      endmethod.

      Let me know if you need any information.

      thanks in advance.

      Madhusudan

  • Posted on Jun 18, 2008 at 09:23 AM

    Hi Madhu,

    In crm 5.2 system in activities there is a button 'Change Status', it works fine.

    I will give u the code

    method EH_ONCHANGESTATUS

    DATA: lt_col_def TYPE tableviewcontroltab,

    ls_col_def TYPE LINE OF tableviewcontroltab,

    lt_ddlb TYPE bsp_wd_dropdown_table,

    ls_ddlb TYPE bsp_wd_dropdown_line,

    ls_tj30 TYPE tj30,

    ls_status_wrk TYPE crmt_status_wrk.

    DATA: lr_entity TYPE REF TO cl_crm_bol_entity,

    lr_collection TYPE REF TO if_bol_bo_col.

    • load status...

    FIELD-SYMBOLS:

    <ls_status> TYPE crms_status_activity_ui.

    DATA:

    lv_window TYPE string,

    lv_title TYPE string,

    lv_lines_selected TYPE integer,

    lv_popup_allowed TYPE crmt_boolean,

    ls_proc_type TYPE crmc_proc_type,

    lv_status_profile_new TYPE j_stsma,

    lv_status_profile_old TYPE j_stsma,

    lv_process_type TYPE crmt_process_type,

    lv_process_type_new TYPE crmt_process_type,

    lv_process_type_old TYPE crmt_process_type,

    ls_ddlb_options TYPE crms_thtmlb_search_ddlb_nvp,

    lt_status TYPE TABLE OF crms_status_activity_ui,

    ls_status TYPE crms_status_activity_ui,

    lv_description TYPE crmt_description.

    " check that all process tapes are equal

    lr_collection ?= me->typed_context->btqract->collection_wrapper->if_bol_bo_col_multi_sel~get_marked( ).

    lr_entity ?= lr_collection->get_first( ).

    lv_popup_allowed = abap_true.

    • if no line was selected...

    IF lr_entity IS NOT BOUND.

    lv_popup_allowed = abap_false.

    ENDIF.

    WHILE lr_entity IS BOUND.

    lr_entity->get_property_as_value( EXPORTING iv_attr_name = 'PROCESS_TYPE'

    IMPORTING ev_result = lv_process_type_new ).

    IF lv_process_type_old <> lv_process_type_new.

    lv_process_type_old = lv_process_type_new.

    CALL FUNCTION 'CRM_ORDER_PROC_TYPE_SELECT_CB'

    EXPORTING

    iv_process_type = lv_process_type_new

    IMPORTING

    es_proc_type = ls_proc_type

    EXCEPTIONS

    entry_not_found = 1

    text_entry_not_found = 2

    OTHERS = 3.

    IF sy-subrc = 0 AND ls_proc_type-user_stat_proc IS NOT INITIAL.

    lv_status_profile_new = ls_proc_type-user_stat_proc.

    ENDIF.

    IF lv_status_profile_old IS INITIAL.

    lv_status_profile_old = lv_status_profile_new.

    ENDIF.

    IF lv_status_profile_old <> lv_status_profile_new OR

    lv_status_profile_new IS INITIAL.

    lv_popup_allowed = abap_false.

    EXIT.

    ENDIF.

    ENDIF.

    lv_lines_selected = lv_lines_selected + 1.

    lr_entity ?= lr_collection->get_next( ).

    ENDWHILE.

    IF lv_popup_allowed = abap_false.

    • Different Status Schemes: Through an Error Message

    DATA: lr_msg_service TYPE REF TO cl_bsp_wd_message_service.

    lr_msg_service = cl_bsp_wd_message_service=>get_instance( ).

    CALL METHOD lr_msg_service->add_message

    EXPORTING

    iv_msg_type = if_genil_message_container=>mt_error

    iv_msg_id = 'CRM_OPPORT_H'

    iv_msg_number = 025

    • iv_msg_v1 = sy-msgv1

    • iv_msg_v2 = sy-msgv2

    • iv_msg_v3 = sy-msgv3

    • iv_msg_v4 = sy-msgv4

    iv_msg_level = '1'

    iv_important_info = abap_true.

    ELSE.

    • Mass Change Possible: Go ahead

    IF gv_status_profile = lv_status_profile_new.

    • Popup can be reused ! GT_STATUS is filled already !

    ELSE.

    • GT_STATUS has to be updated

    REFRESH gt_status.

    gv_status_profile = lv_status_profile_new.

    SELECT * INTO ls_tj30 FROM tj30

    WHERE stsma = lv_status_profile_new ORDER BY stonr."#EC CI_BYPASS

    CLEAR ls_status_wrk.

    ls_status_wrk-status = ls_tj30-estat.

    ls_status_wrk-user_stat_proc = lv_status_profile_new.

    CALL FUNCTION 'CRM_STATUS_GET_TEXTS_OW'

    CHANGING

    cs_status_wrk = ls_status_wrk

    EXCEPTIONS

    text_not_found = 1

    OTHERS = 2.

    ls_status-status = ls_tj30-estat.

    ls_status-txt30 = ls_status_wrk-txt30.

    APPEND ls_status TO gt_status.

    ENDSELECT.

    REFRESH lt_col_def.

    ls_col_def-columnname = 'TXT30'. "#EC NOTEXT

    ls_col_def-title = 'STATUS'. "#EC NOTEXT

    APPEND ls_col_def TO lt_col_def.

    CLEAR ls_col_def.

    lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_ACTIVITY/MASSCHANGE_ACT_TITLE' ).

    lv_window = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/CHANGE_STATUS' ).

    gt_status_popup = comp_controller->window_manager->create_decision_popup(

    iv_title = lv_title

    iv_description = lv_window

    iv_visible_row_count = 7

    iv_display_table = gt_status

    iv_visible_columns = lt_col_def

    ).

    gt_status_popup->set_on_close_event( iv_event_name = 'STATUS_CLOSE' iv_view = me )."#EC NOTEXT

    ENDIF.

    gt_status_popup->open( ).

    ENDIF.

    EH_ONSTATUS_CLOSE

    DATA: lv_outputnode TYPE REF TO cl_bspwdcmp_bspwdcomponen_cn01,

    lv_rowindex TYPE string,

    lv_event_name TYPE string,

    lv_op TYPE seocmpname,

    ls_status TYPE crms_status_activity_ui,

    lv_value TYPE string,

    lr_cuco_bt126 TYPE REF TO cl_bt126s_a_apptsearchcuc_impl.

    • Get popup results

    lv_outputnode ?= gt_status_popup->get_context_node( 'OUTPUTNODE' ).

    lv_rowindex = lv_outputnode->get_selectedrowindex( ).

    lv_event_name = lv_outputnode->get_event_name( ).

    IF lv_event_name = 'OK'.

    lv_outputnode->init_attributes( ).

    READ TABLE gt_status INDEX lv_rowindex INTO ls_status.

    lv_value = ls_status-status.

    lr_cuco_bt126 ?= me->get_custom_controller(

    controller_id = cl_bt126s_a_apptsearchcuc_impl=>global_cuco_name ).

    CALL METHOD me->process_update

    EXPORTING

    iv_status = 'X'

    iv_value = lv_value

    ir_cuco_bt126 = lr_cuco_bt126.

    METHOD process_update.

    DATA: lo_sel_act TYPE REF TO cl_bsp_wd_collection_wrapper,

    lo_marked TYPE REF TO if_bol_bo_col,

    lo_iterator TYPE REF TO if_bol_bo_col_iterator,

    lv_size TYPE i,

    lv_index TYPE i,

    lo_object TYPE REF TO if_bol_bo_property_access,

    lo_activity_list TYPE REF TO cl_crm_bol_entity,

    lo_activity TYPE REF TO cl_crm_bol_entity,

    lo_header TYPE REF TO cl_crm_bol_entity,

    lo_act_ext TYPE REF TO cl_crm_bol_entity,

    lv_core TYPE REF TO cl_crm_bol_core,

    lv_transaction TYPE REF TO if_bol_transaction_context,

    lv_success TYPE crmt_boolean,

    lo_related TYPE REF TO cl_bsp_wd_collection_wrapper,

    lv_guid TYPE crmt_genil_object_guid,

    lo_tx_ctxt TYPE REF TO cl_crm_bol_custom_tx_ctxt,

    lo_transaction TYPE REF TO if_bol_transaction_context,

    lo_status_set TYPE REF TO cl_crm_bol_entity,

    lo_status TYPE REF TO cl_crm_bol_entity,

    lv_attr_name TYPE name_komp,

    lt_guid_name_val TYPE crmt_guid_name_val_comb_t,

    ls_guid_name_val TYPE crmt_guid_name_val_comb,

    lv_value TYPE string,

    ls_status TYPE crms_status_activity_ui.

    IF iv_value IS INITIAL.

    RETURN.

    ENDIF.

    CREATE OBJECT lo_tx_ctxt.

    lo_sel_act = me->typed_context->btqract->get_collection_wrapper( ).

    lo_marked = lo_sel_act->get_marked( ).

    lo_iterator = lo_marked->get_iterator( ).

    lv_size = lo_iterator->size( ).

    lv_core = cl_crm_bol_core=>get_instance( ).

    IF lv_size = 0.

    RETURN.

    ENDIF.

    lv_index = 1.

    DO lv_size TIMES.

    lo_object = lo_iterator->get_by_index( lv_index ).

    lo_activity_list ?= lo_object.

    CALL METHOD lo_activity_list->get_property_as_value

    EXPORTING

    iv_attr_name = 'GUID'

    IMPORTING

    ev_result = lv_guid.

    lo_activity = lv_core->get_root_entity( iv_object_name = 'BTOrder' iv_object_guid = lv_guid )."#EC NOTEXT

    lo_activity->switch_to_change_mode( ).

    TRY.

    lo_header = lo_activity->get_related_entity( 'BTOrderHeader' )."#EC NOTEXT

    CATCH cx_crm_genil_model_error.

    ENDTRY.

    TRY.

    lo_act_ext = lo_header->get_related_entity( 'BTHeaderActivityExt' )."#EC NOTEXT

    CATCH cx_crm_genil_model_error.

    ENDTRY.

    • set value..

    IF NOT iv_category IS INITIAL.

    lv_attr_name = 'CATEGORY'. "#EC NOTEXT

    lo_act_ext->switch_to_change_mode( ).

    CALL METHOD lo_act_ext->if_bol_bo_property_access~set_property

    EXPORTING

    iv_attr_name = lv_attr_name

    iv_value = iv_value.

    lv_value = iv_value.

    ELSEIF NOT iv_priority IS INITIAL.

    lv_attr_name = 'PRIORITY'. "#EC NOTEXT

    lo_act_ext->switch_to_change_mode( ).

    CALL METHOD lo_act_ext->if_bol_bo_property_access~set_property

    EXPORTING

    iv_attr_name = lv_attr_name

    iv_value = iv_value.

    lv_value = iv_value.

    ELSEIF NOT iv_status IS INITIAL.

    lv_attr_name = 'STATUS'. "#EC NOTEXT

    TRY.

    lo_status_set = lo_header->get_related_entity( 'BTHeaderStatusSet' ).

    CATCH cx_crm_genil_model_error.

    ENDTRY.

    IF lo_status_set IS BOUND.

    TRY.

    lo_status = lo_status_set->get_related_entity( 'BTStatusHCurrent' ).

    CATCH cx_crm_genil_model_error.

    ENDTRY.

    ENDIF.

    IF lo_status IS BOUND.

    lo_status->switch_to_change_mode( ).

    CALL METHOD lo_status->if_bol_bo_property_access~set_property

    EXPORTING

    iv_attr_name = 'ACT_STATUS' "#EC NOTEXT

    iv_value = iv_value.

    READ TABLE gt_status INTO ls_status

    WITH KEY status = iv_value.

    lv_value = ls_status-txt30.

    ENDIF.

    ENDIF.

    lv_core->modify( ).

    lo_transaction = lo_activity->get_transaction( ).

    IF lo_transaction IS BOUND.

    lo_tx_ctxt->add_tx_context( lo_transaction ).

    ENDIF.

    lv_index = lv_index + 1.

    ls_guid_name_val-guid = lv_guid.

    ls_guid_name_val-name = lv_attr_name.

    ls_guid_name_val-value = lv_value.

    INSERT ls_guid_name_val INTO TABLE lt_guid_name_val.

    ENDDO.

    TRY.

    lv_success = lo_tx_ctxt->if_bol_transaction_context~save( ).

    IF NOT lv_success IS INITIAL.

    lo_tx_ctxt->if_bol_transaction_context~commit( ).

    LOOP AT lt_guid_name_val INTO ls_guid_name_val.

    READ TABLE ir_cuco_bt126->gt_guid_name_val

    TRANSPORTING NO FIELDS

    WITH KEY guid = ls_guid_name_val-guid

    name = ls_guid_name_val-name.

    IF sy-subrc = 0.

    MODIFY ir_cuco_bt126->gt_guid_name_val

    INDEX sy-tabix FROM ls_guid_name_val

    TRANSPORTING value.

    ELSE.

    INSERT ls_guid_name_val INTO TABLE ir_cuco_bt126->gt_guid_name_val.

    ENDIF.

    ENDLOOP.

    ENDIF.

    CATCH cx_root.

    IF lv_success IS INITIAL.

    • debugging code.

    ENDIF.

    ENDTRY.

    ENDMETHOD.

    Apart from this u will find some more code in the view 'ApptSR',contetx node--BTQRACT, method GET_STATUS

    method GET_STATUS.

    DATA: current TYPE REF TO if_bol_bo_property_access.

    DATA: dref TYPE REF TO data.

    value =

    'BTQRAct not bound'."#EC NOTEXT

    if iterator is bound.

    current = iterator->get_current( ).

    else.

    current = collection_wrapper->get_current( ).

    endif.

    TRY.

    TRY.

    dref = current->get_property( 'STATUS' ). "#EC NOTEXT

    CATCH cx_crm_cic_parameter_error.

    ENDTRY.

    CATCH cx_sy_ref_is_initial cx_sy_move_cast_error

    cx_crm_genil_model_error.

    RETURN.

    ENDTRY.

    IF dref IS NOT BOUND.

    value = 'BTQRAct/STATUS not bound'."#EC NOTEXT

    RETURN.

    ENDIF.

    TRY.

    value = if_bsp_model_util~convert_to_string( data_ref = dref

    attribute_path = attribute_path ).

    CATCH cx_bsp_conv_illegal_ref.

    FIELD-SYMBOLS: <l_data> type DATA.

    assign dref->* to <l_data>.

    • please implement here some BO specific handler coding

    • conversion of currency/quantity field failed caused by missing

    • unit relation

    • Coding sample:

    • provide currency, decimals, and reference type

    • value = cl_bsp_utility=>make_string(

    • value = <l_data>

    • reference_value = c_currency

    • num_decimals = decimals

    • reference_type = reference_type

    • ).

    CONCATENATE <l_data> '-CURR/QUANT CONV FAILED-' INTO value

    SEPARATED BY space. "#EC NOTEXT

    CATCH cx_root.

    value = '-CONVERSION FAILED-'. "#EC NOTEXT

    ENDTRY.

      • Modify in case of mass changes happened*

      IF gr_appt_cuco->gt_guid_name_val IS NOT INITIAL.

      DATA: lv_desc TYPE crmt_description,

      lv_guid_name_val TYPE crmt_guid_name_val_comb,

      lv_guid TYPE crmt_object_guid.

      current->get_property_as_value( EXPORTING iv_attr_name = 'GUID'"#EC NOTEXT

      IMPORTING ev_result = lv_guid ).

      READ TABLE gr_appt_cuco->gt_guid_name_val

      WITH KEY guid = lv_guid

      name = 'STATUS' "#EC NOTEXT

      INTO lv_guid_name_val.

      IF lv_guid_name_val IS NOT INITIAL.

      value = lv_guid_name_val-value.

      CALL METHOD cl_crm_uiu_cust_get=>get_text_for_field_value

      EXPORTING

      iv_fieldname = 'STATUS' "#EC NOTEXT

      iv_value = value

      RECEIVING

      rv_text = lv_desc

      EXCEPTIONS

      error_occurred = 1

      OTHERS = 2.

      IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      value = lv_desc.

      ENDIF.

      ENDIF.

      endmethod.

      Hope this helps u.

      Actually when u select a status and click ok button the database value gets chnage which doesnt reflect on ui, so some additional code is written at the result area. U need not click the button twice.

            • Reward if useful

            Regards,

            Ruby.

            Add a comment
            10|10000 characters needed characters exceeded

          Before answering

          You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
          You must be Logged in to submit an answer.

          Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.