on 12-02-2008 7:23 AM
Hi,
Thanks to all who replied to my previous thread. Please let me know how to access the attributes in method of component controller in the view.
Let Component_method be my method in component controller which contrains few attributes like this
method component_method.
data : node1 type ref to if_wd_context_node,
itab type standard type of mara.
endmethod.
I want to access the above attributes in method of view.
method view1.
wd_comp_controller->method_component( ).
-
????? how to access the data of the method_component?
endmethod.
Kindly help me out in the syntax.
Rgrds
Mahathi
Hi
To access component controller's data, you need to have it in the method's signature (exporting/changing etc parameters). The other option is you can declare global attributes for each controller (in the component controller's attribute tab), which are accessible in the entire WD component.
Chitrali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mahathi
You should define the parameters in the header, not in the body of the method:
You can define it as importing, exporting, changing or returning, as you need. For example, in SE80
-
Parameter Cl.declar. RefTo Opt Type ref
node1 importing X if_wd_context_node
itab exporting mara
-
method_component().
" code here...
endmethod.
and when you have to call the method,
wd_comp_controller->method_component(
EXPORTING node1 = nodelocal " not importing!!!
IMPORTING itab = itablocal " not exporting!!!
).
i think that it's this what you want, don't i?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mahathi,
Its not possible to make use of the attributes which are declared inside a method from another view. The variables which you declare in a method are only visible within that particular method. If you want to have th concept of global attributes then you need to define the attributes in the "Attributes" tab of component controller. You also need to checkmark the "Public" checkbox beside the attribute. You can then make use of this attribute inside your view using the special attribute WD_COMP_CONTROLLER. Say suppose you have created an global attribute at component controller level by name GV_TEST of type I. (Also the Public checkbox is checked.) Then you can access this variable from within a view by saying as:
ex: WD_COMP_CONTROLLER->gv_test = 1.
Any method that you create at component controller level is by default visible across all the views in the component. However for the attributes created at component controller level you additionally will have to set this "Public" flag to make them as available to other views.
Regards,
Uday
PS: If your questions are answered then do the needful by closing the threads. You need to close off all answered threads as per the rules of the forum.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.