cancel
Showing results for 
Search instead for 
Did you mean: 

Callinfg ALV from another component

Former Member
0 Kudos

Hi all,

We have a main component in which on press of a button we need to show alv which is in another component.

I am trying to follow these steps but i need your inputs

1. I have declared the component which calls alv in used components

2. In the main view of my component i have placed a VCU

3. In the window of the main component i have embedded that VCU and embedded the view of the component which calls the alv.

Now how can i call alv on press of that button ?

Please let me know your suggestions

Regards

Bhanu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bhanu,

I think you follow all steps how to use component usage right.

if not check this,..

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/2e71ce83-0b01-0010-11a4-98c28a33195f

On button click just call another component view using code wizard. you can get.

cheers,

Kris.

Former Member
0 Kudos

Thanks for the doc.

I can see my ALV now but the problem is i placed a VCU on the main view hence the view is called on the MAIN View itself.

I want to call this view on press of a button

Any inputs?

former_member184578
Active Contributor
0 Kudos

Hi.,

Create One more view and make it as default view and on Click of button navigate to Main View..

hope this helps u.,

Thanks & Regards,

Kiran

Former Member
0 Kudos

HI ,

How about, creating a button in the view having the ALV(i.e a View container having ALV embedded) and on click of the button, play with the visibility of the viewcontainer element?

I havent tried such a thing yet...Just a sugestion.

Thanks,

Aditya.

former_member199125
Active Contributor
0 Kudos

hi bhanu,

You can try the aditya suggestion. Or you can place ur alv view in separate window.

You can call that window as pop window on click on of button.

Regards

Srinivas

Answers (2)

Answers (2)

Former Member
0 Kudos

thanks all it worked

Lukas_Weigelt
Active Contributor
0 Kudos

Hi,

Aditya has the right idea in my opinion. I always do things this way (altering visibility) because 1. it's easiest and 2. you don't have initializing problems. Here's how you can do it:

First of all, set your ViewContainer invisible in design time.

1. Go to the Component controller of your main component (where your ViewContainer is in), go to attributes

2. Add an attribute Z_GO_VIEW, Public, Type ref to, IF_WD_VIEW.

3. Go to your View of the CC where the VC actually is in.

4. Go to hook method WDDOMODIFYVIEW

5. Add the following code:

IF first_time = abap_true.
    wd_comp_controller->z_go_view = view.
ENDIF.

--> now you have the instance of your view interface.

6. Make a button

7. In the event handler method of the button, code something alike to this:

DATA:
       lo_el_ui_root      TYPE REF TO cl_wd_uielement_container, 
       lo_el_trans_cont1  TYPE REF TO cl_wd_uielement_container,
       lo_el_button1     TYPE REF TO cl_wd_button.

DATA: lv_visibility TYPE WDUI_VISIBILITY.

 lo_el_ui_root ?= wd_comp_controller->z_go_view->get_element( 'ROOTUIELEMENTCONTAINER' ).
 lo_el_trans_cont1 ?= lo_el_ui_root->get_child( ID = 'TC_ONE' ).
 lo_el_button1 ?= lo_el_trans_cont1->get_child( ID = 'I_AM_THE_MIGHTY_BUTTON' ).

lv_visibility = '02'.

lo_el_button1->set_visible( value = lv_visibility ).

This isn't exactly what you'll need but you get the picture: Get the View Instance, Downcast the UI tree for the Element you want to dynamically alter, use the right method for alterations.

This should solve your problem. If it doesn't, ask us again

regards, Lukas