cancel
Showing results for 
Search instead for 
Did you mean: 

Adding attachment block from the standard | collection is not filled

Former Member
0 Kudos

Hi all,

I'm working on a ZComponent where I have added the attachment assignmentblock as a usage from (GS_CM) in form of the two CUs CUGSCM and CUGSCM_DET (CUs have different names in my component)

I created a cuco with the Context nodes CMBO, ATTRIBUTES and ERPADMINH because I'm adding it to a ZComponent which is working with the LORD API. In the WD_USAGE_INITIALIZE I mapped like this:

Name in my zcomponentname in GS_CM
CMBOCMBUSOBJ
ERPADMINHPARENTNODE
ATTRIBUTESATTRIBUTES

When I add a new attachment, popup opens and I can choose as in the standard. By clicking "Attach" it ends up in an endless wheel of death (infinite loading). I debugged the process and found out the following:

METHOD EH_ONATTACH_BTN

      WHEN 'attach'.                                          "#EC NOTEXT
*     attach document
      lv_error = prepare_doc( ).
*     any errors?
      CHECK lv_error IS INITIAL.
*     save behavior is new in 7.01 ( Business Role Parameter controlls commit or direct update mode )
      lr_coco ?= me->comp_controller.
      lr_coco->save( ).

The save method is called.

In the save()-method there is line which tries to get the current entity from the collection:

  lr_cmbo ?= me->typed_context->cmbusobj->collection_wrapper->get_current( ).

The main problem: lr_cmbo stays INITIAL and doesn't get any value.

Where do I have to add coding or might have forgotten something?

Thanks in advance,

Daniel

Accepted Solutions (1)

Accepted Solutions (1)

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Daniel,

You need bind your custom component controller Context nodes from GS_CM using component controller class CL_GS_CM_BSPWDCOMPONENT_IMPL (Enhance it) method WD_USAGE_INITIALIZE for your component usage . Check this method you will get some idea.

    WHEN 'CMTemplCmp'.

      CALL METHOD iv_usage->bind_context_node

        EXPORTING

          iv_controller_type  = cl_bsp_wd_controller=>co_type_component

          iv_name             = iv_usage->usage_name  "Component Usage Name

          iv_target_node_name = 'CMBUSOBJ'            "Name of Node in this CompController

          iv_node_2_bind      = 'CMBO'.               "Name of Node in used component CRM_OI_TEMPL_RT

      CALL METHOD iv_usage->bind_context_node

        EXPORTING

          iv_controller_type  = cl_bsp_wd_controller=>co_type_component

          iv_name             = iv_usage->usage_name  "Component Usage Name

          iv_target_node_name = 'WSBO'                "Name of Node in this CompController

          iv_node_2_bind      = 'WSBO'.               "Name of Node in used component CRM_OI_TEMPL_RT

      CALL METHOD iv_usage->bind_context_node

        EXPORTING

          iv_controller_type  = cl_bsp_wd_controller=>co_type_component

          iv_name             = iv_usage->usage_name  "Component Usage Name

          iv_target_node_name = 'ATTRIBUTES'          "Name of Node in this CompController

          iv_node_2_bind      = 'ATTRIBUTES'.         "Name of Node in used component CRM_OI_TEMPL_RT

Regards,

Deepika C.

Former Member
0 Kudos

Hi Deepika,

I have added it like this in the WD_USAGE_INITIALIZATION:

CASE iv_usage->usage_name.

   WHEN 'CUATTACHCRM' OR 'CUATTACHCRM_DET'.

       CALL METHOD iv_usage->bind_context_node

         EXPORTING

           iv_controller_type  = cl_bsp_wd_controller=>co_type_custom

           iv_name             = 'ZCOMPONENT/ContentManagementCuCo' "#EC NOTEXT

           iv_target_node_name = 'CMBO'                      "#EC NOTEXT

           iv_node_2_bind      = 'CMBUSOBJ'.                 "#EC NOTEXT

       CALL METHOD iv_usage->bind_context_node

         EXPORTING

           iv_controller_type  = cl_bsp_wd_controller=>co_type_custom

           iv_name             = 'ZCOMPONENT/ContentManagementCuCo' "#EC NOTEXT

           iv_target_node_name = 'ERPADMINH'                 "#EC NOTEXT

           iv_node_2_bind      = 'PARENTNODE'.               "#EC NOTEXT

*

      lr_cuco ?= me->get_custom_controller( controller_id = 'ZCOMPONENT/ContentManagementCuco'  ).

      ls_attr-next_run_reread = abap_true.

       GET REFERENCE OF ls_attr INTO lr_attr.

       CREATE OBJECT lr_value_node

         EXPORTING

       iv_data_ref = lr_attr.

       lr_value_node->if_bol_bo_property_access~set_properties( ls_attr ).

       lr_cuco->typed_context->attributes->collection_wrapper->clear( ).

       lr_cuco->typed_context->attributes->collection_wrapper->add( lr_value_node ).

       CALL METHOD iv_usage->bind_context_node

         EXPORTING

           iv_controller_type  = cl_bsp_wd_controller=>co_type_custom

           iv_name             = 'ZCOMPONENT/ContentManagementCuCo' "#EC NOTEXT

           iv_target_node_name = 'ATTRIBUTES'

           iv_node_2_bind      = 'ATTRIBUTES'.

   ENDCASE.



Doesn't work at the moment 😕

former_member188098
Active Contributor
0 Kudos

Hi Daniel,

Try to check whether your source context node in component controller or in custom controller(u r using to bind in bind_context_node method) holds the data that you want to bind with the target context node.And also make sure your target node must be under context in interface controller of component interface.

Regards,

ratna_rajeshp
Active Participant
0 Kudos

Hi Daniel,

When calling an Attachement's ( Content Management ) views ,we need to have a 'CMBO" context node filled which is pointing to the CMBO model Entity.

Please refer the the code below

    lr_qs = cl_crm_bol_query_service=>get_instance( cl_crm_cm_genil_comp=>gc_query_bo_link ).

   focus_bo->get_properties( importing es_attributes = ls_admin_h ).
  ls_cmbo_prop-instid = ls_admin_h-guid.
  ls_cmbo_prop-typeid = ls_admin_h-object_type.
  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 context node
  collection_wrapper->clear_collection( ).
  collection_wrapper->set_collection( lr_entity_col ).

You can find this code in the component BT126H_APPT , in the custom controller BT126H_APPT/ContentManagementCuCo in the method ON NEW FOCUS.

Thanks.

Rajesh.


Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Daniel,
i tray use component GS_CM in another compoenent but i dont know hot to do this, can you help me and describe what i have to do to add GS_CM.