Skip to Content
0
Former Member
Dec 14, 2012 at 01:31 AM

BTDOCFLOW/HdrDocFlow - Transaction History on Opportunities screen

116 Views

Hi,

There is an assignment block on Opportunties screen which is called Transaction History. This shows the history from different transaciton types. Our requirement is to show only one specific transaction type which is LEAD. So we want to fileter the data based on LEADS and show only LEADS. As there is no assignment block of leads so thats why we want to use this as LEADS. Below are the technical details;

Component name/View Name: BTDOCFLOW/HdrDocFlow

I tried to do the following;

1- Created a ON_NEW_FOCUS in ZL_BTDOCFLO_HDRDOCFLOW_CN00 class which is a class for context node BTDOCFLOW.

2- Wrote the following code in this method. By default this method does not exist, I created it manually and made as event handler method on new focus. But the problem is this method never getting executed. Here is the code;

DATA: lv_collection TYPE REF TO if_bol_bo_col,

entity TYPE REF TO cl_crm_bol_entity.

DATA: lv_mode TYPE char1,

es_attributes TYPE crmst_docflow_btil,

lr_entity TYPE REF TO cl_crm_bol_entity,

lr_col_all TYPE REF TO if_bol_bo_col.



* IF cl_crm_md_bp_switch_check=>is_attribute_sets_active( ) = abap_true.

* gv_reread = abap_true. "indicator for rereading the data in DO_PREOPARE_OUTPUT

* ELSE.



* D044283: Data consistency + Performance optimization

* objects are read from BOL only on window navigation

* flag NO_BUFFER is set on DO_VIEW_INIT_ON_ACTIVATION in BP_HEAD/MainWindow

IF cl_bp_bpbt_accountopportu_impl=>no_buffer = abap_true.

lv_mode = cl_crm_bol_entity=>bypassing_buffer.

cl_bp_bpbt_accountopportu_impl=>no_buffer = abap_false.

ELSE.

lv_mode = cl_crm_bol_entity=>normal.

ENDIF.



* get collection of dependent nodes

TRY.

entity ?= focus_bo.

CATCH cx_sy_move_cast_error.

RETURN.

ENDTRY.

TRY.

lv_collection = entity->get_related_entities(

iv_relation_name = 'BTDocFlowRel'

* D022159: Performance optimization

iv_mode = lv_mode ).



CATCH cx_crm_genil_model_error.

* should never happen

EXIT.

CATCH cx_sy_ref_is_initial.

ENDTRY.

** New code to filter the leads only



lr_col_all = lv_collection->get_copy( ).

lr_entity ?= lr_col_all->get_first( ).



WHILE lr_entity IS BOUND.



lr_entity->get_properties( IMPORTING es_attributes = es_attributes ).

IF es_attributes-objtype_a <> 'ZLD'.

lv_collection->remove( iv_bo = lr_entity ).

ENDIF.

lr_entity ?= lr_col_all->get_next( ).



ENDWHILE.



* End of new code



me->collection_wrapper->set_collection( lv_collection ).

Could you please let me know what problem is?

Thanks,