Skip to Content
author's profile photo Former Member
Former Member

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2011 at 08:57 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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi everyone,

      I got mixed up... I was thinking that I was referencing the ATTRIBUTE and not the entire NODE.

      This code here corrected my issue:

        " Get parameter values
        CLEAR wa_parameter.
        READ TABLE it_parameter WITH KEY name = 'WORKSETID' INTO wa_parameter.
        IF sy-subrc EQ 0.
          ls_workset-worksetid = wa_parameter-value.
        ENDIF.
      
      *---------------------- END OF  todo ------------------------
        " Get parameter values
        CLEAR wa_parameter.
        READ TABLE it_parameter WITH KEY name = 'LOGONUID' INTO wa_parameter.
        IF sy-subrc EQ 0.
          ls_workset-logonuid = wa_parameter-value.
        ENDIF.
      *---------------------- END OF  todo ------------------------
      
      *--Save URL parameter to context
        lo_nd_url_param = wd_context->get_child_node(  name = wd_this->wdctx_workset  ).
        lo_nd_url_param->set_static_attributes(
           static_attributes = ls_workset ).
      
      

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.