Skip to Content
avatar image
Former Member

calling comp controller attribute from iinside view

HI all,

I want to know how to call a component controller attribute from inside a View's method?

any sampe coding..?

Regards,

Shanthi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 09, 2009 at 11:35 AM

    if u have declared a attribute in ur component controller , thn u can acess it in ur view using

    wd_comp_controller->gv_variable
    

    where name of ur context attribute in comp controller is gv_variable

    u cn do it thru code wizard as well

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 09, 2009 at 11:31 AM

    you can use

    lv_var is in comp controller attributes tab.

    wd_comp_controller->lv_var

    Add comment
    10|10000 characters needed characters exceeded

    • Older Support Package levels didn't have the built-in attribute for WD_COMP_CONTROLLER. You had to use the following code to access the component controller:

      DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
      lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).

      Actually some of the code wizards still generate this even now that we have WD_COMP_CONTROLLER built in.

  • avatar image
    Former Member
    Oct 09, 2009 at 11:31 AM

    Well, you can use the wizard. Just call any method from the component controller. The wizard will create you the code including the line how you will get a reference to the component controller, which is the point here.

    After you have the reference to the component controller, let's say lo_component_controller, you can access its attributes like this:

    lo_component_controller->your_attribute

    Then of course delete the unnecessary lines of code. 😉

    Regards,

    Karri

    Add comment
    10|10000 characters needed characters exceeded