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

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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.

  • Problems in using Gplus Data Access Component to invoke SAP-RFCs

    Hello integration-gurus!
    We need to make RFCalls out of routing strategies within Genesys Universal Routing Server (URS).
    We learned that we need to install the Gplus Data Access Component (DAC) in order to do so. After copying the rfc32lib.dll into installation directory of DAC the DAC establishes a valid RFC-connection to ourer SAP-CRM 5.0 system. But if the URS requests the definition of the specific remotefunction (the DAC provides this information as a WSDL for URS) it gets a timeout. Now we think that we need special files (perhaps XML-schemata provided by SAP) to transform the DDIC-types provided by the RFC into SOAP-specific datatypes communicated from DAC to URS.
    Where can we get these files?
    Has anyone experiences with such an integration scenario?
    Kind regards
    Michael

    Hello integration-gurus!
    We need to make RFCalls out of routing strategies within Genesys Universal Routing Server (URS).
    We learned that we need to install the Gplus Data Access Component (DAC) in order to do so. After copying the rfc32lib.dll into installation directory of DAC the DAC establishes a valid RFC-connection to ourer SAP-CRM 5.0 system. But if the URS requests the definition of the specific remotefunction (the DAC provides this information as a WSDL for URS) it gets a timeout. Now we think that we need special files (perhaps XML-schemata provided by SAP) to transform the DDIC-types provided by the RFC into SOAP-specific datatypes communicated from DAC to URS.
    Where can we get these files?
    Has anyone experiences with such an integration scenario?
    Kind regards
    Michael

  • WebUI: Data sharing / Component Controller

    Hi All,
    I am working on CRM2007 WebUI, I have two components( comp1 and comp2 ). I want to get the details entered in a view of comp1 to another view in comp2 after navigation, the context node corresponding to the details ( data ) is already in the component controller of comp1.
    Now, how to proceed for getting the details I entered in the view of comp1 to a view of comp2 after navigating to the view in comp2 ?.
    Any help/hint highly appreciated,
    Thanks, Sudeep..

    Hello Sudeep,
    It depends on whether you have comp 2 embedded in comp1 or comp2 substitutes comp1 after navigation. In the first case you can enable data binding between component context nodes in WD_USAGE_INITIALIZE method. In the second case you have to pass your data via the oubound/inbound plugs in the iv_collection parameter of your OP* and IP* methods. So, in outbound plug you send the data from comp1 and in the inbound plug of comp2 you receive the data.
    Best Regards,
    Yevgen

  • 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

  • Diff between Component controller,Custome controller and  View controller

    hi,
        Can any body tell me the following details,
    1.difference between the Component controller,Custome controller and  View controller in WD-ABAP.?
    2.what is Lead Selection?   
    Regards,
    Ravi

    Hi Ravi.
    The component controller is visbile to all views in a component. So all context nodes and methods you create here can be accessed from all views in the component. This way you can share data between the views by mapping context nodes or thru method calls. You can also mark methods and nodes as interface so that they are acessable from other components that define component usages to this cmponent.
    Custom controller is quiet similar to the component controller. You can define it if you want to group some views with a custom controller for a certain functionality.
    If you want to access a custom controller in a view you have to define the usage first on the properties tab of the view.
    A view controller is only visible in the view itself. So all methods or context nodes you define here are only accesable by the current view.
    The lead selection is in most cases the current selected element in a context node. The lead selection is used by many UI elements to determine which element has to be shown (e.g drop down).
    If you have a table with single selection the current selected table row is the lead selection element of the bound context node.
    SO you can get the lead selection element easily in any mthod by calling context_node->get_element( ).
    Hope this clears your questions.
    Cheers,
    Sascha

  • How to access Custom controller

    Hi all,
    How can i access custom controller objects in my other controllers.Can i call custom controller objects from component controller .

    Hi,
    I hope you mean the Custom Controller the same way we understand as defined here
    [http://wiki.sdn.sap.com/wiki/display/WDABAP/Introductiontocontrollers|http://wiki.sdn.sap.com/wiki/display/WDABAP/Introductiontocontrollers]
    To access custom controller from the component controller you have to do the following.
    1. Component controller->properties->use insert button to select the custom controller.
    2. Use the code generator (CTRL+F7) -second tab(general)->method call in used controller->select your custom controller->method.
    This will generate code like this
    DATA lo_zzsbn_cust_cc1 TYPE REF TO ig_zzsbn_cust_cc1 .
    lo_zzsbn_cust_cc1 =   wd_this->get_zzsbn_cust_cc1_ctr( ).
      lo_zzsbn_cust_cc1->test(

  • Is it possible to serialize a web dynpro component controller?

    Hi,
    Is it possible to serialize a web dynpro component controller and deserialize it for use?
    I have one web dynpro application WDA1 for web dynpro component WDC1. And  another web dynpro application WDA2 for WDC2 will be opened in a new window triggered by a button action in WDC1.
    Iu2019d like to pass the object reference of WDC1 component controller to WDC2.
    I first tried to use a static member of a class object but found out that even the static member is initialized and set in WDC1, itu2019s still initial when I access it in WDC2.
    Then I searched the forum and found one article Passing Object ref to Webdynpro Application while calling from BSP screen .
    The recommended way is to serialize the object reference and store in a DB table, later on read it out and deserialize it for use.
    I tried serialization using the following code, but when itu2019s deserialized, the result is initial.
    Can anyone share some ideas on this?
    Serialize
      data: ostream type string,
               xslt_err type ref to cx_xslt_exception.
    ***** serialize model class
      try.
          call transformation id
          source model = wd_comp_controller
          result xml ostream.
        catch cx_xslt_exception into xslt_err.
      endtry.
    Deserialize
        data: istream type string,
              xslt_err type ref to cx_xslt_exception.
        istream = ls_db_sel-obj.
        data lr_wdc type REF TO ZIWCI_BY_WDC_SERIALIZE.
        try.
            call transformation id
            source xml istream
            result model = lr_wdc.
          catch cx_xslt_exception into xslt_err.
        endtry.

    When you say new window, I assume you mean new browser window. This is a separate user session then.  This is why the singleton pattern doesn't work.  Have you considered using a new dialog window instead of a new browser window.  It will be modal, but will share the same user session as the parent window.
    >Why do you choose this approach over cross-component usage ? component usage is the way webdynpro components are >to be reused.
    >You can also consider using Singleton OO pattern class to share data between these two components.
    Neither of these approaches will work if you are using separate browser windows. Such an approach results in two separate user sessions (perhaps even running on different application servers depending upon how you have load balancing setup) and therefore can't share data using either of these approaches.
    In general the idea of serialization and then writing the string ito a server cookie or other database table is sound.  I don't think you should try and serialize the component controller, however.  Serialization only saves and restores public attributes - not protected or private ones.  So in general a class has to be designed for serialization.  The component controller is much too complex and wasn't designed for such an operation. 
    I would suggest instead extracting the data you want to share out of component controller or context and serializing it into a custom class and passing that to the other component.

  • 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

Maybe you are looking for

  • Where should I tell PE 12 to put its working copies on my Mac

    When I initially set up PE on my Mac, I set the following for the working directories: Capture Video : Same as Project Capture Audio : Same as Project Video Previews: Same as Project Audio Previews: Same as Project Media Cache: Custom Disc Encoding:

  • Difference in report f.01 and total depreciation report S_ALR87012004

    Hi all, Could you please find that the difference in the above report is due to direct jv passed by the user, then how to correct it without disturbing the other balance. Or else what are the possibility of the difference other then jv entry in repor

  • Clearing invoice with downpayment

    Hi FICO GURUs, I m a new student in FICO, here i have a question as following, ask for help, step 1: For one customer say 1001, I've done the Downpayment, the amount is 2000 USD. step 2: Created a Customer Invoice with amt 2000 USD. step 3: Clearing

  • How do you set different sleep times for different days?

    Energy Saver --> Schedule allows you to schedule start/wake/sleep/shut down, but it doesn't provide very fine grained control. Is there a way to set the computer to sleep or shut down at different times on different days, to wake only on particular d

  • Import all data using maxl

    Hi we would like to export all data from BSO cube my maxl script, as the db is bigger then 2gb, essbase split the file to 2gb each, and we'll get more then one file to import. How can I have maxl script which know to import all data files on the spec