Using popup in Component controller

Experts,
I would like to use the create_popup_to_confirm method in component controller so i could reuse them in other views. The problem i have is the "subscription to the button event". I am assuming the subscription should be done at the view level but how do i link it to the "button_kind" which is at the controller level ?
Thanks
ASujo

For the susbscribe to button event  action should be aexisting in one view. and that you need to assign.
you can assign it in comp controller also.
but actions you have to create in the view.
and for reusing the function for creating pop up, create some parameter in it
like 1. for view controller
      2. for action names.
then assign the buttons to the events using these paramters.
thanks
sarbjeet singh

Similar Messages

  • 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

  • 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

  • Subcribe to popup box button in component controller

    Hi all,
    Normally I used popup box in view controller. No, due to the program flow, I have to do it in component controller instead. Refer to my codes below, how do I subscribe to the popup box button? There is no action tab in component controller. How?
    DATA lo_window_manager  TYPE REF TO if_wd_window_manager.
      DATA lo_api_component   TYPE REF TO if_wd_component.
      DATA lo_window          TYPE REF TO if_wd_window.
      DATA lr_view_controller TYPE REF TO if_wd_view_controller.
      DATA lt_message TYPE string_table.
      DATA lw_message TYPE string.
      CLEAR lt_message.
      CONCATENATE 'Username' sy-uname 'is currently logging on the system. Do you want to continue?'
      INTO lw_message SEPARATED BY space.
      APPEND lw_message TO lt_message.
      CLEAR lw_message.
      lo_api_component  = wd_this->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
      CALL METHOD lo_window_manager->create_popup_to_confirm
      EXPORTING
        text                 = lt_message
        button_kind          = if_wd_window=>co_buttons_yesno
        message_type         = if_wd_window=>co_msg_type_none
       CLOSE_BUTTON         = ABAP_TRUE
        window_title         = 'Confirmation'
       WINDOW_LEFT_POSITION =
       WINDOW_TOP_POSITION  =
       WINDOW_POSITION      =
       WINDOW_WIDTH         = '10'
       WINDOW_HEIGHT        = '10'
        default_button       = if_wd_window=>co_button_no
      RECEIVING
        result               = lo_window.
    Adds an action to the popup screen buttons
    lr_view_controller = wd_this->wd_get_api( ).
      wd_this->wd_get_api( ).
      lo_window->subscribe_to_button_event(
      button = if_wd_window=>co_button_yes
      button_text = 'Yes'
      action_name = 'SUBMIT_YES_DUPLICATE'
      action_view = lr_view_controller ).
      lo_window->subscribe_to_button_event(
      button = if_wd_window=>co_button_no
      button_text = 'No'
      action_name = 'SUBMIT_NO_DUPLICATE'
      action_view = lr_view_controller ).
    open window
      lo_window->open( ).

    hi, Siong:
    You just want to Subscribe to your buttons in Pop-up, just like "YES","NO"...
    In fact, you can subscribe these buttons in COMPONENT CONTROLLER...
    Because, you use the "Confirmation Pop-up" named "popup_to_confirm" which is one attribute of "Window" when you use "Confirmation Pop-up"...
    Here, the coding is not as you wrote :
    lo_window->subscribe_to_button_event(
    button = if_wd_window=>co_button_no
    button_text = 'No'
    action_name = 'SUBMIT_NO_DUPLICATE'
    action_view = lr_view_controller ).
    Instead, use the following:
    lo_window->popup_to_confirm->subscribe_to_button_event(
                controller         = lo_api_component
                handler_name       = 'HNDL_SAVE_YES'
                button             = if_wd_window=>co_button_yes
                tooltip            = 'Yes' ).
    Now, you can add the event handler "HNDL_SAVE_YE" in your component controller...
    Best wishes.

  • What is the use of Component Controller in WD4A

    Hey Folks,
                   I have been reading tutorials and notes on WD4A.I understood basic architecture of WD4A but still i cant understand details of different Controllers like components controller,custom controllers,interface controllers etc.In which methods of controller i should code??.

    Hi Nirad,
    Controllers are heart of WebDynpro Components, since programming logic and data are defined in these entities.
    For example: ComponentController is accessible from all the views and windows in the WebDynpro Component. Hence we can declare the Attributes, context and the methods in the component controller which can be accessible in all the other controllers present in the WebDynpro Component.
    You can also find more information about controllers in the thread:
    Re: Controllers
    Best regards,
    Suresh
    Message was edited by:
            Suresh Honnappanavar

  • Component controller being used instead of cust controllers

    Hi masters
    I have to maintain an application developed by another consultant. He put all the business logic, all the methods etc inside de component controller instead of create cust controllers, is it a problem ?

    which best practice says that?
    following is from JA310 training material.
    >Before implementing a custom controller, consider carefully whether its presence will simplify or
    >complicate the overall architecture of your application. Custom controllers should only be added in
    >situations that will optimize or simplify the architecture of your application.

  • Inheritance component controller

    Hi all!
    Usually I use my methods of component controller(like work with popup or display messages) in every WD component.
    After create new WD component I copy my methods from another controller to current.
    How can I call methods from "parent" component controller in current like in OO?

    You can create an interface component if you have many children components which you to have a similar interface.  This is probably as close to OO style inheritance you can get with Web Dynpro Components.  You can't have direct parent/child style class inheritance in WD Components.  Perhaps these methods should be in a normal ABAP class and used via the Assistance Class or directly within the controller. That way you could use full class inheritance.

  • Call a component controller methods from a view

    Hi,
    I have created a view v1 with context node c1and binded the context node c1 of it with the component controller so that the values entered in the view v1 are available.
    now can i know how to access this values from component controller context node which i binded in a other view......
    Thanks,
    Prem

    Hi Sayan,
    component : BP_HEAD
    View: BP_HEAD/BPHeadOverview
    I have called event EH_ONPOPUP_CLOSED when popup is closed in view BP_HEAD/BPHeadOverview and i get all the values entered in the popup here using below code.
           lr_context_node = gr_popup->get_context_node( iv_cnode_name = 'ZPOPUPCN' ).
           lr_col_wrapper = lr_context_node->collection_wrapper.
           lr_entity = lr_col_wrapper->get_current( ).
           IF lr_entity IS BOUND.
             lr_entity->get_properties( IMPORTING es_attributes = ls_data ).
           ENDIF.
    now ls_data contains all the data entered in the popup ie. - firstname, lastname, house_no, street, city, postal code, country.....
    now it have tried the below code to map/set the entries with the Account management - individual account creation screen.
    data : ls_header         TYPE crmst_header_object_buil,        " BuilHeader
              ls_header1        TYPE crmst_address_buil,                 " BuilStandardAddress
           ls_header-firstname     = ls_data-zfirstname.
           ls_header-lastname      = ls_data-zlastname.   
           ls_header1-house_no     = ls_data-zhouseno.  
           ls_header1-street       = ls_data-zstreet.      
           ls_header1-city         = ls_data-zcity.        
           ls_header1-postl_cod1   = ls_data-zpostcode.    
           ls_header1-country      = ls_data-zcountry.   
           ls_header1-telephonetel = ls_data-ztelno.        
           ls_header1-e_mailsmt    = ls_data-zemail.
           entity ?= me->typed_context->builheader->collection_wrapper->get_current( ).
           IF entity IS BOUND.
             entity->set_properties( EXPORTING is_attributes = ls_header ).
           ENDIF.
           entity1 ?= me->typed_context-> BuilStandardAddress->collection_wrapper->get_current( ).
           IF entity IS BOUND.
             entity1->set_properties( EXPORTING is_attributes = ls_header1 ).
           ENDIF.
    but the problem is both the entity is INITIAL.

  • ConfirmationDialog in Component Controller

    Hi,
    Is it possible to popup the confirmation dialog in the Component controller code.
    I have used to the following code to display in view controller.
    **String dialogText=" Test Message";**
    **IWDControllerInfo controllerInfo =wdControllerAPI.getViewInfo().getViewController();**
    **IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,**
    ***                                   controllerInfo.findInEventHandlers("onActionOK"),"OK");***
    I have a requirment to display the Confirmation dialog in component controller.
    Please let me know if it is possible to achieve the same. Paste the API code as well.
    Thanks and Regards,
    Sekar

    Hi ,
    I have found the code/API for this.
    String dialogText="";
    String confirmNo="12345";
    IWDControllerInfo controllerInfo =wdControllerAPI.getComponentInfo().findInControllers("ConfirmComp");
    *dialogText = "Test"          *
    IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,
    *                                             controllerInfo.findInEventHandlers("OK"),"OK");*
    *          dialog.show();*     
    Regards,
    Sekar

  • 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

  • To fetch data from a standard component through Component Controller

    Hi,
    I have a requirement in which i have to access and display a standard view of a standard component in a Custom Component.
    I am able to display or configure that view on Custom Component by using Component Usage and Component Interface. But unable to populate the data in that view. Although i have exposed a context node in the standard component and created the same context node in my custom component in the Component Controller and using its method WD_USAGE_INITIALIZE to bind them.Please, provide some pointers on it.
    Cheers,
    Sharad

    Hi Sharad,
               The data will show up only if you put them there. May be the standard component itself gets the data from some where else. Usually, these data are provided by the component controller. For example, the component controller contains the header entity and the used component has access to the header entity via binding and shows all item entries fetched via relations(usually this is done in on_new_focus method). If the binding is there, but no data ia available, it will stay empty.
             Check a standard main component which uses the standard component that you are using and look at how they are establishing the connections.( component/custom controller bindings, on_new_focus methods,,)
    Regards,
    Arun Prakash

  • Calling a method in view from component controller?

    Hi,
    Is it posible to call a method that is defined in the Component Controller in the View?
    If it is posible please give some sample code how to call the method?
    Regards,
    Padmalatha.K

    Padmalatha, all the methods defined in a controller from 'Methods' tab are instance methods. An instance method defined in a component controller is callable from any view controller that holds a reference to the component controller.
    Defining methods between the tags
    //@@begin others
    //@@end
    is useful if you want to declare static methods.

  • Calling a method in the view controller from the component controller

    Hi
    Is there anyway to call a method in the view implementation from the component controller??
    Thanks
    jack

    Thanks for all your replies. I want this kind of a functionality because Im trying to invove a DC (Child DC) from a Parent DC such that the Child DC's view is displayed onto the view container of the Parent DC. I have embedded using 'interface view of a component instance' in the Parent Window and am able to create the component and set usage though the onPlugDefault of the Child View.
    But I observe that when i make a call from the parent, the flow is like this:
    1. The wdDoInit of the Child Component Controller gets triggered first.
    2. Then the wdDoInit of the Child's <b>VIEW</b> gets triggered
    3. and <b>THEN</b> the onPlugDefault of the Child Component Interface View
    What I had actually wanted was to Fire onPlugDefault where Im calling a method LoadData(), after which the Child DC's view must be triggered so it can display the fetched data.
    What is actually happening is the view gets displayed, but no data is displayed in the view.
    Right now I have just given a work around where Im triggering <b>LoadData()</b> of the <b>COmponent COntroller</b> from the <b>wdDoInit</b> of the <b>VIEW</b>.
    Is there a better way to do this? I find it strange that I have to load the Data from the view.
    Thanks
    Jack

  • Issue in Binding Custom controller to Component Controller

    Dear All,
    I have enhanced a standard component ERP_H.
    I created a custom controller with context nodes BTSTATUS, BTSTATUSH
    I enhanced the component controller with context node BTSTATUS, BTSTATUSH
    Now when i try to bind the custom controller to component controller using this code in the context class of my custom controller
    bind to component controller
      owner->do_context_node_binding(
               iv_controller_type = CL_BSP_WD_CONTROLLER=>CO_TYPE_COMPONENT
               iv_target_node_name = 'BTSTATUS'  " component controller context node
               iv_node_2_bind = BTStatus ).
    its not working since this context node in component controller is not the standard one but the custom added one.
    Am i missing something, or is there any way to bind customer context node in custom controller to customer context node in component controller.
    regards,
    pradeep

    Hi pradeep,
        Try the other way round go to the context class in the component controller and paste the following code in the
    create_contextnode( context node = name of the node to be linked).
    *owner->do_context_node_binding(
            iv_controller_type = cl_bsp_wd_controller=>co_type_custom   <-----linking from component to custom
            iv_target_node_name = 'BUILHEADER' "target node: component controller node
            iv_node_2_bind = BUILHEADER ). "source node: current node.
    See if this works.
    Thanks

  • Declaring and accessing custom global attributes of component controller

    Hi,
    I want to declare some global attributes for Component Controller and initialize them in WdDoInit() method.
    I have declared them under Component Controller --> Attributes tab --> after wd_context and wd_this (say G_MESSAGE).
    However,  when I am trying to set them in wdDoInit() method, I get compilation error saying G_MYMESSAGE is unknown and its not defined using data statement.
    How do I access these attributes?
    Thanks and regards,
    Amey

    Hello Amey,
    You need to access the variable by "wd_this->g_mymessage"
    Since wd_this attribute in each controller refers to interface of local controller. you could read the description of that attribute in attribute tab.
    Regards
    Anurag Chopra

Maybe you are looking for