cancel
Showing results for 
Search instead for 
Did you mean: 

Display Pop up for each entry in loop in WebUI

Former Member
0 Kudos

Hello,

My current requirement is that I have one internal table and for each entry in internal table I need to fetch some entries from different table and display that using decision_popup in WebUI.

I have added the code to display Pop up under Loop..Endloop.  System only displays Pop up for last entry.

Please guide me how can I achieve this requirement.

Thanks,

Nishad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nishad,

What coding did you do inside LOOP...ENDLOOP? can you please post that.

Former Member
0 Kudos

Hi Pratheek,

Inside Loop..Endloop I have added code to display decision popup.

Loop..

gr_dec_popup ?=

    comp_controller->window_manager->create_decision_popup ( have passed Title & Internal table )

call method gr_dec_popup->set_on_close_event

      EXPORTING

        iv_view       = me

        iv_event_name = 'POPUP_SELECT'.

*   Open the pop-up

    CALL METHOD gr_dec_popup->open.

endloop.

**EH_ONPOPUP_SELECT method contains the code for which line selected and based on that I am setting value and then Close the popup.

I am getting popup for only last internal record.

Please let me know if you need more details.

Thanks,

Nishad

Former Member
0 Kudos

Hi!

In the view controller you have to create a new attribute to store your initial internal table and an attribute for your internal table size and a counter . Then in the code where you are call the popup windows inside the loop, you have to do the following.

1. At the first run you should count your internal table entries. Store it to lv_iter_tab_size.

2. Inicialize your lv_counter with 1.

2. Then call the popup.

3. Register an event handler (LOOP_EVENT) for the pop up close.

In the EH_LOOP_EVENT create a while statement. In the while statement :

while lv_counter <> lv_iter_tab_size.

  read table lt_iter into ls_iter index lv_counter.

  lv_counter = lv_counter + 1.

gr_dec_popup ?=

    comp_controller->window_manager->create_decision_popup ( have passed Title & Internal table )

call method gr_dec_popup->set_on_close_event

      EXPORTING

        iv_view       = me

        iv_event_name = 'LOOP_EVENT'.

*   Open the pop-up

    CALL METHOD gr_dec_popup->open.

endwhile.

So do a recursive call for the LOOP_EVENT event.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Nishad,

You can use the following code to resolve this problem,

proctype_popup = comp_controller->window_manager->create_popup(

                 iv_interface_view_name = 'Interface Name'
                 iv_usage_name = 'usage name'
                 iv_title = 'Title of Component' ).


DATA lr_ctxt_node TYPE REF TO cl_bsp_wd_context_node.
   DATA: lw_url_params TYPE ITAB.
   DATA: lr_struct_ref TYPE REF TO LIKE.


   LOOP AT lt_like INTO LS_LIKE.
     CREATE DATA lr_line_ref_comment.
     CREATE OBJECT lr_value_node_comment
       EXPORTING
         iv_data_ref = lr_line_ref_comment.
     lr_value_node_comment->set_properties( LS_LIKE ).
     lr_ctxt_node ?= proctype_popup->get_context_node( iv_cnode_name = 'POPTYPE'   ).
     lr_ctxt_node->collection_wrapper->add( lr_value_node_comment ).
   ENDLOOP.

Thanks


Former Member
0 Kudos

Hi Nammi,

Actually I have used method create_decision_popup , so can you please let me know if I can modify anything in this. If not possible I would definitely go for the option provided by you.

Inside Loop..Endloop I have added code to display decision popup.

Loop..

gr_dec_popup ?=

    comp_controller->window_manager->create_decision_popup ( have passed Title & Internal table )

call method gr_dec_popup->set_on_close_event

      EXPORTING

        iv_view       = me

        iv_event_name = 'POPUP_SELECT'.

*   Open the pop-up

    CALL METHOD gr_dec_popup->open.

endloop.

**EH_ONPOPUP_SELECT method contains the code for which line selected and based on that I am setting value and then Close the popup.

I am getting popup for only last internal record.

Thanks,

Nishad

praveen_kumar194
Active Contributor
0 Kudos

you can try it in the below way. here key point is event handler that raised the popup and the even handler that is triggered when popup closes , is the same.

gt_data , count, var are instance variables of class. var is having initial value as 1.

user will receive popup for each record in the internal table as soon as all records are visited, popup will be closed. you can change the code accordingly if you need any correction.

    IF gt_data IS INITIAL.


    SELECT * FROM zdoctor INTO CORRESPONDING FIELDS OF TABLE gt_data.

    count = lines( gt_data ).

  ENDIF.


  DATA: lr_pop TYPE REF TO if_bsp_wd_popup,
        ls_data LIKE LINE OF gt_data,
        lt_data LIKE gt_data.





    READ TABLE gt_data INTO ls_data INDEX var.
    IF sy-subrc IS INITIAL.


      CLEAR lt_data.
      APPEND ls_data TO lt_data.

      CALL METHOD me->comp_controller->window_manager->create_decision_popup
        EXPORTING
          iv_title             = 'doctor details'
*         iv_description       =
*         iv_table_header_text =
*         iv_selection_mode    = 'SINGLESELECT'
*         iv_visible_row_count = 3
          iv_display_table     = lt_data
*         iv_visible_columns   =
*         iv_create_table_copy = ABAP_TRUE
        RECEIVING
          rv_result            = lr_pop.


      CALL METHOD lr_pop->set_on_close_event
        EXPORTING
          iv_view       = me
          iv_event_name = 'search'.

      lr_pop->open( ).


    ELSE.

      RETURN.
    ENDIF.


    "reduce the count.

    var = var + 1.



  IF var > count.

    return.

  ENDIF.