cancel
Showing results for 
Search instead for 
Did you mean: 

Open popup by POWL event/action

Former Member
0 Kudos

Hallo experts,

i got the requirement to select multiple lines in a powl query and delete them by clicking a button. For every line which is selected, a popup should appear. If the user presses "Yes" some more coding should be done (checks and deletion when check positive).

Any ideas for the best solution?

Best regards,

Philip

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Solved by enhancing WD component. The solution Rohit suggested does not work in my case. But thanks for your answer 🙂

Best regards,

Philip

smacli
Discoverer
0 Kudos

How did you add the WD component?

Former Member
0 Kudos

Hello Philp,

POWL provide the inbuilt method in feeder for this purpose and you should use that.

IF_POWL_FEEDER~GET_ACTION_CONF

example code

  IF i_actionid = 'CREATE'.

      APPEND 'Do you really want to create ?' TO e_conf_message.

    ENDIF.

This method will take care of pop-up creation etc.

Please find more information in http://wiki.sdn.sap.com/wiki/display/WDABAP/Documentation+Information+about+POWL

Best regards,

Rohit

Former Member
0 Kudos

Hello Philip,

Get the selected items from the POWL from the context as follows :

DATA : lrcl_node TYPE REF TO if_wd_context_node,

          lt_elements TYPE WDR_CONTEXT_ELEMENT_SET,

          lv_lines TYPE i,

          ls_table TYPE ig_componentcontroller=>element_table,

          lt_table like TABLE OF ls_table.

   FIELD-SYMBOLS <fs_element> like LINE OF lt_elements.

* Get the selected elements for the context

   lrcl_node = wd_context->get_child_node('TABLE').

   lt_elements = lrcl_node->get_selected_elements(

*      including_lead_selection = ABAP_FALSE

          ).

* Retreive the lines from the elements

   LOOP AT lt_elements ASSIGNING <fs_element>.

     <fs_element>->get_static_attributes( IMPORTING static_attributes = ls_table ).

     APPEND ls_table to lt_table.

   ENDLOOP.

Now you can loop over the selected items lt_table and call a popup_to_confirm.

Create a view for the popup and embed it in a new window 'WDW_POPUP'

DATA: context_node TYPE REF TO if_wd_context_node,

         lrcl_popup TYPE REF TO if_wd_window,

         lrcl_view_controller TYPE REF TO if_wd_view_controller,

         lrcl_api_comp_controller TYPE REF TO if_wd_component,

         lrcl_window_manager TYPE REF TO if_wd_window_manager.

   lrcl_api_comp_controller = wd_comp_controller->wd_get_api( ).

   lrcl_window_manager = lrcl_api_comp_controller->get_window_manager( ).

   lrcl_popup = lrcl_window_manager->create_window(

   modal               = abap_true

   window_name         = 'WDW_POPUP'  "Name of the window

   title               = 'Please confirm Deletion'

   close_button        = abap_true

   button_kind         = if_wd_window=>co_buttons_yesno

   message_type        = if_wd_window=>co_msg_type_error

   close_in_any_case   = abap_true

*MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE

   ).

   lrcl_view_controller = wd_this->wd_get_api( ).

   lrcl_popup->subscribe_to_button_event(

       button            = 7

*      button_text       =

*      tooltip           =

       action_name       = 'CONFIRM'

       action_view       = lrcl_view_controller

*      is_default_button = ABAP_FALSE

          ).

lrcl_popup->open( ).

This will create the popup to confirm for each entry ine the table of selections.

Now create an Action 'CONFIRM' in the main view and add the code to delete the entry

(checks and deletion when check positive).

Good Luck,

Kiron