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

Similar Messages

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

  • How to get and set custom tag attributes

    How do i get and set custom tag attributes from a jsp page?

    Not sure if this is what your looking for, but....
    example...
    < taglibprefix:testtag attribute1="x" attribute2="y">
    ...of course, the attributes have to be defined in your taglib (.tld) file

  • Need to bind value attributes of Component controller with value attributes

    Hi,
    I am developing a Java Web Dynpro application which is importing RFC Model.

    Hi Kaushik,
    It is very simple to enter values in webdynpro and to update the ztable through RFC
    All you hav to do is
    1. Create the ztable , RFC to import data into that table,
    2. Create the model in webdynpro with that RFC
    3. First map the ModelInputElements to the component controller(say zid, zname) (you can have your own value attribute in component controller say id , name )
    4. Map the attributes to the view where the input field is there
    5. Now write the code as follows,
    Zxxx in = new Zxxx();
    wdContext.nodeZxx_InputElement.bind(in);
    in.setZid(wdcontext.currentContextElement().getId()); // getId component controllers attribute and getZid is model' s mapped attributre
    in.setZname(wdcontext.currentContextElement().getName()); // getName component controllers attribute and getZname is model's mapped attributre
    /* u need not have to map that model attrobute to component attribute for that */
    try
    in.execute();
    Catch(Eception e)
    e.printStackTrace();
    Regards,
    Sam Charles J.

  • Can I create a class and package for my inframe AS and access it global

    Ls,
    I made an app using only inframe actionscript in a .fla;
    transfrerring variables from frame 1 to frame 2 is unreliable.
    Some sources say the persist over frames but i found that not to be reliable.
    Arrays seem to be filled with the right values. Normal int vars declared in frame 1 fail some time.
    You should have used classes i hear you say,  and right you are.
    But I didnt.
    Now im using either reloading, re-initing and/or the sharedobject.
    Anyhoe..
    Question:
    If I declare a class for my main .fla file.,
    then declare, instantiate and load the globals i want in this main class,
    will I be able to acces these variables in my main .fla timeline script?
    If so, I could slowely reconstruct my .fla into smaller objects/classes and make it a real app.
    Just starting from scratch is. welll..i dont even want to think about that.
    Highest regards,
    Mac

    Yes! I got it to run as Mobile project.
    Now, how to test on my mobile thru USB.
    I'm more/only used to working from FLASH CS5.5
    Although I like the builder, it feels really flexible, it also seems more work(yeah still lazy).
    Is there an advantage to using the builder over Flash CS?
    Thank you.. again...again
    Mac

  • Upload interactive form and access field values in WD component

    Hi Experts,
    I want to upload a prefilled  interactive adobe form in my webdynpro component and then I want to read the values filled in the form in my webdynpro component.
    I don't want to display the interactive form in the WD component. Just need to read the values.
    Please let me know how can I do it.
    Warm regards,
    Sushant Singh

    You can use the fileupload and filedownload uielements.
    Check these links:
    [File Upload|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b3/be7941601b1d09e10000000a155106/content.htm]
    [File Download|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/09/a5884121a41c09e10000000a155106/content.htm]
    When you upload a file and save in SAP, are you saving it as xstring.
    If yes follow these steps for filedownload.
    Follow these steps for file download:
    1 Create FileDownload uielement in your View
    2.Create an Attribute of type xstring.
    3.Bind this attribute to the data property of your Filedownload uielement.
    4. during fileuplaod as you are saving the document in xstring format, fetch the same from your database table and pass the value to filedownload i.e set the attribute bound to data property of filedownload uielement with the xstring content.

  • 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

  • How to call global attribute in .htm page in sap crm

    hi friends,
    in the class i have  created a global attribute . i want to access this global attribute in .htm page of the view . how to call this attribute in .htm  please send me the syntax .
    thanks and regards,
    sashi

    hi,
    I have accessed the global attribute in .htm page . I have declare a local variable and pass the global attribute value to local variable.
    Here I put a validation for hiding the field . If the data is not available in the field then only I have to hide the field. For this I have written the code. For your reference,
    <%
    DATA : lv_exprevenue TYPE STRING.
    DATA : lr_entity TYPE REF TO if_bol_bo_property_access.
    *lv_exprevenue = ZL_BT111H_O_DETAILS_IMPL=>gv_dref.
    *lv_exprevenue =  controller->gv_dref.
    lr_entity ?= BTOpportH->collection_wrapper->GET_CURRENT( ).
    CALL METHOD lr_entity->GET_PROPERTY_AS_STRING
    EXPORTING
       IV_ATTR_NAME = 'EXP_REVENUE'
    RECEIVING
          RV_RESULT         = lv_exprevenue.
    IF lv_exprevenue is NOT INITIAL.
    exit.
    else.
    data: lv_xml type string.
    lv_xml = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
    replace all occurrences of '//BTOPPORTH/EXPREVENUE' in lv_xml with ''.
    ENDIF.
    %>
    <chtmlb:config displayMode = "<%= controller->view_group_context->is_view_in_display_mode( controller ) %>"
                    xml     = "<%= lv_xml %>"
                   mode        = "RUNTIME" />
    But the entire view is being hidden in WEB UI.
    Please Let me know if there is any mistake in the above code or I have write code some where else.
    Thanks & Regards,
    Sashi
    Edited by: skancharla on Nov 2, 2011 2:09 PM

  • 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

  • Reading global attributes from implementation class

    Hi,
    How to access
                    global attributes of implementation class
                             from getter method of context node class.
    Thanks in advance,
    Srinivas.

    Hi Srinivasa,
    Access the view controller using attribute
    owner
    , Then you can access the global attributes.
    Regards,
    Masood Imrani S.

  • Custom vs component controller

    i was trying to use component controller instead of custom controller in the Get Flight List application. but it is not working. can any one tell why?
    when do we use custom controller and when component controller?

    Hai vineet,
    For Normal and simple applications you can use Component controller , If you are using complex application that contains more models and more views , you can share the data by using custom controllers,
    can you breifly explain what's your problem is?
    to get the reponses immediately post this thread on Webdynpro for java forum
    regards,
    Naga

  • Value of attribute defined in Component controller level is not avalabale

    Hi Experts,
    I am facing one strange thing.
    There is one standard WD /PLMU/WDC_RFO which i am enhancing.
    I define one attribute at Component controller level and fill it but the value is not available at View level.
    The Attribute is although exist at view level but it is blank.
    Please help.
    Thanks
    Mahesh

    > I define one attribute at Component controller level and fill it but the value is not available at View level.
    >
    > The Attribute is although exist at view level but it is blank.
    >
    > Please help.
    >
    > Thanks
    > Mahesh
    are we talking about "attribute" context node- attribute or component controller attribute ?
    node/attribute means then you may have to check that the node/context is not invalidated in between after you updated the value and the place where you see in the view.

  • 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

  • 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

  • Webdynpro - component controller

    Hi Gurus ,
    We designed screen in webdynpro . I created attributes in component controller and i tried to copy that attributes from component controller to view context. But i can't able to drag and drop that attributes.. Is there is any other way to copy that attributes or only option is to create attribute directly in view context

    Hi meena,
    Mapping between the controller is through NODE's. If you want to make you attribute global then you have to define node and create your attribute inside that and go view controller and perform mapping.
    If you define attribute in View Controller then that can be use in same View but you cannot use it in different View controller
    for this we define global attribute and mapped to different view controllers
    As you said you read in the site, it also suggest the same CREATE NODE in CC -> Attribute  -> goto VC and perform Mapping
    Regards
    farooq

Maybe you are looking for

  • Nested While Statements

    Hey guys, Im fairly new to Java programing and i have hit a brick wall in my coding. My program is a Multi-choice questionaire. And all works fine until i add the error checking code in, and i dont get (and I can't get to work) nested will statements

  • I plugged my phone in to charge and the apple logo keeps flashing up what does this meen?

    i plugged my i phon einto charge and the apple logo keeps popping up and the phone wont come on, what does this meen?

  • Removing objects in the background of imovie

    After a nights worth of filming, i realised that in one of my scenes, you can see the tripod in the background and i was just wondering if there was anyway i could remove it. I don't want to crop the scene because its right in the middle of the frame

  • Webi report on mobile

    Hi all, when i view my webi report on mobile, the report comes with number of pages as the number of elements in my report, i am able to see only one chart in one page and for the next chart i have to go to different page. Is there any possibility th

  • Top row of keyboard wrong after goto snow leopard

    Just updated from tiger to snow leopard, now the top row keys (using 2 different keyboards that work ok on other macs correctly) do not work correctly: Speaker up vol key: starts dashboard Speaker down vol key: all windows hide Speaker on/off: shows