cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the action of a button to another action in other view or component?

0 Kudos

Hi Experts,

   I'm trying to use ViewContainer UI element to show  View2 screen of Component 2.

Here is the structure:

Component 1                           Component 2

  |                                                    |

  |                                                    |

  |                                                    |

  === View 1      <========   View 2 ( visible in ViewContainer of View 1 )

There is a button in View 2 ,

Is it possible bind or set the action of the button  to action in View1  ?

Thanks for help.

Eric.

Accepted Solutions (1)

Accepted Solutions (1)

m_aravindan
Active Participant
0 Kudos

Hi Eric ,

       Check this document hope it solves your problem.

http://scn.sap.com/docs/DOC-35144

Regards

Aravindan

Answers (8)

Answers (8)

0 Kudos

Hi  Sreenu & Aravind,

0 Kudos

Hi Experts,

  Sorry,  I don't describe my question clearly.

I have already declare the usage of component B in Component A.

( the component B is  reusable for other WDA components )

But my question is when I push the button in Compnent B,

is it possible to trigger the action in component A ?

Just like WDA calls popup confirm screen ( if_wd_window_manager ),

I can through the method "subscribe_to_button_event" to define the action in different component.

sreenu_b2
Explorer
0 Kudos

Hi Eric ,

Yes you can do that .

You need to define an Event in Component B .

When you push the button in Component B , Fire this event .

Maintain the related handler for this event in View of component A.

By defining the usage of Interface controller in component A view , register the handler.

This way you can achieve what you want

------------------------------------------------------------------------------------------------------

But why you doing this way , may be as per the business .

But instead of keeping that action in component B,and againing firing an event from component B and hadling that action in component A, why dont you keep an a button in view of component A and handle it there itself

amy_king
Active Contributor
0 Kudos

Hi Eric,

You can define a component controller method as an interface method by checking the method's Interface checkbox  on the Methods tab. This includes the method in the public interface of the component so that a calling component may call the  method.

Cheers,

Amy

m_aravindan
Active Participant
0 Kudos

Hi Eric ,

            Just check this tutorial in SAP Technical , hope it helps you to solve your problem..

http://saptechnical.com/Tutorials/WebDynproABAP/Reusability/demo.htm

Regards

Aravindan

Former Member
0 Kudos

you can do this.

1.  create a method in componentcontroller in component1  which is called by view1 button and make this method interface method by checking  checkbox INTERFACE in component controller.

2. use  component1 as usedcomponent in component2 by adding a row in tab USEDCOMPONENT .

3. go in properties tab of component controller and view of component2 click on button "CREATE CONTROLLER USAGE"  use component1 as used component.

3. now use wizard to call this componentcontroller method of component1 in view2 of component2.

if helpful reward points.

Former Member
0 Kudos

Hi eric,

   What I understood is that you have created some inaction in view 2 ( link with a buttin in view layout ) & you want to use the same action frm  view 1. I dont think this is possible.

    The reason is only items at the component controller level are visible to other compoents.

The action or the button UI elemtn is in your view controller , so you cannot use that.

How ever you can do one thing if req. You can place your logic in a method of the component controller ( make it a interface method ) & then you cn cal it from the both the compoent ( from the action of the view 2 & from view 1 ).

Regards,

Monishankar Chatterjee

Former Member
0 Kudos

Hi Eric Yang,

Refer this link:

http://scn.sap.com/thread/1936617

former_member184578
Active Contributor
0 Kudos

Hi,

You cannot bind like that. whereas you can call method of one component in another component.

Check this thread: http://scn.sap.com/thread/1936617

Hope this helps u.,

Regards,

Kiran