Skip to Content
avatar image
Former Member

Reference to wd_this

Hello,

is it possible to reference to wd_this from outside of an view?

The issue is, I have a routine that needs to be integrated into several views in several webdynpro applications.

I would like to develop it as an external method call. But if I want to do so I need to somehow refer to wd_this

in this method and I dont know how I can refer to it as an import parameter.

I need to get access to wd_this-if_window_manager because I would like to open an modular window that is a used component with shared context (I need to pass data to it from the calling view).

Everything works very well, beside the fact that I now need to create the method about 12 times into 12 different views as seperate local methods and that is not what object orientated design should look like.

Thanks for any ideas! I appreciate you guys!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Feb 25, 2010 at 04:54 AM

    Hi,

    The data contained in the view is private to the view.

    Also wd_this which hold the reference to interface of view has scope limited to that view only.

    So, you can't set an importing parameter of type IF_<VIEW_NAME> ( wd_this ) outside the view.

    Try this, create a method in componentcontroller and there set an importing parameter of type ref to if_wd_window_manager ( which you want to pass ) and then call this method from your views.

    Regards

    Manas Dua

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 25, 2010 at 03:38 AM

    hi,

    u can do cross component programming - component usage to use ur routine in the Web dynppro application ..

    refer this article on component usage :

    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2e71ce83-0b01-0010-11a4-98c28a33195f

    1 in the component B , Double click the component in the object tree and choose the tab Used Components.

    2 Define a usage of your component A within this component.

    3 Do a mapping between the interface controller of ur MAIN component B & the component controller of

    ur SUB component A 4 Before you can call the Interface Controller method of the used component in ur view ,you have to declare that the view controller can use the Interface Controller of the used component. By default only the component controller can access used components directly, view controllers have to specify this explicitly.

    5 go to the tab Properties of the B, click the button Create Controller Use and select the INTERFACECONTROLLER of the component A for component use .

    6 go to WINDOWS , inside ur View container right clck to select embed view to select the view to be embedded

    regards,

    amit

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      So you mean that I would place the coding to call component A from component B inside component A and then reference to it using the method you discribed?

      I will try it out because it somehow sounds interesting but I somehow doubt that this will work. The coding in component A will by nature use its own wd_this reference and not the one from component B.

      But I want to open a modular window and therefore need an instance of wd_this of component B. Actually I think that Manas is right and I can never get access to a wd_this as its locally defined and private due to its dynamically generated nature of the runtime environment.

      Anyhow, your approach sounds at least interesting and I will try out a little bit with it. even if it mightnot be an solution for my problem its an interesting topic where I could learn a bit more about reuseability.

      So thanks anyway!