cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a Particular View from a View of Current Component

Former Member
0 Kudos

Hi Experts,

Pls let me get a solution for my small issue..

I do have 2 components cur_component and old_component which contain 2 Views each say, cur_vew1 & cur_view2 and old_view1 & old_view2 respectively.

Now, When i click a button in cur_view1 then it should call the view - old_view1 of old_component and when i click a button in cur_view2 then it should call the view - old_view2 of old_component.

When i tried, its calling the default view of the old_component. but i want to call the views of the old_component dynamically...

hope am clear enough about my issue..

Kindly help on me on this to solve this..

With Thanks in advance,

Amala

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Saurav and Amit,

Thank you a lot...

my issue has been solved now..

i created seperate windows for each view in old_comp and i called those views in my cur_comp in seperate containers using visibility attribute... now i hve understood the logic still more better..

thank you both a lot..

and i would like to give you points.. how to give that, sorry am very new to this forum..

With Thanks,

Amalaa

Former Member
Former Member
0 Kudos

I will try these methods and will let u knw soon abt the status..

thank you,

amlaaa

Former Member
0 Kudos

Hi,

ya, i was able to embed the old_comp to cur_one.. while doing tht i did not see any views from the old_comp.. so when i run my cur_comp its calling the default view of the old_comp..

but i want to call the non-default view also from old_comp from cur_comp at tun time..

Amalaa

Former Member
0 Kudos

hi,

When you do component usage , then in the second component , place all the views in different windows.

Then only it will be possible to call different views .

Ex.

If you using comp2 in comp1.

Comp2 has 1 windows , 3 views - v1 ,v2, v3.

NOw when you do component usage , then only default view v1 can be used in this.

Because it is quite obvious that v2 and v3 will be called in v1 only.

So if you want to call v2 and v3 also in comp1, please put v2 and v3 in separet windows othrwise it wont be possible.

Edited by: Saurav Mago on Oct 14, 2009 11:15 AM

Former Member
0 Kudos

hi,

if u have done the component usage right , while embedding the views , u shud be able to see the old_view

in ur current component , try to follow steps in my previous post , u wud get it

regards,

amit

Former Member
0 Kudos

hi,

I hope now you are able to have views of oldcurview into newcurview comp.

Now visibility , Refer this code :

DATA lo_el_context TYPE REF TO if_wd_context_element.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • get single attribute

lo_el_context->set_attribute(

name = `CA_VISIBLE`

value = '02' ).

Here , I have made an Attribute CA_VISIBLE of type wdui_visibility and binded to view container in newCurview1.

Set CA_VISIBLE as '01' in WDdoinit to make ViewContainer Invisible by default and on the click of button:

Set it to '02' which will make it Visible.

Former Member
0 Kudos

Hi Saurav & Amit,

Yes i hve done Component Usage.. and the navigation is also fine.. when i run my cur_component, its calling the old_component and the default view is appearing in my browser..

but i need to select the views of old_component dynamically. ie, if i click one button in cur_component it should call the view1 of old_component and if i click 2nd button, then i should call the 2nd view of old component..

and Saurav, i dint understand these two steps.. kindly help me on this..

3. bind the visible property of viewcontainer with wdui_visiblity.

4. On the click of button in curview1, set the visibility as '02'.

but whn i emded the view into the viewcontainer of cur_component, i got only the old_component name and the component controller.. i didnt see any view names there...

With thanks in advance,

Leena

Former Member
0 Kudos

u need to bind ur UI element with visibility

suppose on click of ur button1 , u want to show V1 view

and on click of button2 u want to show V2 view

u may proceed like this :

1 in side the view(say its name is curr_view) of ur current component , Insert a UI element which is "View Container "

give its id as VC1

2 similarly insert another View Container and give its id as VC2

3 Now go to WINDOWS , double click on that

4 let us say ur window name is W_component , right click on ur window

5 drill down to VC1 , right click ur mouse to choose embed view , choose view V1 of ur old component

6 drill down to VC1 , right click ur mouse to choose embed view , choose view V1 of ur old component

