Quantcast
Channel: SCN: Message List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 7775

Re: accessing component controller data

$
0
0

Hello Lakshmi,


I will use BTHeader and BTItem objects as example.

The easiest approach would be to create BTHeader and BTItem context nodes in all views and in the component controller. Mark BTHeader as "Always create instance" - will be needed for data entry in the first screen.

After that, bind view context nodes to the controller context nodes (BTHeader to BTHeader and BTItem to BTItem).

In component controller create BTItem as related to the BTHeader (with proper relation from BOL).


Now, when you enter the value in the first view read the BTHeader entity using the BOL framework and set the BTHeader context node collection to the read entity.


(The coding was not checked, might not work just by using COPY + PASTE).


DATA:

  lv_order TYPE crmt_object_id,

  lv_order_guid TYPE crmt_object_guid,

  lo_core TYPE REF TO cl_crm_bol_core,

  lo_btheader TYPE REF TO cl_crm_bol_entity.


lo_btheader = typed_context->btheader->collection_wrapper->get_current( ).

lo_btheader->get_property_as_value(

  EXPORTING iv_attr_name = 'OBJECT_ID'

  IMPORTING ev_result = lv_order

).


SELECT SINGLE guid

  INTO lv_order_guid

  FROM crmd_orderadm_h

  WHERE object_id = lv_order.

CHECK sy-subrc = 0.


lo_core = cl_crm_bol_core->get_instance( ).

lo_btheader = lo_core->get_root_entity(

  iv_object_name = 'BTHeader' " here the real root entity is BTOrder, this is to simplify the example

  iv_object_guid = lv_order_guid

).


typed_context->btheader->collection_wrapper->clear( ).

typed_context->btheader->collection_wrapper->add( iv_entity = lo_btheader iv_set_focus = abap_true).


Now, the parameter IV_SET_FOCUS = abap_true will trigger the ON_NEW_FOCUS method in your component controller's BTItem context node. There you can put the desired logic to read data based on the value entered in the first view.

After that, simply update the BTItem collection with all the BOL objects that you read and they will be visible in all the views. Together with the BTHeader that you already read.

 

Hope this helps.

regards



Viewing all articles
Browse latest Browse all 7775

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>