Said Ait Haddou Ali
Read all my blogsRequirement
The solution
Now, we have our context node binding. The node BIREPORT in component GSBIRP is bound to our new context node. We implement the ON_NEW_FOCUS method for the created context value node. In this method the updated URL will be constructed:
method ON_NEW_FOCUS.
DATA: lv_collection TYPE REF TO if_bol_bo_col,
entity TYPE REF TO cl_crm_bol_entity.
DATA: lr_wc_context TYPE REF TO cl_bsp_wd_context_node.
DATA: lr_text_node TYPE REF TO cl_gstext_text_cn00.
DATA: lr_url TYPE REF TO zcl_bi_if.
DATA: lv_bi_param TYPE string.
DATA: lv_parameter1 TYPE string,
lv_parameter2 TYPE string,
lv_parameter3 TYPE string.
CREATE OBJECT lr_url.
* get collection of dependent nodes
entity ?= focus_bo.
CHECK entity IS BOUND.
“Get parameter values (e.g. from BOL via entity ).
<arbitrary logic to retrieve parameter values>
lr_url->add_param( iv_param = ‘PARAMETER1’ iv_value = lv_parameter1 ).
lr_url->add_param( iv_param = ‘PARAMETER2’ iv_value = lv_org_unit ).
lr_url->add_param( iv_param = ‘PARAMETER3’ iv_value = lv_employee_id ).
lv_bi_param = lr_url->get_param( ).
DATA(lr_dynbirep_url) = me->collection_wrapper->get_current( ).
lr_dynbirep_url->set_property( exporting IV_ATTR_NAME = ‘REPID’
iv_value = ‘<REPORT_NAME>’ ).
lr_dynbirep_url->set_property( exporting IV_ATTR_NAME = ‘BISYSTEM’
iv_value = ‘<SYSTEM_ALIAS>’ ).
lr_dynbirep_url->set_property( exporting IV_ATTR_NAME = ‘ADDPARAMETER’
iv_value = lv_bi_param ).
endmethod.
IF btadminh IS BOUND AND me->dynbireport IS BOUND.
coll_wrapper = btadminh->get_collection_wrapper( ).
SET HANDLER me->dynbireport->on_new_focus FOR coll_wrapper ACTIVATION iv_activate.
ENDIF.
method CREATE_SPMBIREPORT.
DATA: model TYPE REF TO if_bsp_model,
coll_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper,
entity TYPE REF TO cl_crm_bol_entity,
entity_col TYPE REF TO if_bol_entity_col.
model = owner->create_model(
class_name = ‘ZL_BT125H_T_BSPWDCOMPONEN_CN05’
model_id = ‘DYNBIREPORT’ ).
DYNBIREPORT ?= model. CLEAR model.
coll_wrapper = BTADMINH->get_collection_wrapper( ).
TRY.
entity ?= coll_wrapper->get_current( ).
CATCH cx_sy_move_cast_error.
ENDTRY.
IF entity IS BOUND.
DYNBIREPORT->on_new_focus( focus_bo = entity ).
ENDIF.
endmethod.
So in short…
- Creating a new context node in our component to hold the URL parameters.
- Binding our new context node with the BIREPORT node from component GSBIRP.
- Implement the ON_NEW_FOCUS method to retrieve the new parameter values whenever the focus shifts.
- Modify the CONNECT_NODES method to ensure the ON_NEW_FOCUS_METHOD is called when the corresponding event has been triggered.
- Modify the CREATE_DYNBIREPORT node to initialize the new focus properly.