Skip to Content

Binding between two components

Hello, SAP CRM Gurus

I'm a newbie in SAP CRM world and I have a question regarding to binding of different components controllers in SAP CRM.

I'm working with two components — PRD_PSIC_LOC_H and PRDIOOV.

I need to define value of my own variable on event in PRD_PSIC_LOC_H and after that to read this value in some event of PRDIOOV.

In order to do that I defined context nodes in both of these components controllers, let say GLCONFIG context node.

Now, to supply ability to transfer a data between two components I have to define a binding between these context node (

PRD_PSIC_LOC_H to PRDIOOV). And at this point I got a first issue — when I'm trying to define binding I got error warning: «You can't bind context node to itself» (this is close to text quote). After some research job I find a suggestion, telling me to define custom controller and try to bind custom controller to component controller. But it still doesn't work.

When I try to implement reverse binding, component controller to custom controller (PRDIOOV to PRD_PSIC_LOC_H), creation of binding process goes OK, but when I run CRM Web UI I got binding exception.

So, can you, please, provide a step-by-step guide how to implement a binding between two components, that i could access to context node's attribute from another component.

Also, I'm worrying about correct component usage definition.

Tell me please, if PRDIOOV wants to get value from PRD_PSIC_LOC_H, so where should I define component usage — in PRD_PSIC_LOC_H or in PRDIOOV or in both of them?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 04, 2012 at 09:55 AM

    Hi Mike,

    You can do the following steps:

    1. Figure out the view and the context node in the component PRD_PSIC_LOC_H, in which the field value is getting changed in an event.

    2. Go to the component PRDIOOV, do the following

    * In the component controller, add the context node as found in the previous step if it is not there

    * Check the view in which you want to display the value, if the same context node exists der. If it does, then fine else create the context node of the same structure.

    * Bind this context node with the component controller.

    * Now in the runtime repository, expose this context node of the component controller and the view.

    * RUntime repository->component interface->add the view

    * RUntime repository->component interface->interface controller->context_add the context node of the component controller.

    3. Go to the component PRD_PSIC_LOC_H, and do the following.

    * In the component controller, add the context node as found in step1 if it is not there and

    it with the context node in the view

    * in the runtime repository, add the component PRDIOOV view as component usage.

    * in the component controller, write the following code in the method WD_USAGE_INITIALZE' to bind the nodes of the component controller

    CHECK iv_usage IS BOUND.

    IF IV_USAGE->USAGE_NAME = "name of component usage

    iv_usage->bind_context_node( iv_controller_type = cl_bsp_wd_controller=>co_type_component

    iv_name = iv_usage->usage_name

    iv_target_node_name = " context node

    iv_node_2_bind = " context node ).

    ENDIF.

    Now you wil be able to access the value in the other component PRDIOOV.

    Let me know in case you face an issues.

    Prerna

    Add a comment
    10|10000 characters needed characters exceeded

    • hi mike,

      component interface means by which you exposed your component parts to the outside, so that any another components can use it. component parts means your context nodes , windows ...etc.

      1. go to the runtime repository. choose the edit button first.

      2. choose the component interface.

      3. choose interface view and right click on it and add the window of your component here.generally component interface is nothing but your component window (just like a view).

  • Posted on Aug 10, 2012 at 09:02 AM

    Hello, Prerna & Praveen.

    We've solved our problem with binding and now it works.

    The key challenge was to declare a correct usage in correct component.

    Here are a key steps to implement binding between two different components:

    1. Define context nodes in comp_controller with the same name (recommended)

    2. Expose these context nodes in Runtime Repository of both of components

    3. Call bind_context_node() binding method in WD_USAGE_INITIALZE of client component (component, which takes data from another component) and pass names of context nodes.

    That's all.

    Thanks for the operative help!

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 05, 2012 at 02:11 PM

    hi

    component usage is depend on requirements.

    say you have component C1 and you want to use some views say V1 AND V2 of another component C2. Then you will define component usage in C1.

    based on above , you need to define component usage in the component PRDIOOV as you want to read vlaue of component PRD_PSIC_LOC_H in the PRDIOOV.

    Just binding the context nodes does not provide resuls means when you click on something or in your event, you need to set the data in the context node. then only you can access the data through binding mechanism.

    as you have mentioned that even custom controller is not having the data, then check the context node of view is having the data or not.

    Let me know if you need further help.

    Add a comment
    10|10000 characters needed characters exceeded

    • Unfortunately, I don't have an access to the SAP CRM now, thus it will be hard for me to find what exactly to do. GET_I should define the status of the controller: enabled or disabled for the input. So, first we have to supply the binding and after that to care to enable the container for the edit.

      Hope, there is someone here who can give you more detailed explanation.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.