Skip to Content
avatar image
Former Member

message with ok button

Hi,

i have a main window and pop-up window, based on a click on first screen iam displaying the pop-up message with ok button.now when i will click on ok button that perticular records in alv of the first screen have to get released.and that status have to be updated in the corresponding table.for this we have bapi now once i click on ok then i need to call the bapi which can update the table.

so please let me know the views...........

Inadvance,

thanks

satti

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 11, 2009 at 11:36 AM

    Hi Satish,

    You need to subscribe to the OK button of your popup and create an event handler for the same. So in other words this method would get triggered when you click up on the button. Within this method you can call your BAPI and pass the information pertaining to the desired row. Below is how you subscribe to the OK button of your popup. In this snippet I am specifying that up on clicking my popups OK button I would like to trigger the action ON_ACTION. So you would also have to keep in mind to create this action in the "Actions" tab of your view or else you would end up in a runtime error saying that the specified action does not exist. And yes its not possible to create actions dynamically. You would have to do them statically at design time itself.

    Regards,

    Uday

    * Popup
      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.
     
      lo_api_component  = wd_comp_controller->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
      lo_window         = lo_window_manager->create_window(
        window_name          = 'W_POPUP' " your window name 
        message_display_mode = if_wd_window=>co_msg_display_mode_selected
        button_kind          = if_wd_window=>co_buttons_ok
        message_type         = if_wd_window=>co_msg_type_none
        default_button       = if_wd_window=>co_button_ok
        ).
      DATA:  l_api TYPE REF TO if_wd_view_controller.
     
      l_api = wd_this->wd_get_api( ).
     
      lo_window->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_ok
                   action_name       = 'ON_OK
                   action_view       = l_api
                   is_default_button = abap_true ).
     
      lo_window->open( ).

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Check in St22 for more on error details.

      In the BUTTON handler i guess you are opening a popup right.

      Create a view attribute lr_window type ref to if_wd_window.

      *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.
      *
      LO_API_COMPONENT = WD_COMP_CONTROLLER->WD_GET_API( ).
      LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).
      LO_WINDOW = LO_WINDOW_MANAGER->CREATE_WINDOW(
      WINDOW_NAME = 'POPUP_WINDOW'
      title = 'ST'
      close_in_any_case = abap_true
      MESSAGE_DISPLAY_MODE = IF_WD_WINDOW=>CO_MSG_DISPLAY_MODE_SELECTED
      close_button = abap_true
      BUTTON_KIND = IF_WD_WINDOW=>CO_BUTTONS_OKCANCEL
      MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_NONE
      DEFAULT_BUTTON = IF_WD_WINDOW=>CO_BUTTON_OK
      ).
      
      Implement ACTION CANCEL ire using SUBSCRIBE method. "Refer UDAY's code
       
      wd_this->lr_window = lo_window. -----------global to view
      LO_WINDOW->OPEN( ).*

      In the CANCEL button.

      if wd_this->lr_window is not initial.

      call method wd_this->lr_winodw.close.

      endif.

      Regards,

      Lekha.

  • Aug 11, 2009 at 11:34 AM

    Hi,

    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 `Message which you wanna display.` into table l_text. 
     
      l_popup = l_window_manager->create_popup_to_confirm(
                    text            = l_text
                    button_kind     = if_wd_window=>co_buttons_ok
                    message_type    = if_wd_window=>co_msg_type_information
                    window_title    = 'Title of the window'
                    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_ok
                   action_name       = 'OK'
                   action_view       = l_api
                   is_default_button = abap_true ).
     
      l_popup->open( ).

    In the onAction of OK write your code to display table.

    Regards,

    Rohit

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Satish,

      I guess you didnt even completely go through what I had written earlier. I had clearly said in there that you would need to go to your "Actions" tab and create an action in there and that you would otherwise end up in an error. Paying close attention to your threads replies would not only mean respecting others time but also ensure faster solutions for yourself. Am once again pasting what I had said in my first posting...

      "In this snippet I am specifying that up on clicking my popups OK button I would like to trigger the action ON_ACTION. So you would also have to keep in mind to create this action in the "Actions" tab of your view or else you would end up in a runtime error saying that the specified action does not exist. And yes its not possible to create actions dynamically. You would have to do them statically at design time itself."

      Regards,

      Uday