cancel
Showing results for 
Search instead for 
Did you mean: 

how to access a view from another view

Former Member
0 Kudos

Hi all,

I have to access a view from another view using views reference. I have created an attribute (view1) of type IF_WD_VIEW_CONTROLLER in component controller and also got the reference of the one view.

now i want to access an UI of that view in another view using the wd_Comp_Controller->view1.

How to do this.. Can any one guide me.

Regads,

Susil.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I am having view1 and view2.

in view1 i am using roadmap. S1 is one of the step of road map.

in view1 i used this code to get the reference of this view in componentcontroller attribute

Data: lo_api TYPE REF TO if_wd_view_controller.

If first_time = 'X'.

lo_api = wd_this->wd_get_api( ).

wd_Comp_Controller->my_VIEW = lo_api.

endif.

in my view2 i want to access the roadmap step

i dono how to access that.. i used this code.......

wd_comp_controller->my_view->get_element( 'S1' ).

is this correct.. If not what is the code to get that id..

Can any one tell me clearly...

Former Member
0 Kudos

Hi,

i think your code gets executed only one time because you have put a condn on first time so its get executed only first time.

so write your code outside the if statement.I think you are also not making the assignment correctly.you should do the assignmet like this

lv_xyz = wd_Comp_Controller->my_VIEW .

where lv_xyz is a local variable

Former Member
0 Kudos

hi ,

u can access the view in either WD DOMODIFY orin some method which is the on Action of some UI ( say Button )

The interface of method wdDoModifyView provides a parameter VIEW, which is a reference to an object of type IF_WD_VIEW representing the instance of a view at runtime.

So, use tht reference using the attribute mr_view .

mr_view refers to the associated TYPE IF_WD_VIEW .

Declare this attribute in the ATTRIBUTE tab and using the refernce .


DATA: lr_container TYPE REF TO cl_wd_uielement_container.
lr_container ?= wd_this->mr_view->get_element('TC_SYSTEM' ).
// "TC_SYSTEM' is ur transparent container inside which is ur UI

regards,

amit

Former Member
0 Kudos

Hi amit,

Is this code which I have writern is correct.. to get the roadmap ID..

wd_comp_controller->my_view->get_element( 'S1' ).

if not please tell me the correct code..

Thanks

Susil

Former Member
0 Kudos

if my_view is of type if_wd_view then you are correct..

if you have stil issues, use the pattern button

insatnce : wd_comp_controller->my_view

class - if_wd_view

mehtod get_element

For this method there is importing and exporting parameters...

This will genrate the code for you for calling that method...

just pass that importing value and use the exporting parameter into some value (type IF_WD_VIEW_ELEMENT)

check in se24 for the method signature..

or else use this code

wd_comp_controller->my_view->get_elemnet
exporting
id = 'S1'
recieving
element = lr_vele (decalre this variable of type ref to if_wd_view_element)..

Regards,

Lekha.

Former Member
0 Kudos

Hi Lekha,

wd_comp_controller->my_view->get_element( exporting id = 'S1'

IMPORTING element = lr_vele ).

When i use the above code I am getting an error: The method GET_ELEMENT is unknown..

Regards,

Susil

Former Member
0 Kudos

wd_comp_controller->my_view is fo type if_wd_view_controller...

what i specirfied is the method of if_wd_view....

Using the if_wd_view_controller.....check for teh relevant method.

Edited by: Lekha on Dec 10, 2009 10:22 AM

Former Member
0 Kudos

Hi, already i have specified wd_comp_controller->my_view is of type if_wd_view_controller.. enen though i am getting this error....

Ok thank you for your replies..

My problem is not solved ....

Regards,

susil

Edited by: Susil Kumar on Dec 10, 2009 9:57 AM

Former Member
0 Kudos

try to save the if-wd-view refernece that you get from modifyview............

in the if-wd-view_controller there is no get_element............

Former Member
0 Kudos

Hi..

Ya I have got the reference of the view and stored in an attribute globally in component controller.. I dono how to access it another view....

Can Any one help me out of this

Regards

susil

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

you can acess the comp controller attribute in the other view using

wd_comp_controller->attributename.

Priya

Edited by: Chaitanya Priya Puvvada on Dec 9, 2009 7:02 AM

Former Member
0 Kudos

ya priya, I dono how to access the view using the wd_comp_controller->attributename .

I want to get the UI Id (roadmap step ID) of the view from another view using wd_comp_controller->attributename how to do this. I need the code..

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

*Ya I have got the reference of the view and stored in an attribute globally in component controller.. I dono how to access it another view....*

as you have stored the value in the attribute of component controller.

you can access the comp controller attribute in the view using

in the view where you want to acess use

wd_comp_controller->attributename.

or pass wd_comp_controller->attributename. to some variable so that u can acess it.

lv_data = wd_comp_controller->attributename.

the varible will hold the value .

Priya

Former Member
0 Kudos

What UI you want to access..Please be more clear..

Former Member
0 Kudos

I want to access the RoadMap Step (Step ID ).

Former Member
0 Kudos

Hi,

you should bind your value of step id to a context element in your component controller

and change the value there, from the 2nd view

Respect the MVC model en let the Controller do the interaction between views.

Greetz,

Koen

Former Member
0 Kudos

HI,

I geuss you might have decalred some attribute to bind to the selected step right..Is this you want..

or when you create the roadmap in layout that ID you want..

Is this Road map created at design or runtime..

If you want to get the roadmap id then you need code in modifyview method of that view.

view is of type if_wd_view get the view info and you can place this globally so that you can use it in next view..

Former Member
0 Kudos

Hi..

I have done eveything.

I dono how to write the code in the domodify view of the another view from where I have to access the spefic view using the component controller attribute View1.

Regards,

Susil.

Former Member
0 Kudos

You want to have the information of view's layout in another view..is this so..

Former Member
0 Kudos

yes .. i dono to write the code...

Former Member
0 Kudos

if you want the view layout info of 1st view, in teh modifyview method of first view use the method GET_ELEMENTS_BY_CID

and store the values globbaly in component controller which can be used in the next view..but using this you will get to know only the layout related info..