Handle button event of popup created from component controller

Hi all,
I have created a method for created popup in the component controller with button kind 'yes-no'.Now i use it in the view.
Till here all is working fine.
Now i want to use the events which triggers on the popup (yes, no).Any idea how to trigger these buttons action.
The problem i am facing here is: When i use <b>subscribe_to_button_event</b> method it does not working.
Any ideas how to use this.
Points will be sured.
Sanket sethi

hi sanket.........
here is a code snippet... check this out.
data: l_cmp_api          type ref to if_wd_component,
        l_window_manager   type ref to if_wd_window_manager,
        l_popup            type ref to if_wd_window,
        l_text             type string_table,
        l_api              type ref to if_wd_view_controller.
  l_cmp_api        = wd_comp_controller->wd_get_api( ).
  l_window_manager = l_cmp_api->get_window_manager( ).
  insert `Data where changed` into table l_text.   
  insert `Do you want to save?`        into table l_text.   
  l_popup = l_window_manager->create_popup_to_confirm(
                text            = l_text
                button_kind     = if_wd_window=>co_buttons_yesnocancel
                message_type    = if_wd_window=>co_msg_type_question
                window_title    = 'Test: Popup to confirm'
                window_position = if_wd_window=>co_center ).
  l_api = wd_this->wd_get_api( ).
  l_popup->subscribe_to_button_event(
               button            = if_wd_window=>co_button_yes
               action_name       = 'YES'
               action_view       = l_api
               is_default_button = abap_true ).
  l_popup->subscribe_to_button_event(
               button            = if_wd_window=>co_button_no
               action_name       = 'NO'
               action_view       = l_api
               is_default_button = abap_false ).
  l_popup->subscribe_to_button_event(
               button            = if_wd_window=>co_button_cancel
               action_name       = 'CANCEL'
               action_view       = l_api
               is_default_button = abap_false ).
  l_popup->open( ).
--regards,
  alex b justin

