Accessing component controller node

Hi..Experts,
How to access component controller node from  WINDOW (please give me a sample code ) .
I want to set data to component controller node.
please help me.
Regards,
Siva

Hi siva,
   Its very easy u need not to do any extra coding to share data between window context and component controller context.
Step 1) u create the node in component controller and map this node with window context.
step 2) Now in any method of window u write the set_attribute or bind_table statement ,your data will automatically transported to component controller .
So u dont need to do any extra coding for this.
Hope this will help your requirement.
regards
Pankaj Giri

Similar Messages

  • Accessing component controller data

    Hi I have created a guided procedure with 3 views in it. I will enter the object id in the first view . I want to read this object id in the component controller
    and get some data this data will be accessed by remaining views to populate the fields in the views when they are displayed .please let me know
    how to update the fields in the view to the component controller and vice versa.
    regards
    luxmi

    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

  • Unable to access Component Controller attributes from Views.

    Hi,
      I am unable to access the attributes in component controller from methods in View even by using WD_COMP_CONTROLLER.
    Say, I want to access the attribute G_FLAG in component controller from a method in the View Controller by the following code :
      WD_COMP_CONTROLLER->G_FLAG = 2.
    Then an error message is showing up saying -  Field G_FLAG is unknown. It is neither in one of the specified tables nor defined by a DATA statement.
    What should I do? Plz suggest..

    Hi,
    Please check the Public check box of the attribute in the component controller.
    Hopefully it will solve your problem.
    Thanks

  • Issue in Binding Custom controller to Component Controller

    Dear All,
    I have enhanced a standard component ERP_H.
    I created a custom controller with context nodes BTSTATUS, BTSTATUSH
    I enhanced the component controller with context node BTSTATUS, BTSTATUSH
    Now when i try to bind the custom controller to component controller using this code in the context class of my custom controller
    bind to component controller
      owner->do_context_node_binding(
               iv_controller_type = CL_BSP_WD_CONTROLLER=>CO_TYPE_COMPONENT
               iv_target_node_name = 'BTSTATUS'  " component controller context node
               iv_node_2_bind = BTStatus ).
    its not working since this context node in component controller is not the standard one but the custom added one.
    Am i missing something, or is there any way to bind customer context node in custom controller to customer context node in component controller.
    regards,
    pradeep

    Hi pradeep,
        Try the other way round go to the context class in the component controller and paste the following code in the
    create_contextnode( context node = name of the node to be linked).
    *owner->do_context_node_binding(
            iv_controller_type = cl_bsp_wd_controller=>co_type_custom   <-----linking from component to custom
            iv_target_node_name = 'BUILHEADER' "target node: component controller node
            iv_node_2_bind = BUILHEADER ). "source node: current node.
    See if this works.
    Thanks

  • Access to an attribute of a value node of a component controller

    Hello experts,
    I'm new to the area of SAP CRM Web Client UI development. My problem is probably very simple and you will surely smile about it.
    I have created my own component with the value node FILE (that consists of five atributes) in the component controller. Unfortunately I have not figured out yet how I can access the value of an attribute.
    The first thing I do not know is where I can find the controller-ID.
    In addition, I get an syntax error Field "TYPED_CONTEXT->FILE->COLLECTION_WRAPPER->GET_FIRST(" unknown in the line with "lo_entity = me->comp_controller->typed_context->file->collection_wrapper->get_first( ).".
    Currently no functionality is included in my code, because firstly I want to understand the basics.
    method OP_FILEUPLOAD.
      data lo_entity       type ref to if_bol_bo_property_access.
      data lv_file_name    type string.
      data lr_file_content type ref to data.
      field-symbols <lv_file_name> type string.
      IF ( comp_controller is INITIAL ).
        get_controller( 'xxxx' ).
      ENDIF.
      lo_entity = me->comp_controller->typed_context->file->collection_wrapper->get_first( ).
      while lo_entity is bound.
        lv_file_name = lo_entity->get_property_as_string( 'FILE_NAME' ).
        lr_file_content = lo_entity->get_property( 'FILE_CONTENT_STRING' ).
        assign lr_file_content->* to <lv_file_content>.
        lo_entity = me->typed_context->file->collection_wrapper->get_next( ).
      endwhile.
    endmethod.
    I hope that I will manage my "problem" with your help!
    Sebastian
    Edited by: Sebastian Lenz on Jun 27, 2011 2:35 PM

    Hi Sebastian,
    The issue is in the following line of your code:
    lo_entity = me->comp_controller->typed_context->file->collection_wrapper->get_first( ).
    The 'typed_context' belongs to your own component controller class and not the standard framework superclass. So, you need to replace this single line of code with something as follows (assuming that your component controller class is ZCL_CUSTOM_BSPWDCOMPONENT_IMPL):
    DATA lr_coco TYPE REF TO ZCL_CUSTOM_BSPWDCOMPONENT_IMPL.
    lr_coco ?= me->comp_controller.
    lo_entity = lr_coco->typed_context->file->collection_wrapper->get_first( ).
    The me->comp_controller reference will refer to the standard framework superclass of all component controllers and this does not have any typed_context attribute with it. The real component controller that gets created when you create a BSP component will have this attribute. That is why you need to first cast it to your own reference type before trying to access its typed_context.
    And if your value node will have only single values, then you can as well do the following to access the attribute ATTRIB1 of context node node1:
    DATA lv_value TYPE string.
    lv_value = lr_coco->typed_context->node1->get_attrib1( attribute path = '' ).
    Basically all attributes can be accessed by above code by using the right getter method.
    Regards,
    Shiromani

  • How to populate context node of component controller

    Dear People,
    Is there any way i could access my custom context node of component controller in the context node class of my custom controller.
    I am navigating from one component to another, Upon initial launch everything is working fine, however if i go to home page and come back. the assignment block is coming empty.
    In WD_USAGE_INITIALIZE i m binding my custom controllers context node with the component controller's context node of the other component and it works fine when i load the UI. however if i go to home page and come back. the assignment block is coming empty.
    Following code is in method of DO_VIEW_INIT_ON_ACTIVATION of the other componenet.
    METHOD do_view_init_on_activation.
      DATA:   lv_btstatus_parent TYPE REF TO cl_crm_bol_entity,
            lv_comp_ctrl      TYPE REF TO cl_btstatus_bspwdcomponen_impl.
      CONSTANTS:
            lc_us_header      TYPE crmt_relation_name VALUE 'BTStatusHUserAll',
            lc_us_item        TYPE crmt_relation_name VALUE 'BTStatusIUserAll'.
      lv_comp_ctrl ?= me->comp_controller.
    check if relationname has been passed from outside
        gc_relation_name = lv_comp_ctrl->get_relation_name( ).
      IF gc_relation_name IS INITIAL.
      check type of parent to determine relationname
        *lv_btstatus_parent ?= lv_comp_ctrl->typed_context->btstatusparent->collection_wrapper->get_current( ).*
       check lv_btstatus_parent is bound.
        CASE lv_btstatus_parent->get_name( ).
            WHEN 'BTStatusH'.
              gc_relation_name = lc_us_header.
            WHEN 'BTStatusI'.
              gc_relation_name = lc_us_item.
        ENDCASE.
      ENDIF.
    CALL METHOD super->do_view_init_on_activation.
    ENDMETHOD.
    Here lv_btstatus_parent is bound during initial launch, however after navigating back to the same page, its blank leading to exception.
    any suggestions would be helpful.
    regards,
    pradeep

    solved myself

  • Cannot access Created Context Attribute from Component Controller

    Hello All,
    I have added a new attribute to a node in my component controller 'LOGONUID' and I cannot access it within my windows within the WDA application.
    DATA lo_nd_url_param TYPE REF TO if_wd_context_node.
      DATA ls_workset TYPE wd_this->element_workset.
      "DATA ls_logonuid TYPE wd_this->element_logonuid.
    I get an error as soon as I try to activate this code in my method in my W_MAIN
    In my component controller I do not see it reference in the SAP generated code in my WD_THIS IF_COMPONENTCONTROLLER?
    * Intf.: ig_componentcontroller
    * Purp.: programming interface for access of this controller within
    *        other controllers of the same component
    *        controller:  <COMPONENTCONTROLLER> of
    *        component:   <zhr_wd_mss>
    * UDate: 20111207 145441
    *=====================================================================*
    interface ig_componentcontroller.
      interfaces: ziwci_hr_wd_mss .
      constants:
        wdctx_context type string value `CONTEXT`.
      constants:
        wdctx_cuifcontext type string value `CUIFCONTEXT`.
      types:
        begin of Element_cuifcontext,
          USERID  type String,
          LASTEVENTOPERATION  type String,
        end of Element_cuifcontext,
        Elements_cuifcontext type
           standard table of Element_cuifcontext
           with default key.
      constants:
        wdctx_messages type string value `MESSAGES`.
      types:
        Element_messages type ZHR_S_MESSAGE,
        Elements_messages type
           standard table of Element_messages
           with default key.
      constants:
        wdctx_workset type string value `WORKSET`.
    I want it to be declared as the constant 'WORKSET'
    thank you
    Edited by: Keith Warnock on Dec 7, 2011 8:55 PM
    Edited by: Keith Warnock on Dec 7, 2011 8:56 PM

    > I have added a new attribute to a node in my component controller 'LOGONUID' and I cannot access it within my windows within the WDA application.
    >
    >
    >
    > DATA lo_nd_url_param TYPE REF TO if_wd_context_node.
    >   DATA ls_workset TYPE wd_this->element_workset.
    >   "DATA ls_logonuid TYPE wd_this->element_logonuid.
    >

    >
    This declaration is not right. There is no element logonuid, you  have the attribute inside a node. workset is a node and thats why you can declare that way.
    easiest way is to declate
    data lv_logonuid type <ddic type> or
    data lv_logonuid type wd_this-><node name>-logonuid.
    You can also use the code generator in (CTRL +F7 ) to get/set attributes.

  • Declaring and accessing custom global attributes of component controller

    Hi,
    I want to declare some global attributes for Component Controller and initialize them in WdDoInit() method.
    I have declared them under Component Controller --> Attributes tab --> after wd_context and wd_this (say G_MESSAGE).
    However,  when I am trying to set them in wdDoInit() method, I get compilation error saying G_MYMESSAGE is unknown and its not defined using data statement.
    How do I access these attributes?
    Thanks and regards,
    Amey

    Hello Amey,
    You need to access the variable by "wd_this->g_mymessage"
    Since wd_this attribute in each controller refers to interface of local controller. you could read the description of that attribute in attribute tab.
    Regards
    Anurag Chopra

  • Mapping one node in a view context to many nodes in the component controlle

    Hi guys,
    I need to map an element (attribute) of a node in the View Context to an attribute of multi nodes of the same type:
    Context View:
    customer_no
          |
          | -> KUNNR
    Component Controller Context having two nodes:
      - Node1
         RFC1
            |
            |->KUNNR
      - Node2
          RFC2
             |
             |->KUNNR
    Above I need to map the (KUNNR) in customer_no node to KUNNR in the RFC1 RFC2 before i execute the two RFCs services.
    Note:
    if this is not possible would you mention another solution.
    Thanks,

    Hi,
       As per MVC you cannot map context from view controller to component controller.Mapping can happen from component
    controller to view controller.
    You cannot create mapping for context attributes. You can map nodes if both source node and destination node both has same structure and same number of attributes. If they dont contain same number of attributes the extra attributes from the source node gets copied to the destination node.
    In your case before the RFC execution you can read the value of attribute Kunnr from view and set it the RFC attribute Kunnr before the Function module execution.
    Regards
    Bala Baskaran.S

  • Access context of Component Controller from Views

    Hi,
      In WD Java, I used to set attributes value for Context present in Component controller from the view. I used to write a piece of code at the view level for this.
    How do i do this in WD ABAP. I believ I have to get instance of Component controller like this:
    lr_compcontroller type REF TO ig_componentcontroller.
    lr_compcontroller = wd_this->get_componentcontroller_ctr( ).
    Regards,
    Murali.

    Hi Murali,
    yes you can access the comp_controller in the same sort of way in WDA.
    You declared component usages on the property tab.
    The wizard (ctrl-F7)has various options, check it out.
    One is calling methods on declared controller usages.
    the result is for example such generated code:
    DATA: l_ref_ANOTHER_CONTROLLER TYPE REF TO IG_ANOTHER_CONTROLLER .
          l_ref_ANOTHER_CONTROLLER =   wd_This->Get_Another_Controller_Ctr( ).
    data:
          l_Api_Another_Controller type ref to IF_WD_CONTROLLER.
    See also local interface code in CTRL-SHIFT F1.
    You work directly with this info.  Indeed constants from the interfaces should be used this way.
    Work with the wizard. And declare all usages in the properties tab.
    Moving outside of the framework is possible but not recommended
    regards
    Phil

  • Creating Node for Context in a  component controller disabled.

    Hi, I am trying to create this node, i see the option when I do RightClick the context in the component controller > Create>Node, but i was not able to select it. Am i missing some settings to enable it?
    Appreciate your help.
    Thanks,
    Chinnam.

    hi..
    No worries, this forum will help you
    On top left corner you will find , small icons for change, dispaly..
    just place your mouse over those icons...you wil get the tooltips.
    to build a simple applicatioin
    http://www.****************/Tutorials/WebDynproABAP/SimpleApplication/SimpleApp1.htm
    and to learn webdynpro just go through the below links
    http://www.sdn.sap.com/irj/scn/webdynpro-elearning
    Regards
    Srinivas

  • Read a View Context's node's element and assign from Component controller

    Hello Experts,
    I'm new to JAVA WD.
    Here is my scenario.
    I have to use an Adobe form in a WDJ. The input parameters and the output parameters of the DC are defined in a method in the Interface Controller method.
    The context of the Component Controller has the following structure
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    Then the mapping between the Component controller and the interface controller is done so that the Interface controller also has the context structure as
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    So now the interface controller and the component controller are bounded correctly.
    Now I bind the view also with the Component controller as below.
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    But since i need to use an Adobe interactive form inside this view, the datasource for the form cannot be the root context node but some other node. So I replicated the same structure in the view context so as to make the fields visible in the Adobe form context. Now the context looks as below.
    Context
    ---StartDate
    ---EndDate
    ---AbsenceType
    ---DATA_NODE
    -----StartDate
    -----EndDate
    -----AbsenceType
    Now my question is, how do i map the result from the Adobe form into the context of the view??
    What code should i write and where should i write to achieve this?
    I need to do the following. But dont know how to write the code for this.
    Context.StartDate = Context.DATA_NODE.StartDate
    Context.EndDate = Context.DATA_NODE.StartDate
    Context.AbsenceType= Context.DATA_NODE.AbsenceType
    Please help!
    Any help will be greatly appreciated.
    Thanks,
    Sam

    Hello Nikhil,
    I'm stuck with another small issue.
    Let me first explain what I'm trying to do.
    I have a view with the context structure as follows
    Context
    ---DATA_NODE (Node)
    ----Data1
    ----Data2
    ---Data1
    ---Data2
    All i need to do is, at the start of the view, i need to move the data from
    Context.Data1=>Context.DATA_NODE.Data1 and
    Context.Data2=>Context.DATA_NODE.Data2
    Also, at the View Submit button click, I need to move the data from
    Context.DATA_NODE.Data1 => Context.Data1 and
    Context.DATA_NODE.Data2 => Context.Data2
    (I managed to do this submit button click by calling an action->method and wrote the code as you gave earlier)
    wdContext.currentContextElement().setData1(wdContext.currentData_NodeElement().getData1());
    wdContext.currentContextElement().setData2(wdContext.currentData_NodeElement().getData2());
    But I wrote at wdInit() for the view the code in the reverse way, but the values are not getting passed to the Data_Node and hence its not defaulting with the values from the elements of the context.
    This is what I wrote.
    wdContext.currentData_NodeElement().setData1(wdContext.currentContextElement().getData1());
    wdContext.currentData_NodeElement().setData2(wdContext.currentContextElement().getData2());
    Please let me know if I'm doing something wrong here.
    Appreciate your help in advance!
    Cheers,
    Sam

  • Constructor undefined , while initiating model node in component controller

    Hi Team,
    I am getting constructor undefined error, when i am trying create an object of model node in component contrloller.
    i tried the solution provided in this Undefined constructor and model nodes but it is working.
    can any one suggest me?
    Regards
    Bala

    Hi Akshaya,
    here is my code.
    i am just intatiating the model node in component contrlloer.
    the below method id in component controller.
    public void wdDoInit()
        //@@begin wdDoInit()
    try {
            AnyType_Item atm = new <b>AnyType_Item()</b>
    wdContext.nodeAnyType_Item().bind(atm);
    catch (RuntimeException e) {
         // TODO Auto-generated catch block
          e.printStackTrace();
          wdComponentAPI.getMessageManager().reportWarning(e.getMessage());
    The above bold one is error, saying constructor is undefined.
    regards
    Bala

  • How to fire event in view controller from component controller.

    I have a component usage that fires an event wich i have subscribed in the component controller.
          iv_usage->subscribe_event( iv_event_name = 'TAKE_IT'
                                     iv_handler = me ).
    After the event the method IF_BSP_WD_EVENT_HANDLER~HANDLE_EVENT in the component controller is called.
    method if_bsp_wd_event_handler~handle_event.
    endmethod.
    The usage component is opened as a popup window. After pressing a button, the data is transfered via context node binding to the calling component. But now i want to close the popup.
    My intension is to fire a event for the view controller in the IF_BSP_WD_EVENT_HANDLER~HANDLE_EVENT method that closes the popup.
    Is this possible?
    Or let me explain it this way:
    I want to close a popup after a button in the popup is pressed.
    best regards
    Jürgen

    Hello Juergen
    I am assuming your target pop-up is of type ref to IF_BSP_WD_POPUP.
    1.Make this a view controller class attribute.
    2. After the code to create the pop-up, you can add the following block :
    gv_target_popup->set_on_close_event( iv_view = me iv_event_name = 'CLOSEPOPUP').
    3. Now define event handler EH_ONCLOSEPOPUP where you can write the logic for on_close.
    You can access the same reference gv_target_popup at the event handler level as well.
    Hope this helps.
    Regards
    Nisha

  • To fetch data from a standard component through Component Controller

    Hi,
    I have a requirement in which i have to access and display a standard view of a standard component in a Custom Component.
    I am able to display or configure that view on Custom Component by using Component Usage and Component Interface. But unable to populate the data in that view. Although i have exposed a context node in the standard component and created the same context node in my custom component in the Component Controller and using its method WD_USAGE_INITIALIZE to bind them.Please, provide some pointers on it.
    Cheers,
    Sharad

    Hi Sharad,
               The data will show up only if you put them there. May be the standard component itself gets the data from some where else. Usually, these data are provided by the component controller. For example, the component controller contains the header entity and the used component has access to the header entity via binding and shows all item entries fetched via relations(usually this is done in on_new_focus method). If the binding is there, but no data ia available, it will stay empty.
             Check a standard main component which uses the standard component that you are using and look at how they are establishing the connections.( component/custom controller bindings, on_new_focus methods,,)
    Regards,
    Arun Prakash

Maybe you are looking for

  • I had a bookmarked site in my most visited folder at the top of the tool bar and today it isn't there. How do I get it back in there?

    I don't know how to put a bookmarked page back into my most visited folder on the tool bar under the "back" arrow key. It has been there for days and this morning it was gone!

  • FLV and Event Cue Points

    Hi, I am streaming and flv file with numerous event cue points. When each cue point is reached I attach different movie clips. The problem is I need to add custom fast forward and rewind buttons to the video. I tried using netStream.seek(netStream.ti

  • Tree and Table UI element with same data source (context)

    Hello, I am trying to build an application which shows an tree and an table UI which shows additional information to the selected tree node. (like Windows Explorer) I am using an context like this: Class - - - - - - - - --  (Mapped  value Node) - Sub

  • Md5 command inside of .mpkg directories?

    Hello. I found out that .mpkg is actually directory and not a file. Is that correct? I was using Mac OS X 10.7.4's Terminal's md5 command to compare files until it said .mpkg was a directory. I also cannot seem to find a way to make it MD5 recursivel

  • Photoshop Elements 11 Mac App Store

    It´s disapointing that Mac App Store doesn't have realeased yet Photoshop Elements 11, since it has been released by Adobe since September 2012!!!!! I got it by mistake just to realize that in December 2012 I bought Photoshop Elements 11, what is nex