Purpose:

We noticed that in CRM WebUI, if we input values for search fields, navigate away and then navigate back to this search screen again, the search values are always kept. For example, in business role SALESPRO, search accounts screen:

  1. input value ‘TESTNAME’ to search field ‘Name 1 /Last Name’:
    1 input value.png
  2. Navigate away to any other screen:
    2. navigate away.png
  3. Then navigate back via menu:
    3. navi. back.png
  4. The search value will keep:
    4. search value keeps.png

Why it behaves in this way?

  1. From the framework perspective, some instances for context nodes will be created when component is initially loaded and then kept in buffer in order to reuse in current session. For example, context nodes instances for component controller and customer controller, etc.
  2. However, instances for context nodes of views won’t be kept.
  3. Also, context nodes can be bound in some way, like using method DO_CONTEXT_NODE_BINDING. In this way, context nodes in views can be bound to the context nodes in component controllers.
  4. Since instances of context nodes in component controller always exist in current session, the search values can be retrieved even after the search screen is navigated away and then back again.

In this article, basic logics will be explained with a sample of search accounts.

Logics and Reason(after the search screen is navigated again):

  1. Context nodes for views will be newly created every time when navigating into a screen. In the above case, the view is BP_HEAD_SEARCH/MainSearch, the context nodes for the search fields are SEARCH. When navigating into this search screen, CL_BP_HEAD__MAINSEARCH_CTXT->CREATE_SEARCH is executed to create a new instance for the node SEARCH, the codes are owner->create_model. Detailed parameters are:
    5. create model.png
  2. Even though an instance for SEARCH is created, the values COLLECTION_WRAPPER->COLLECTION_REF->IF_BSP_WD_COLLECTION_REF~COLLECTION is {O:INITIAL} at the time:
    6. collection is initial.png
  3. Then next, it calls method DO_CONTEXT_NODE_BINDING. This method binds the context node SEARCH in view BP_HEAD_SEARCH/MainSearch with the context nodes SEARCH in component controller:
    7. context node binding.png
  4. After this binding, we can see the values COLLECTION_WRAPPER->COLLECTION_REF->IF_BSP_WD_COLLECTION_REF~COLLECTION is not initial any more(on and after the 2nd navigation to the screen only. For the 1st navigation to the search screen, COLLECTION will be created later on. Pease refer to Additional part):
    8. collection is not initial.png
  5. If we double click ‘IF_BSP_WD_COLLECTION_REF~COLLECTION’, check its value: ENTITY_LIST->{O:5892*\CLASS=CL_CRM_BOL_DQUERY_SERVICE}->SELECTION_PARAM_COL, we can see it is ‘[4X2(12)]Standard Table’:
    8-1. entity list.png
  6. Double click on ‘ENTITY_LIST’, double click its first entry, then check ‘PARAMETER_DATA’, double click on ‘{A:13600*\TYPE=GENILT_SELECTION_PARAMETER}’, we get search value information:
    8-2. search value.png

What is the context nodes SEARCH of component controller?

  1. Execute T-code BSP_WD_CMPWB, display component BP_HEAD_SEARCH.
  2. Double click on ‘Component Controller’ on the left side.
  3. On the right side, expand ‘Context Nodes’, there is ‘SEARCH’ context node.
    9. this is component controller context node.png
  4. For this context node SEARCH, its instance is created in method CL_BP_HEAD__BSPWDCOMPONEN_CTXT->CREATE_SEARCH. This method will be only executed once when the component BP_HEAD_SEARCH is loaded initially:
    9-1. component context node creation.png

The same thing is for customer controllers. Actually, we can also find another case in search leads which binds context in view with context in customer controller(BT108S_LEA/SEARCH):
9-3 customer controller.png

Here is the customer controller:
9-4 customer.png

Additional:
Collection wrapper will be added firstly during context initialization. In this case, please refer to method CL_BSP_WD_ADVSEARCH_CONTROLLER->DO_INIT_CONTEXT:
9-2 lr_qs added.png

Keywords:
CL_CRM_BOL_DQUERY_SERVICE, GET_INSTANCE, COLLECTION_WRAPPER->ADD, CL_BSP_WD_CONTROLLER=>CO_TYPE_CUSTOM, CL_BSP_WD_CONTROLLER=>CO_TYPE_COMPONENT

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply