cancel
Showing results for 
Search instead for 
Did you mean: 

View within ViewContainerUIElement

Markus_Schutz
Participant
0 Kudos

Hi,

I would like to get the view name of the view which is currently displayed within a view container.

In more detail:

View V_MAIN contains a view container which displays V_DETAIL_1 followed by V_DETAIL_2 (in a second step). There's a method SHOW in V_MAIN where I want to get either V_DETAIL_1 or V_DETAIL_2 depending on the view that's currently on display.

How can I do this?

I was looking for a solution for a couple of hours now, without success.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Marcus ,

Write the below code in modify view.

if first_time eq abap_true.

wd_this->mv_view = view.

endif.

define mv_view as an attrubute.

Now you can have the reference of the view container UI element through get_lement method of the WD_THIS_>MV_VIEW.

Hope this will help you.

Regards

Kuldeep

Markus_Schutz
Participant
0 Kudos

Hi Kuldeep85,

by naming this, I guess it must be possible to get the name of the view in the ViewContainer from the parent view object?

But how?

What other objects or methods do I need to get the name. Is it really so complicated?

In my opinion this is a common requirement, not only for my application.

So?

gill367
Active Contributor
0 Kudos

Hello Markus,

CL_WD_VIEW_CONTAINER_UIELEMENT is the class for view_container UI.

i checked all the methoda and attributes for the class.

I am not able to find anything from which you can get the name of the active view.

so i guess you need to do some workaround like as suggested in very first reply by kiran.

thanks

sarbjeet singh

Former Member
0 Kudos

HI Markus,

Somthing like this will give you the "static embeded view"...Check if it will help you out.

Variable names are very bizarre...Bear with it.:)

DATA lo_api_main TYPE REF TO if_wd_view_controller.
  DATA lo_usuage   TYPE REF TO IF_WD_RR_VIEW_USAGE.
  data lo_usuage1  type ref to IF_WD_RR_VIEW_CNT_ASSIGNMENT.
  data lo_view_ususge type ref to IF_WD_RR_VIEW_USAGE.
  data lv_views type WDRR_VCA_OBJECTS.
  data lv_var   like line of lv_views.
  data lo_view type ref to if_wd_rr_view.
  data lv_name type string.


   lo_api_main = wd_this->wd_get_api( ).

   lo_usuage = lo_api_main->GET_VIEW_USAGE( ).
   lv_views = lo_usuage->GET_VIEW_CNT_ASSIGNMENTS( ). "This gives all VC assignments...Loop around and proceed .

   loop at lv_views into lv_var. 
      lo_usuage1 = lv_var-VIEW_CNT_ASSIGNMENT.

      lo_view_ususge = lo_usuage1->GET_DEFAULT_VIEW_USAGE( ).
      lo_view = lo_view_ususge->get_view( ). " This will have the runtime repository of the view
      lv_name = lo_view->get_name( ). "This will have the view name.

   endloop.

Thanks,

Aditya.

Markus_Schutz
Participant
0 Kudos

Hi Aditya,

that's very helpful. However, it always provides the default view for the view container as indicated by the method name "get_default_view_usage" which is V_DETAIL_1 even if we're in V_DETAIL_2.

I checked the other methods but I cannot find one which provides the current view.

Ideas?

Former Member
0 Kudos

Hi,

How did you manage to put 2 different views in the same VC element?

And how are you navigating?(i mean to 2nd step)

Thanks,

Aditya.

Markus_Schutz
Participant
0 Kudos

The view container is assigned to the parent view in the window structure whereas V_DETAILS_1 and V_DETAILS_2 are assigned as childs to the view container.

Each view has it's own inbound plug. Nagivation is done by fireing the corresponding outbound plugs.

Just to avoid misunderstandings: The views V_DETAILS_1 and V_DETAILS_2 are not displayed at the same time. V_DETAILS_1 is first, after the navigation, V_DETAILS_2 is next.

V_DETAILS_1 is defined as the default view for the view container in the windows structure.

That's why get_default_view_usage( ) always returns this view. However, I need to get the view which is currently displayed within the view container.

vishesh_malik
Participant
0 Kudos

Hi Markus,

I think if you are navigating from one view to another view than you can pass a parameter through the outbound plug which you can check in Inbound plug's method and use this attribute to know which view is being currently displayed.

And accordingly you can set name of view in another attribute which you can use in any method of your component..

Hope it will help!

Best Regards,

Vishesh

Answers (5)

Answers (5)

Markus_Schutz
Participant
0 Kudos

Any further ideas? Your help would be highly appreciated.

Former Member
0 Kudos

Hi,

Try to check in debugging modify view

if_wd_view->IF_WD_VIEW_CONTROLLER~GET_VIEW_USAGE retuns the view usages. which retunrsIF_WD_RR_VIEW_USAGE->GET_NAME- the name of view being embdeded.

Let me also give it a try.

Edited by: Lekha on May 13, 2011 6:36 PM

Markus_Schutz
Participant
0 Kudos

Hello Lekha,

I don't see how this could help. If I understand correct, this procedure could, at a maximul, deliver the name of the "parent" view for the view in the ViewContainerUIElement. This would be the wrong approach since I need the name of the view within the ViewContainerUIElement in a method (not WDDOMODIFYVIEW).

Just to make sure I tried to use this code snippet in both the parent and the child view without success.

More idea?

Markus_Schutz
Participant
0 Kudos

Two questions:

- do I have access to the view outside of WDDO* methods?

- how can I get the name of the view when I have the reference to the view container? I was trying to achive this yesterday without any luck.

Former Member
0 Kudos

Hi Markus,

You can get the reference of your container and then you can retrieve the name of the view in that container.

Hope this will help.

Regards

Kuldeep

Markus_Schutz
Participant
0 Kudos

Thank you for your answer. Even though this is obvious, I would like to make it more dynamic.

There has to be a possiblity to access the view in the ViewContainer. I just don't know how.

Any other ideas?

former_member184578
Active Contributor
0 Kudos

Hi.,

Create an attribute in context., if it is in V_DETAIL_1 set that attribute to 1 and if it is V_DETAIL_2 set that attribute to 2 (in wdinit methods of those two views) .

now in display method., read that attribute using get_attribute( ) method. if it is 1 the view is V_DETAIL_1 ., if it is 2 the view is V_DETAIL_2.

hope this helps u.,

Thanks & Regards

Kiran