cancel
Showing results for 
Search instead for 
Did you mean: 

refreshing views

Former Member
0 Kudos

Consider the following situation

View1 -


>View 2

view 2 has a tabstrip - > Tab1 and Tab2

Each of these tabs has a view embedded in them.

Tab1--->view 3

Tab2---> view 4

both View 3 and View 4 have their own elements and a viewcontainerUIelement each, and so each of them has another view embedded in them.

view3 ->view 5

view 4 -> view 6

Thus, effectively, views 3 4 5 and 6 are visible when view 2 is visible.

View 2 has a button to go back to view 1.

Is it possible to clear all the data on the views 3 4 5 and 6 when this back button is clicked. And subsequently, the views should be initialized again when the view 2 is opened from view 1 again.

Could anyone tell me how to achieve this functionality?

regards,

Priyank

Message was edited by:

Priyank Jain

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Priyank,

One of the ways could be that you fire an event OnAction 'Back' and clear the context attributes. I am not suggesting you to demolish the reference and create fresh views everytime because it would eat time in rendering the views to HTML format. But if you make use of Events then it will be a one time effort and you will just be clearing the data.. without destroying the UI controls/elements.

Regards,

Anoop

Former Member
0 Kudos

Hi Anoop,

Thanks for the response.

I do have an event Onactionback when i click the back button to go to the view 1.

At this point of time, i have to clear the attributes of the four views. how do i clear the data of one view from another. More so, once i come back again to the view2, will the WDDOINIT be fired again? I am fetching the data in these views in the do init method. If this is not so, then how do i get the updated data in views 3 4 5 and 6 each time i open view 2. In the do init method of each view, i am calling some RFCs and then another view method to fetch the data.

I have come to know that calling a view method from another view is not possible. So i m looking for other options. I hope I am able to explain my problem well.

regards,

Priyank

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Priyank,

You can not access view context from other views.

Better you have the same context in component controller or custom controller binded to your view context and

keep on clearing the same.

Regards

Abhimanyu L

Former Member
0 Kudos

Hi Priyank,

Let me try to address the issues one by one.

Clearing data of other views should not be a problem if you have nodes at component controller level or else you can fire event for each view at component controller level and handle it in view.. you may raise one event for each view(in case of nodes local to view).

And as far as loading of data is concerned then the moment you call view2 from view1 then the action triggering this process can fetch the data for you instead of the WDDOINIT of view2.. right ??

I hope this helps.

Regards,

Anoop

Answers (2)

Answers (2)

Yashpal
Active Contributor
0 Kudos

Hi Priyank ,

create a component A with view 1 and a view containter .

create a separate componentsay 'B' for view 2 .

In view1's component create a dynamic usage of the 'B' component and create this 'B' component whith the help of class : CL_WDR_COMPONENT_USAGE method create_component() in click of some button for eg create.

instead of creating back in view 2 create in view 1 , and on action if this ... get the active component usage of B component and destroy it ...

when u again click create button for eg creae in view 1 again a new component is created for B this way all the values will be refreshed ....

Hope this will help u ...

Regards

Yashpal

Message was edited by:

Yashpal Gupta

Former Member
0 Kudos

Hi Yashpal,

I already have the views in the same component. Is it not possible to do it without creating another component?

regards,

Priyank

Former Member
0 Kudos

Hi Priyank,

refer the post above your last post tht might be of some help..

Regards,

Anoop

Yashpal
Active Contributor
0 Kudos

Priyank,

I think its not possible ..... even though if there are some navigation in view ..if view becomes active again in the same lifecycle of component the default view is not refreshed so the best possible way is to destroy the used component and again create a new one.. as it will be new one .. it will have all the data initialized ,,

Regards,

yashpal

Former Member
0 Kudos

Hi Anoop,

I can do the data fetching in the action triggering process but the problem is that i also have the code for ALV column settings (making columns editable, enabling append rows and delete rows) in the do init method of the view. I tried to leave this alv settings code in the do init method and do the data fetching on the click of the button on the previous view. It works fine when i navigate to the view for the first time but when i go back and then again come to this view, i can see only a single column in the ALV. Where should i write the code to handle the ALV in this scenario?

any hints???

regards,

Priyank

Former Member
0 Kudos

sorry!!!!

my mistake...please ignore the last post from me.

Former Member
0 Kudos

Thanks Anoop!!

+10 for you

Can you also have a look at my other post, which mentions about one field getting cleared from the ALV?

Former Member
0 Kudos

Thanks a lot for points I will try to answer that query as well .. subject to the condition that I know the solution 😄

Have a nice day.

Regards,

Anoop

Former Member
0 Kudos

Hi,

you could add inbound plugs to those views and bind them to an outboundplug in

your main, this plug is fired in the onactionback, so you will navigate to the views

grtz

Koen