Firstly, create a form (ZCAP_ATTACHMENT) for attachments and maintain its window and parent context details to be exposed.
Secondly, maintain the attachment form under Contract Account Overview form (UCAP_OV) and set its positioning. We are positioning in 1st row 4th column.
Thirdly, we need to bind Attachments block contexts with Contract Account overview component which is IUICFMK. For that, new Custom Controller is created for required attachments context objects availability.
UTILSCONTRAACCTPARTNER is the Contract Account header object. It's binded with respective component controller context 'OBJECTS' which will hold parent (contract account) instance for attachments (as 'Transfer context to sub-form' is configured for attachment form)
METHOD on_new_focus.
* Declarations
DATA: lr_qs TYPE REF TO cl_crm_bol_query_service,
lr_data TYPE REF TO data,
ls_cmbo_prop TYPE crmt_cmic_rfolder_attr,
lr_entity_col TYPE REF TO if_bol_entity_col.
* Field Symbols
FIELD-SYMBOLS: <fs_guid> TYPE bu_partner_guid. "guid of your object
* get focus_bo
CHECK focus_bo IS BOUND.
TRY.
lr_qs = cl_crm_bol_query_service=>get_instance( 'CMBOLinkQuery' ).
CATCH cx_root. "#EC NO_HANDLER
* attachment model not yet loaded
ENDTRY.
CHECK lr_qs IS BOUND.
lr_data = focus_bo->get_property( 'GUID' ). "get guid according to the correct name
ASSIGN lr_data->* TO <fs_guid>.
ls_cmbo_prop-instid = <fs_guid>.
ls_cmbo_prop-typeid = 'BUS1006130'.
ls_cmbo_prop-catid = 'BO'.
* fill and fire query
lr_qs->set_properties( ls_cmbo_prop ).
lr_entity_col = lr_qs->get_query_result( ).
* set collection of context node CMBO, which is already bound
* to the model node CMBO of component controller
me->collection_wrapper->clear_collection( ).
me->collection_wrapper->set_collection( lr_entity_col ).
ENDMETHOD.
METHOD if_crm_iu_il_s4op_cmpcntr~wd_usage_initialize.
.
.
* Attachments Component Usage binding for Contract Account Component
IF ir_usage->usage_name CS |#GS_CM#SubFrm_00164|.
* Bind Attachments parent that will be Contract Account Object
CALL METHOD ir_usage->bind_context_node
EXPORTING
iv_controller_type = cl_bsp_wd_controller=>co_type_custom
iv_name = 'IUICFMK/Attachments' "#EC NOTEXT
iv_target_node_name = 'UTILSCONTRACCTPARTNER' "#EC NOTEXT
iv_node_2_bind = 'PARENTNODE'. "#EC NOTEXT
* Bind Attachments Business Object
CALL METHOD ir_usage->bind_context_node
EXPORTING
iv_controller_type = cl_bsp_wd_controller=>co_type_custom
iv_name = 'IUICFMK/Attachments' "#EC NOTEXT
iv_target_node_name = 'CMBO' "#EC NOTEXT
iv_node_2_bind = 'CMBUSOBJ'. "#EC NOTEXT
* Get binded CUCO instance
lr_cuco_attachement ?= ir_component_controler->get_custom_controller( 'IUICFMK/Attachments' ).
IF lr_cuco_attachement IS BOUND.
lr_cuco_attachement->typed_context->cmbo->on_new_focus( lr_cuco_attachement->typed_context->utilscontracctpartner->collection_wrapper->get_current( ) ).
ENDIF.
ENDIF.
ENDMETHOD.
Lastly, advanced button (in attachment block page) which navigate from DocList page to AdvancedOVP page dumps, as navigation links cannot be created in component IUICFMK as usage window is generated dynamically. Moreover GS_CM being a conventional component, does not support forms feature of action button generation. Hence dynamic navigation is used for same, binding context to component controller at landing inbound plug TO_ADVANCED. For required business role, generic outbound plug is defined for Target ID in View CRMV_UI_GEN_MAP.
METHOD eh_on_advanced_btn.
* Declarations
DATA: lr_entity TYPE REF TO cl_crm_bol_entity,
lr_col TYPE REF TO cl_crm_bol_bo_col,
lr_nav_serv TYPE REF TO if_crm_ui_navigation_service,
lr_nav_descr TYPE REF TO if_bol_bo_property_access,
lr_coco TYPE REF TO cl_gs_cm_bspwdcomponent.
* Get parent entity
lr_coco ?= me->comp_controller.
lr_entity ?= lr_coco->typed_context->parentnode->collection_wrapper->get_current( ).
* When Contract Account is parent navigate using dynamic navigation
IF lr_entity IS BOUND AND lr_entity->get_name( ) = 'UtilsContrAcctPartner'.
CREATE OBJECT lr_col.
lr_col->if_bol_bo_col~add( lr_entity ).
cl_crm_ui_descriptor_obj_srv=>create_ui_object_based(
EXPORTING iv_component = 'GS_CM'
iv_ui_object_type = 'PARENTNODE'
iv_ui_object_action = 'B'
RECEIVING rr_result = lr_nav_descr ).
lr_nav_serv = cl_crm_ui_navigation_service=>get_instance( ).
* check if navigation is possible and start navigation
IF lr_nav_serv->is_dynamic_nav_supported( ir_descriptor_object = lr_nav_descr ) = abap_true.
lr_col->if_bol_bo_col~insert( iv_bo = lr_nav_descr iv_index = 1 ).
lr_nav_serv->navigate_dynamically( iv_data_collection = lr_col ).
ENDIF.
* Else, Call Super
ELSE.
CALL METHOD super->eh_on_advanced_btn
EXPORTING
htmlb_event = htmlb_event
htmlb_event_ex = htmlb_event_ex.
ENDIF.
ENDMETHOD.
METHOD ip_to_advanced.
* Declarations
DATA: lr_entity TYPE REF TO cl_crm_bol_entity,
lr_coco TYPE REF TO cl_gs_cm_bspwdcomponent.
IF iv_collection IS BOUND.
lr_entity ?= iv_collection->get_current( ).
ENDIF.
* For Contract Account navigation to Attachment advanced page, bind contract account and Attachments to component controller nodes
IF lr_entity IS BOUND AND lr_entity->get_name( ) = 'UtilsContrAcctPartner'.
lr_coco ?= me->comp_controller.
lr_coco->typed_context->seldoc->collection_wrapper->clear( ).
lr_coco->typed_context->parentnode->collection_wrapper->clear( ).
lr_coco->typed_context->cmbusobj->collection_wrapper->clear( ).
lr_coco->typed_context->parentnode->set_collection( iv_collection ).
* Method get_cmbusobj fetched details similar to ON_NEW_FOCUS.
lr_coco->typed_context->cmbusobj->set_collection( get_cmbusobj( EXPORTING im_focus_bo = lr_entity ) ).
* Else, Call Super
ELSE.
CALL METHOD super->ip_to_advanced
EXPORTING
iv_collection = iv_collection.
ENDIF.
ENDMETHOD.
Hope you liked the article. Please let me know if any comments/queries. Your feedback would really help.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 | |
1 |