Skip to Content
Author's profile photo Suchita Phulkar

CRM WEB UI Technical- How to read one context node data in other context node ?

One common requirement in WEB UI is to exchange the data between different context nodes of a view, especially in the situations where you need to compute for an attribute value which involves calculations based on other context node attributes.

Refer the URL given to my Wiki page that explains a new, simple yet powerful technique to share the attributes across the context nodes of a view.

Using this technique, You are no longer required to create static/public Z attributes in a Context node class (CN00,CN01 etc. class), implement coding in Controller class (IMPL class) to make these Z attributes work as a flag or temporary data holder for other context node’s attribute and lastly do coding getter-setter using this Z flag value.

Now, you can directly code in a context node class (attribute’s getter-setter method or any other custom method) where you can access all the other context nodes and their all attributes, you can call their getter-setters to directly set/reset their values etc.

Your comments/Suggestions/Questions are most welcome.

Thanks & Regards,


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Suchita,

      I have gone through the blog. The information you have provided is very helpful.

      Charles Antony

      Author's profile photo Sumit Mittal
      Sumit Mittal
      Nice Blog Suchita,

      In case someone needs customer controller instance in the view context nodes, sharing this details might be helpful..

      To get the custom controller instance in Context node getter/setter method:

      1. Declare Cuco instance reference variable in ctxt class..

      2. Set this cuco ref. in the Create context node method of ctxt class:

      gr_cucoadminh ?= owner->get_custom_controller( 'ICCMP_BTSHEAD/cucoadminh' ). "#EC NOTEXT
            catch cx_root.

      3. Assign this instance to the respective context node Create method using:

        BTStatusH->gr_cuco ?= gr_cucoadminh.

      Here gr_cuco is the ref. variable of  custom controller in the respective context node for eg. BtstatusH

      Sample implementation of this can be found in
      ICCMP_BTSHEAD/BTSHeader ->context node BTACTIVITYH-> attr ->GR_CUCO(instance of cuco)

      Author's profile photo Arun Prakash Karuppanan
      Arun Prakash Karuppanan

      This approach is ok only if you are trying to read values in the "Read" cycle. Remember that during the server round trip, we first have a "set" cycle in which all the setter methods for "open" fields are called and then the BOL synch is called and lastly, the getter methods are called to reflect the latest values in UI.

      Author's profile photo Former Member
      Former Member
      Hi Arun,
      The scenario you mentioned is valid and it exists even with the traditional approach. This scenario will be there in any scenario where you make both the value-supplying and dependant attributes editable in the same screen.

      The approach explained is another way of accessing one context node from another.

      Thanks and regards,

      Author's profile photo Arun Prakash Karuppanan
      Arun Prakash Karuppanan
      No, I think not. The problem here is you are calling a setter method manually once with your own value and the framework calls it "again" with the value from the UI. There is also the possibility that the sequence in which the set methods are called might not be suitable for your purposes. Remember that the round trip sequence is

      UI setters
      IMPL handle input
      BOL/API synch
      IMPL prepare outputs
      UI getters.

      By traditional approach, I guess that you mean setting values in "DO_PREPARE_OUTPUT". The scenario I described will never occur in this approach as the framework has already finished calling all the setter methods. The value you set will be final for this round-trip and any reads done here will be the latest.

      Any way, I'm not a fan of trying to use the get/set methods to do anything. They are largely meant to be used with the form fields. The proper way would be to induce a server event(if possible) and put in everything there or look for one of the "safe" spots.

      Arun Prakash

      Author's profile photo Harshit Kumar
      Harshit Kumar

      I agree with what Arun has mentioned. There are standard ways of doing things which CRM Framework supports, and is in line with the Architecture as defined by SAP CRM.

      You have every right to flirt with the framework, but in the process you may be loosing out on something which probably you may not even have thought of.

      The issue which may arise here is fromt he framework calls for Get/set which are essesntially decided at run time and in the event of deviating from it you may end up with dirty read!!


      Author's profile photo Suchita Phulkar
      Suchita Phulkar
      Blog Post Author
      I Completely disagree with Harshit saying one has every right to flirt with the framework !!

      A responsible programmer would never do that or even say that.

      We have to follow the OO concept and standard SAP WEB UI framework. The framework call to get-set is not in fluke and not in any random sequense as depicted from some comments here !!

      There is a Perfect Logic by which system decides which setters and getters are to be called and in what sequence. Those who cant understand this sequence logic are free to avoid coding in Context node class and can chose the easy way of Do_prepare_Output , in controller class.

      This blog and wiki promise to give access to all context nodes via CTXT instance in individual Context node class. Now how to use this CTXT instance is a programmer's conscious .

      I have illustrated just one example to give the idea.


      Author's profile photo Suchita Phulkar
      Suchita Phulkar
      Blog Post Author
      Hello All,

      First of all a clear indication to HARSHIT that this is not at all flirting with the framework !!  or a method out of blue moon. This method is been followed by SAP too.

      So please respect the technique and if you cant, dont follow !! This is a standard technique to access other context attibutes and i specifically meant Read the other context node attribute and this perfectly works.

      Now its a technical consultant's understanding to implement this method considering the server trips as mentioned by Arun. This is a common sense that Getter and setters are called in the sequence in which fields appear on the view and not in the sequence in which they appear in a context node. So it is never the case that all attribute's setter and getter are called first for one context node.

      To Arun,

      Thanks a lot for the valuable inputs. I truely appreciate and agree with you however I never mentioned that one is supposed to write the code in Getter and call the setter of the other attribute. This was just an example and it was clearly mentined in the blog and wiki too.

      This was just to show how we can access the attributes of other context nodes and i never meant that you have to do it in context node getter and setter. Please note i have mentioned this can be done in a Custom Method too.

      To Pratap,

      Thanks a lot, I think you got my point perfectly.
      Thanks for referring my blog and comenting

      To Charles,
      Thank you very much.

      Author's profile photo Former Member
      Former Member
      Hi suchita,

      Can you please give an example of a standard SAP component where this is done,since you said that this method is adopted by SAP as well.
      Would be a good help to understand the scenario better.

      Author's profile photo Suchita Phulkar
      Suchita Phulkar
      Blog Post Author
      Hi Suvidha,

      You can check the compenent GS_CM and perticularly doclist view.

      The concept of gr_owner to get CTXT instance in CNxx Class is a not at all any out of the way concept.This is perfectly logical and in OO framework, however how to and where to use this is compeltly a programmer's conscious.

      Author's profile photo Former Member
      Former Member

      I completely agree with Arun's Approach and what Harshit has suggetsed to work with framework but with required precautions.

      Author's profile photo Former Member
      Former Member
      Hello Bloggers,
      Please STOP critising and understand the fact that whatever has been specified is just an illustration and not a recommendation. If you understand the alternative approach of accessing one context node from another, then the purpose of the blog is fulfilled.


      Author's profile photo Former Member
      Former Member
      Hi Suchita,

      I'm a newbie on ABAP CRM WEB, and I wonder if you have some idea about how can I access information from one component to another. Let's say I need to access the BTADMIN node of SQRM_INCIDENT_H component from BTCATEGORYFIRST node of BTCATEGORIES component...


      Author's profile photo Suchita Phulkar
      Suchita Phulkar
      Blog Post Author
      Hi there,

      I think you want to read BTAdminH details..basically the service request header details of current service request from its Service Categorization Schema.

      Well, Since BTAdminH and BTCategoryFirst both are part of ONEORDER model, you can retrieve BTAdminH from BTCategoryFirst entity thorugh relations.

      Using get_root() on BTCategoryFirst entity will give you BTOrder entity.
      Something like this :
      lr_btcategory_entity ?=

      lr_btorder_entity ?=

      Now you can retrieve BTAdminH from BTOrder using relation
      lr_BTAdminH_enity ?= lr_btorder_entity->get_related_entity( iv_relation = 'BTOrderHeader' ) .

      I have not worked on categorization schema much but i think this should work.

      You can download the HOW TO on BOL programming from Wiki to understand the framework and how to work with BOL entities.

      Hope this help else raise a thread on sdn .