Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Where to create root BOL in custom component - best practice

Hi Experts,

I have created a BOL class to insert values into a ZTable.

I have created a custom component/views for the BOL. Now how will the create method in the BOL will be called. In which method of the component controller or view controller do I create the BOL root..

I want to use the following code.


CALL METHOD SUPER->WD_CREATE_CONTEXT
    .


DATA:
  lref_substitute           TYPE REF TO if_bol_bo_property_access,
  lv_index                  TYPE i,
  lref_bol_entity           TYPE REF TO cl_crm_bol_entity,
  lrf_cuco                  TYPE REF TO cl_gs_mcat_mcat_impl,
  lref_bol_core             TYPE REF TO cl_crm_bol_core,
  lv_object_name            TYPE crmt_ext_obj_name VALUE cl_crm_catego_genil=>gc_ob_schema,
  lv_create_param	          TYPE crmt_name_value_pair_tab,
  lv_number	                TYPE int4 VALUE 1,
  lref_new_substitute       TYPE REF TO if_bol_entity_col,
  lr_tx                     TYPE REF TO if_bol_transaction_context
  .

lref_bol_core = cl_crm_bol_core=>Get_instance( abap_true ).
lv_object_name = 'ZHRUS_D2'.

TRY.
    CALL METHOD lref_bol_core->root_create
      EXPORTING
        iv_object_name  = lv_object_name
        iv_create_param = lv_create_param
        iv_number       = lv_number
      RECEIVING
        rv_result       = lref_new_substitute.
  CATCH cx_crm_unsupported_object .
ENDTRY.

CHECK lref_new_substitute IS BOUND.

lref_substitute ?= lref_new_substitute->get_first( ).
CHECK lref_substitute IS BOUND.

me->typed_context->zhrus->collection_wrapper->clear( ).
me->typed_context->zhrus->collection_wrapper->add( iv_entity = lref_substitute ).

I give the code in various methods and it all works fine. But what is the best way to create the root node.

Regards,

Abdullah Ismail

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question