Similar Messages

  • How to handle key events in popup component

    Is there any possibility to handle keyboard events after a popup is opened
    requirement : I want to close popup when I press escape key (by default this functionality is present but in some scenarios this is not working ) so explicitly i want to handle key events for popup.
    Thanks,
    Raghavendra.

    in my application header part of the page is common of all page. header.jsff contains comandmenuItem named "proceduralhelp". if I click proceduralhelp a pop up opens .
    in my login page when first time I open popup and press escape popup is not closing.
    rest of the cases after login escpe will cose the popup.
    only on the loginpage that to for the first time it is not closing when pressing up on escape key. (then we click on close button. and once again open the popup in loginpage now if we press escape it works).
    Thanks,
    Raghavendra.

  • Handling button events in large app

    I'm currently examining a large swing app, and have observed the following with regard to action events.
    A number of listeners (for buttons, menu items, JLists etc.) are defined at the top of the app. These variously extend MouseAdapter or implement ActionListener, depending on the type of component whose actions they listen for.
    The ButtonListener definition is as follows :
    private class ButtonListener implements ActionListener
    public void actionPerformed(ActionEvent event)
    Object object = event.getSource();
    if (object == button1)
    // button1 actions
    else
    if (object == button2)
    // button2 actions
    .....etc
    One instance of this listener is created in the app, and is used as the actionlistener for each button. This means that the buttonlistener is quite large (as it contains the code for each button in the app).
    Is this the proper way to handle button events for an app with a large number of buttons?

    Thanks for the responses.
    In response to theDude : I agree that defining the action listener for each button can be useful when you can see the button definition and button action in one place; one could counter that by saying that grouping all the button actions makes it easier to examine all button actions in one place.
    Setting the action command isn't really an option because the application creates panels of buttons on the fly, e.g. when notification of a new customer is received, a new panel is created with a JTextPane (customer description) and a row of buttons for "Modify", "Delete" and "Print".
    Several customer panels could be in existence at the same time, so setting an action command of "Modify" would not enable one to uniquely identify which "Modify" button was pressed.
    This problem is currently handled by associating the panel instance with a "Customer" class instance in a hashtable. The "Customer" class consists of a JTextPane field, and a JButton for each function. When a button is pressed, the button listener traverses up the component's parents until it reaches the panel (i.e. it loops until the parent is a key on the hashtable, at which point it can retrieve the Customer instance and check which button was pressed).
    In response to KPSeal : If I understand you, I would define "ApplicationAction" separately from the main app and define extensions of it in the main app for each type of action. Would this add much value over merely defining a method for each type of action in the main app and just calling this method when the relevant button/menu item was pressed/selected?
    There doesn't seem to be a universal approach to event handling, but I thought there might have been one accepted strategy when an app has large numbers of buttons (some created on the fly, ruling out action commands).

  • Handling Button Event

    Hi all,
    i am using a 'When-Validate-item' trigger in this i am doing a validation,
    when user try to enter amount greater than the given amount(This is needed validation)
    and also i am regenerating new lines(Creating new records when button pressed)
    when i am regenerating i should not validate.
    How to handle button event
    Thnx
    Raj

    Hi...
    The WHEN-VALIDATE-ITEM Trigger fires once you updated a field. Be sure you raise
    form_trigger_failure when amount is invalid. So, the cursor stays in field amount. You cant
    leave this field until the amount is not valid.

  • Getting error while creating Service controller from component controller

    Hi,
    I have added CAF model in used model for DC project.But when i m trying to create service controller from component controller by selecting used model it is giving error like "Context element cannot be bound to model layer".
    Can anybody help me out on this issue.
    Thanks in advance.

    Hello,
    try to check the check box in MS Word - File - Options - General - "Open e-mail attachements and other uneditable files in reading view"
    I am not sure how this option really works, but I think you will find it checked. So try to uncheck it.
    Or wise versa :c)
    Kind regards

  • Call a view's method from Component Controller.

    Hi
    Is it possible to call a view's method from Component Controller.
    Regards
    Nikhil

    Hi Tummuru,
    I have created an event in Component Controller by the name toMenuView. Now I created a method in which this event is getting fired. Foll. is the code of the method.
      public void fireToMenuView( )
       wdComponentAPI.getMessageManager().reportSuccess("fireToMenuView");
       wdThis.wdFireEventToMenuView();
    Now I have created an event handler "handleToMenuView" in the MenuView and subscribed the event handler to the event in Component Controller.
    The control is reaching to the fire event in component controller but not to the Event handler in view controller.
    What am I missing.
    Regards
    Nikhil

  • Calling view controller method from component controller method

    Hi,
    Is there any way to call view controller method from component controller method?
    Thanks,

    Hi Khandal.
    You should not make you component controller dependent from a view controller.
    But what you can do is to define an event in the component controller. The view
    controller can register for this event.
    In the stage where you currently want to call the view controller method just fire
    the event. In the event handler method in the view controller you can call the
    method then.
    Why do you need to call a view controller method? Can you give more details
    about the scenario?
    Cheers,
    Sascha

  • Web Dynpro - How to set and get info from Component Controller

    Hi Gurus!!!
    Im having some problems getting and setting info in component controller of my Web Dynpro.
    I can't see the difference between View Context and Global Context.
    How can i create a Global Context Between two views?
    Thanks!
    Regards.
    Polakinho.-

    hii
    difference between view context and global context is we can use the same component controller for all the views in the same application.but when when we create node in view context then it will be available for that view only not for any other view...so if we want to use the same node for all the views we need to create that view in the component controller.so it will become global for that application.
    for using global node you need to map that context in view controller.for that you need to go to that view then click on context tab and drag and drop node from component controller.so it will be available for that view.i hope it helps you.
    regards
    twinkal

  • Mapping from component controller context and view context

    Hi to all experts.
    im trying to create my first webdynpro . Im stuck up here please help me .... How to map the node from component controller context and view context i have searched the forum....got the answers as Drag and Drop...But it is not working ....

    Hi
    Check out this links and check saptechnical site
    WDA in SAP Help
    http://help.sap.com/saphelp_nw2004s/helpdata/en/7c/3545415ea6f523e10000000a155106/frameset.htm
    Web Dynpro for ABAP in SDN
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/webcontent/uuid/512040e1-0901-0010-769c-c238c6ca35d9 [original link is broken]
    Developing ABAP Applications Using Web Dynpro
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/d41b25d2216babe10000000a1553f6/frameset.htm
    Web Dynpro ABAP: Development in Detail
    http://help.sap.com/saphelp_nw2004s/helpdata/en/03/0048413e466e24e10000000a155106/frameset.htm
    WDA Sample programs & tutorials
    https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d
    Web Dynpro ABAP Demonstration Videos
    /people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos
    Web Dynpro ABAP Wiki's
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/wdabap/main&
    New to Webdynpro
    Thanks,
    Tulasi Palnati

  • Call a method in the view from Component Controller

    Hi Friends,
    I have written the code for calling the RFC in Component Controller.
    My requirement is to change the properties of UI elements in the view, if I get any exception while calling RFC.
    Can Call a method in the view from Component Controller.
    Regards,
    Lakshmi Prasad.

    HI,
    You can get the error message during the exception of calling RFC in view itself.
    Any way you may call the RFC at some action in the view only.
    Can you explain me what you are trying to do?
    Kind Regards,
    Mukesh

  • Calling view method from component controller

    Hi Experts,
    How to refer a view method from component controller?

    if you have the view Instance, then you can call using the view instance. But this is not the correct apporach.

  • Handling button events for dialog boxes of a used component

    Hello,
    After I call a dialog box/window for the view of the used component, how can I handle the button events of the window that I called?
    I create the window using the method CREATE_WINDOW_FOR_CMP_USAGE of the interface IF_WD_WINDOW_MANAGER. This method returns window reference of type IF_WD_WINDOW.
    Thanks & Regards,
    Reena

    It's very easy.
    Have a look to the document: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9e242bf5-0901-0010-c99c-83c180163c73
    You will find the SUBSCRIBE_TO_BUTTON_EVENT on page 6.
    Sergio

  • How to fire event in view controller from component controller.

    I have a component usage that fires an event wich i have subscribed in the component controller.
          iv_usage->subscribe_event( iv_event_name = 'TAKE_IT'
                                     iv_handler = me ).
    After the event the method IF_BSP_WD_EVENT_HANDLER~HANDLE_EVENT in the component controller is called.
    method if_bsp_wd_event_handler~handle_event.
    endmethod.
    The usage component is opened as a popup window. After pressing a button, the data is transfered via context node binding to the calling component. But now i want to close the popup.
    My intension is to fire a event for the view controller in the IF_BSP_WD_EVENT_HANDLER~HANDLE_EVENT method that closes the popup.
    Is this possible?
    Or let me explain it this way:
    I want to close a popup after a button in the popup is pressed.
    best regards
    Jürgen

    Hello Juergen
    I am assuming your target pop-up is of type ref to IF_BSP_WD_POPUP.
    1.Make this a view controller class attribute.
    2. After the code to create the pop-up, you can add the following block :
    gv_target_popup->set_on_close_event( iv_view = me iv_event_name = 'CLOSEPOPUP').
    3. Now define event handler EH_ONCLOSEPOPUP where you can write the logic for on_close.
    You can access the same reference gv_target_popup at the event handler level as well.
    Hope this helps.
    Regards
    Nisha

  • Add a note to a Calendar event that was created from Mac Mail

    When I create a Calendar event by clicking on a date within a Mac Mail message (you hover over a date in an email it draws a dashed box around the date and gives an option to create a Calendar event).  It creates an Event in my Calendar with the following fields:  Subject, Location, Date Time and alert fields, Invitees and a link to the mail message.  But - I can't seem to add a Note Field.  The only work-around seems to be to manually create a new calendar entry.
    Does anyone know how to modify an event created from Mac Mail to add a Note Field?
    iMac Retina 5K 27-inch Late 2014, OS X Yosemite Version 10.10.3, Calendar Version 8.0 (2034.9), Mail  Version 8.2 (2098).

    Thanks Brett for replying, but this doesn't work if the event is created by Mac Mail - which is my issue.  Sure it works with any other event but not one that has been created from within Mail.  If this is a bug I'm sure the Calendar people point the blame at the Mail people and vice versa but that doesn't help me.  But before I submit a report to Apple I thought I would see if I might be missing something obvious.
    See the attached screenshot of an event that was created by Mac Mail. There is no Add Notes field when the event is Double Clicked, Right Clicked or any other form of click.
    Graeme.

  • Cannot access Created Context Attribute from Component Controller

    Hello All,
    I have added a new attribute to a node in my component controller 'LOGONUID' and I cannot access it within my windows within the WDA application.
    DATA lo_nd_url_param TYPE REF TO if_wd_context_node.
      DATA ls_workset TYPE wd_this->element_workset.
      "DATA ls_logonuid TYPE wd_this->element_logonuid.
    I get an error as soon as I try to activate this code in my method in my W_MAIN
    In my component controller I do not see it reference in the SAP generated code in my WD_THIS IF_COMPONENTCONTROLLER?
    * Intf.: ig_componentcontroller
    * Purp.: programming interface for access of this controller within
    *        other controllers of the same component
    *        controller:  <COMPONENTCONTROLLER> of
    *        component:   <zhr_wd_mss>
    * UDate: 20111207 145441
    *=====================================================================*
    interface ig_componentcontroller.
      interfaces: ziwci_hr_wd_mss .
      constants:
        wdctx_context type string value `CONTEXT`.
      constants:
        wdctx_cuifcontext type string value `CUIFCONTEXT`.
      types:
        begin of Element_cuifcontext,
          USERID  type String,
          LASTEVENTOPERATION  type String,
        end of Element_cuifcontext,
        Elements_cuifcontext type
           standard table of Element_cuifcontext
           with default key.
      constants:
        wdctx_messages type string value `MESSAGES`.
      types:
        Element_messages type ZHR_S_MESSAGE,
        Elements_messages type
           standard table of Element_messages
           with default key.
      constants:
        wdctx_workset type string value `WORKSET`.
    I want it to be declared as the constant 'WORKSET'
    thank you
    Edited by: Keith Warnock on Dec 7, 2011 8:55 PM
    Edited by: Keith Warnock on Dec 7, 2011 8:56 PM

    > I have added a new attribute to a node in my component controller 'LOGONUID' and I cannot access it within my windows within the WDA application.
    >
    >
    >
    > DATA lo_nd_url_param TYPE REF TO if_wd_context_node.
    >   DATA ls_workset TYPE wd_this->element_workset.
    >   "DATA ls_logonuid TYPE wd_this->element_logonuid.
    >

    >
    This declaration is not right. There is no element logonuid, you  have the attribute inside a node. workset is a node and thats why you can declare that way.
    easiest way is to declate
    data lv_logonuid type <ddic type> or
    data lv_logonuid type wd_this-><node name>-logonuid.
    You can also use the code generator in (CTRL +F7 ) to get/set attributes.

Maybe you are looking for