7 make 2 attributes ca_visiblle , ca_visible2 of type wdui_visibility under the context node of ur view curr_view

8 Bind the visibility property of ur view container VC1 with this attribute

9 now if this attribute is set to '02 ' , it means the UI element is visible , to make the UI invisible , set this attribute to '01'

set the default value of both the attributes to '01'

10 in the onActionbutton1 of ur current component , set this attribute to '02' , like this :


  DATA lo_nd_cn_visible TYPE REF TO if_wd_context_node.
    DATA lo_el_cn_visible TYPE REF TO if_wd_context_element.
    DATA ls_cn_visible TYPE wd_this->element_cn_visible.
    DATA lv_ca_visible LIKE ls_cn_visible-ca_visible.
*   navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
    lo_nd_cn_visible = wd_context->get_child_node( name = wd_this->wdctx_cn_visible ).

*   get element via lead selection
    lo_el_cn_visible = lo_nd_cn_visible->get_element(  ).

*   set single attribute
    lo_el_cn_visible->set_attribute(
      EXPORTING
        name =  `CA_VISIBLE`
      
        value = '02').

here I have created a attribute ca_visible of type wdui_visibility under a context node cn_visible

11 similarly proceed with the onActionbutton2 , where u set that the attribute ca_visible2 to '02' to make the other view visible dynamically

I hope it wud help u

regards,

amit

Edited by: amit saini on Oct 14, 2009 7:27 AM

Former Member
0 Kudos

hi,

Are you not able to Embed the view of second component into the first one ?

When you go to windows -> View Container -> Embed view , Are you not getting view of second component here.

If not, please check your component usage.

For Visiblity :

1. Make an Attribute in your New Currview1 of type wdui_visibility.

2. bind this with Visible property of Viewcontainer.

3. Now in Wddoinit method, set the visibility of this attribute as 01 using code wizard.

4. And on the click of button , change its visibilty to visible using set_Attribute method.

For visible : set attribute 02 .

For invisible : set 01.

Edited by: Saurav Mago on Oct 14, 2009 11:02 AM

Former Member
0 Kudos

hi ,

to be comfortable with this visibility attribute , u shud try to go thru this thread :

regrds,

amit

Former Member
0 Kudos

Hi ,

cheers ur issue get resolved:)

there is a radio button on LHS of ur post replies .

depending upon the the reply which helped u solve query , u can award 2, 6 or 10 odd points to the specific users.

please go thru the rules of engagement , as Sourav pointed

regrds,

amit

Former Member
0 Kudos

hi ,

have u done component usage to reuse ur old component in ur new component .

refer this article on component usage :

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

to know , how to set the context attribute for visibility , u wud also like to go to this thread :

refer to Uday's reply in this thread as well :

1) When you create your context at component controller level in component MAIN you have a property for the node which says as: "Interface Node" Just checkmark this checkbox. When you do this you would be able to share the data within your context nodes across other components.

2) Specify a default value of AA in the "Default Value" property of the attribute in component MAIN

3) Now go to your other component SUB which you would like to also get initialised. Define a usage of your component MAIN within this component.

4) Go to your component controller & create your context node & attribute with exactly the same names as how you had created in your MAIN component.

5) Do a mapping between the interface controller of your MAIN component & the component controller of your SUB component

6) You would be able to see that the appearance of the node has changed to an interface node. This means that your SUB component now has an exact replica of your MAIN components context data.

regards,

amit

Edited by: amit saini on Oct 13, 2009 2:47 PM

Former Member
0 Kudos

hi,

1.In the view curview1 , place an viewcontainer.

2.Embed the view oldcurview1 into this viewcontainer from windows.

3. bind the visible property of viewcontainer with wdui_visiblity.

4. On the click of button in curview1, set the visibility as '02'.

similiarly you can go for curview2.

In order to Embed view into Viewcontainer :

1. go to windows.

2. by default you curview1 would be set.

3. inside Curview1 there must be a ViewContainer.

4. Right click and Embed view.

5. Select oldcurview1.

I hope you have done component usage of second component into new component.