[size=large]Controller Attributes[/size]
Each controller is a separate ABAP program,having not only predefined and user-defined methods,but also attributes,which are at least visible for each method of the controller.
[size=large]Standard Attributes[/size]
After having defined a controller,at least two attributes are predefined.These attributes have a visibility,which is restricted to the controller methods.The standard attributes are:
WD_THIS
WD_THIS is a self reference to the controller interface.This attribute must be distinguished from the standard ABAP self reference ME,which should not be used in the source code of any controller.WD_THIS is a reference to the current controller's interface,IF_<controller name>,and represents all the functionality implemented in the generated class.This also gives you access to standard Web Dynpro functionality,such as validation.
WD_CONTEXT
WD_CONTEXT is the reference to the controller's context root node,and thus to the entire context.Any access to the controller's context starts with this reference.
WD_CONTEXT and WD_THIS
a. Present in any Web Dynpro controller(except interface and interface view controller)
b.WD_THIS: Self reference of the local interface - type depends on the controller type.
c. WD_CONTEXT: Reference to the context of the associated controller.
If the Component controller is declared as a used controller on the Properties tab of any other controller,an addtitional attribute is automatically created for the controller that declared the usage:
[size=large]* WD_COMP_CONTROLLER[/size]
wd_comp_controller is the reference to the component controller.Using this reference, all methods and all public attributes of the component controller can be accessed(wd_comp_controller-><meth>,where <meth> is a placeholder for the methods name).
a.Reference to the component controller with access to all ordinary methods and public attributes
b. Attribute will be assigned if the component controller is defined as a used controller in the Properties tab of this controller.
*** For all other controllers,even if declared as used controllers,such a reference is not available.However this does not mean,that user-defined methods and public attributes are not available,but that the reference must be evalutated first.To have the reference to the <ctrl>controller defined as a used controller,the following statement must be used:
DATA: lo_ctrl type ref to ig_<ctrl>.
lo_ctrl = wd_this->get_<ctrl>_ctr().
[size=large]User-Defined Attributes[/size]
On the Attributes tab,additional attributes can be defined for the related controller.If the Public flag is set,these attributes are also visible for other controllers of the same Web Dynpro component.Attributes can not be exposed to the components interface.
In order to access public controller attributes in one of the controller's methods, the self-reference variable WD_THIS has to be used.Accessing public attributes defined in other controllers of the same component is implemented similarly to accessing methods defined in other controllers.
Each controller is a separate ABAP program,having not only predefined and user-defined methods,but also attributes,which are at least visible for each method of the controller.
[size=large]Standard Attributes[/size]
After having defined a controller,at least two attributes are predefined.These attributes have a visibility,which is restricted to the controller methods.The standard attributes are:
WD_THIS
WD_THIS is a self reference to the controller interface.This attribute must be distinguished from the standard ABAP self reference ME,which should not be used in the source code of any controller.WD_THIS is a reference to the current controller's interface,IF_<controller name>,and represents all the functionality implemented in the generated class.This also gives you access to standard Web Dynpro functionality,such as validation.
WD_CONTEXT
WD_CONTEXT is the reference to the controller's context root node,and thus to the entire context.Any access to the controller's context starts with this reference.
WD_CONTEXT and WD_THIS
a. Present in any Web Dynpro controller(except interface and interface view controller)
b.WD_THIS: Self reference of the local interface - type depends on the controller type.
c. WD_CONTEXT: Reference to the context of the associated controller.
If the Component controller is declared as a used controller on the Properties tab of any other controller,an addtitional attribute is automatically created for the controller that declared the usage:
[size=large]* WD_COMP_CONTROLLER[/size]
wd_comp_controller is the reference to the component controller.Using this reference, all methods and all public attributes of the component controller can be accessed(wd_comp_controller-><meth>,where <meth> is a placeholder for the methods name).
a.Reference to the component controller with access to all ordinary methods and public attributes
b. Attribute will be assigned if the component controller is defined as a used controller in the Properties tab of this controller.
*** For all other controllers,even if declared as used controllers,such a reference is not available.However this does not mean,that user-defined methods and public attributes are not available,but that the reference must be evalutated first.To have the reference to the <ctrl>controller defined as a used controller,the following statement must be used:
DATA: lo_ctrl type ref to ig_<ctrl>.
lo_ctrl = wd_this->get_<ctrl>_ctr().
[size=large]User-Defined Attributes[/size]
On the Attributes tab,additional attributes can be defined for the related controller.If the Public flag is set,these attributes are also visible for other controllers of the same Web Dynpro component.Attributes can not be exposed to the components interface.
In order to access public controller attributes in one of the controller's methods, the self-reference variable WD_THIS has to be used.Accessing public attributes defined in other controllers of the same component is implemented similarly to accessing methods defined in other controllers.
本文介绍了WebDynpro中控制器的属性,包括预定义的标准属性如WD_THIS和WD_CONTEXT,以及当组件控制器作为使用控制器时创建的WD_COMP_CONTROLLER属性。此外,还探讨了如何定义用户自定义属性以及如何在控制器的方法中访问这些属性。
2069

被折叠的 条评论
为什么被折叠?



