cancel
Showing results for 
Search instead for 
Did you mean: 

How to get parent component at run time from embedded component view

Former Member

Hi,

Just want to know is there any standard way of getting parent component name/view name ,if my control is in embedded view name at run time.

For eg : Consider embedded component as BP_DATA , so while accessing any view of BP_DATA( Relationships OV) , i need to find out whether this component is embedded within BP_HEAD ( Account screen ) or within BP_CONT(Contact Screen). I can see the parent_view name from outer_rep_view of the window( BP_DATA/Relationships) in debug mode. But those are protected and cannot be accessed.

Any pointers???

Regards,

Nithish

Edited by: nithish P on Mar 4, 2012 12:19 AM

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Nithish,

You can access the parent view/window controller instance from your embedded view.

From this instance you can read the view/window name. You can extract the component name

from this.

Regards,

Leon

[How an SAP ABAP Career Can Be Like a Train Journey|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/28751] [original link is broken];

Former Member
0 Kudos

Hi Leon,

I can get the window controller ( BP_DATA/Relationships) from view BP_DATA/RelationshipOV through code

me->view_manager->get_window( ).

But from window controller I am not able to fetch the parent component name , such as BP_CONT or BP_HEAD.

Could you please let me know from which attribute of the window controller can i get the parent view name or component name?

Regards,

Nithish

0 Kudos

Hi Nithish,

You can access the attribute OUTER_REP_VIEW by creating a method in the window controller class.

Create a method like GET_OUTER_REP_VIEW and return the corresponding instance so that

you have the instance. Once you have the instance, you can access the property PARENT_VIEWSET.

Regards,

Leon

[How an SAP ABAP Career Can Be Like a Train Journey|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/28751] [original link is broken];

Former Member
0 Kudos

Hi Leon,

Even if we create get_outer_rep_view method in window class, how to access outer_rep_view attribute . Its defined as private in standard window class, so even after enhancing my widow class I wont be able to get it.

Is there any other path or logic to get the outer_rep_view if i create a new method in my window class?

Regards,

Nithish

0 Kudos

Hi Nithish,

The attribute OUTER_REP_VIEW is defined as protected, not private.

You can access it in the view/window controller class like this.

me->outer_rep_view

You can refer the Class CL_AGROE_SEARCHWINDOW_IMPL Method GET_OUTER_REP_VIEW.

From the view/context node, you can access like this.

if ME->WINDOW->OUTER_REP_VIEW is bound. 
LV_PARENT_REP_VIEW = ME->WINDOW->OUTER_REP_VIEW->GET_PARENT( ). 
LV_WINDOW          = GET_PARENT_WINDOW( ). 
ME->REP_VIEW = ME->WINDOW->OUTER_REP_VIEW.

Regards,

Leon

Former Member
0 Kudos

Thanks Leon.

My bad ,I wasn't able to access SAP yesterday , I remember only host_view attribute which is private and thought of the same

about outer_rep_view attribute !!!

Regards,

Nithish

Answers (2)

Answers (2)

Former Member

Hi Leon,

I could not able to find GET_PARENT_WINDOW( ).

How to access a view attribute of a parent component from embedded view?

Below is a sample code written in embedded view event handler method.

lr_window type ref to zembedded_view_contained_window.

lr_outer_rep_view type ref to cl_bsp_wd_rep_view.

lr_parent type ref to  cl_bsp_wd_rep_view.

lr_window ?= me->view_manager->get_window_controller( ).

lr_outer_rep_view ?= lr_window->get_outer_rep_view( ). ** custom method to return outer_rep_view

lr_parent ?= lr_outer_rep_view-> get_parent( ).


Here I got the parent component OV page as a rep view, from here how to get the instance of a required view controller of a parent component?

Thanks in advance for your help.


Regards,

Sanjay

Former Member
0 Kudos

Hi all

Could you pls let me know how this thing works. I am unable to get the parent view details through this.

Kindly lemme know.

Regards

Swadini Sujanaranjan