Open popup window on double click of particular record in ALV display | Techbirds

Posted on: December 16, 2013 /

Categories: ABAP / Author Name: Ankit Shukla

Hi Everyone ,

I am going to provide a solution for particular task by explaining each step in details.

TASK : Design a Alv report to display all records of employee table by using  ‘GRID DISPLAY’ .but

The main task is “On clicking of particular record a popup window will open and shows the selected record details “.

REPORT zalv_test.

TYPE-POOLS slis .  “pool table used for alv grid display“

DATA : alv_prg_name LIKE sy-repid. “ it stores the program name “
alv_prg_name = sy-repid .

DATA : alv_itab_name(30), wa TYPE slis_fieldcat_alv , l_fieldcat TYPE slis_t_fieldcat_alv,

it_layout TYPE slis_layout_alv.

DATA : lt_emp TYPE TABLE OF zemployee , “define internal table of employee“ lt_emp_temp LIKE lt_emp, “ define temporary internal table “

ls_emp TYPE zemployee . “ define work area for single record storage”

START-OF-SELECTION.

SELECT * FROM zemployee INTO TABLE  lt_emp UP TO 10 ROWS WHERE emp_name = emp_name  .  “only up to 10 top records will store in internal table“
alv_itab_name = ‘LT_EMP’.  “Write here the name of your internal table”

it_layout-zebra = ‘X’.

it_layout-colwidth_optimize = ‘X’.

  • “This layout is to fixed or optimize column width  according to column       name length .CALL FUNCTION ‘REUSE_ALV_FIELDCATALOG_MERGE’ EXPORTING i_program_name         = alv_prg_name  “ program name “ *     I_INTERNAL_TABNAME     = ALV_ITAB_NAME i_structure_name       = ‘ZEMPLOYEE’ *     I_CLIENT_NEVER_DISPLAY = ‘X’ *     I_INCLNAME             = *     I_BYPASSING_BUFFER     = *     I_BUFFER_ACTIVE        = CHANGING ct_fieldcat            = l_fieldcat EXCEPTIONS inconsistent_interface = 1 program_error          = 2 OTHERS                 = 3. IF sy-subrc  0. * Implement suitable error handling hereENDIF.
  • This field catalog can only be use when structure (eg : zemployee) is already defined in data dictionary .
  • All the parameters that are passed as a value in single quotes are always in capital letters.

CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’ EXPORTING *   I_INTERFACE_CHECK                 = ‘ ‘ *   I_BYPASSING_BUFFER                = ‘ ‘ *   I_BUFFER_ACTIVE                   = ‘ ‘ i_callback_program               = alv_prg_name *   I_CALLBACK_PF_STATUS_SET          = ‘ ‘ i_callback_user_command           = ‘USER_COMMAND’ *   I_CALLBACK_TOP_OF_PAGE            = ‘ ‘ *   I_CALLBACK_HTML_TOP_OF_PAGE       = ‘ ‘ *   I_CALLBACK_HTML_END_OF_LIST       = ‘ ‘ *   I_STRUCTURE_NAME                  = *   I_BACKGROUND_ID                   = ‘ ‘ i_grid_title                       = ‘EMPLOYEE INFORMATION SYSTEM’ *   I_GRID_SETTINGS                   = is_layout                          = it_layout it_fieldcat                      = l_fieldcat *   IT_EXCLUDING                      = *   IT_SPECIAL_GROUPS                 = *   IT_SORT                           = *   IT_FILTER                         = *   IS_SEL_HIDE                       = *   I_DEFAULT                         = ‘X’ *   I_SAVE                            = ‘ ‘ *   IS_VARIANT                        = *   IT_EVENTS                         = *   IT_EVENT_EXIT                     = *   IS_PRINT                          = *   IS_REPREP_ID                      = *   I_SCREEN_START_COLUMN             = 0 *   I_SCREEN_START_LINE               = 0 *   I_SCREEN_END_COLUMN               = 0 *   I_SCREEN_END_LINE                 = 0 *   I_HTML_HEIGHT_TOP                 = 0 *   I_HTML_HEIGHT_END                 = 0 *   IT_ALV_GRAPHICS                   = *   IT_HYPERLINK                      = *   IT_ADD_FIELDCAT                   = *   IT_EXCEPT_QINFO                   = *   IR_SALV_FULLSCREEN_ADAPTER        = * IMPORTING *   E_EXIT_CAUSED_BY_CALLER           = *   ES_EXIT_CAUSED_BY_USER            = TABLES t_outtab                        = lt_emp[] EXCEPTIONS program_error                     = 1 OTHERS                            = 2 . IF sy-subrc  0. * Implement suitable error handling here

ENDIF.

  • This  ‘REUSE _ALV_GRID_DISPLAY’   will  only display 10 records of employee table  and

On clicking or selecting the particular record form ‘USER_COMMAND’  will call .

  • So need to put logic for popup window display of details in form ‘USER_COMMAND’.

FORM user_command USING r_ucomm TYPE sy-ucomm rs_selfield TYPE slis_selfield . CASE r_ucomm. WHEN ‘&IC1′. CLEAR ls_emp. *      READ TABLE LT_EMP INDEX RS_SELFIELD-TABINDEX INTO LS_EMP. READ TABLE lt_emp INTO ls_emp INDEX rs_selfield-tabindex. CLEAR : lt_emp_temp .

APPEND ls_emp TO lt_emp_temp.

CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING

i_grid_title                       = ‘EMPLOYEE INDIVIDUAL INFORMATION SYSTEM ‘ *   I_GRID_SETTINGS                   = is_layout                          = it_layout

it_fieldcat                      = l_fieldcat

i_screen_start_column             = 10    “for creating a window popup

i_screen_start_line               = 30 i_screen_end_column               = 100

i_screen_end_line                 = 40

TABLES t_outtab                        = lt_emp_temp[] EXCEPTIONS program_error                     = 1 OTHERS                            = 2 . IF sy-subrc  0. * Implement suitable error handling here

ENDIF.

ENDCASE.
ENDFORM.                    “USER_COMMAND

  • On double click on particular record the SY-UCOMM value set to ‘&IC1′. And can access the particular index in internal table by rs_selfield-tabindex.
  • i_screen_start_column             = 10    “for creating a window popup

i_screen_start_line               = 30 i_screen_end_column               = 100

i_screen_end_line                 = 40

These four parameters will decide the dimensions of pop-up window.

So this is the approach through which you can display records with pop-up window  .

7,210 total views, 5 views today

Share this Onfacebook-8562188twitter-4355071linkedin-4922800google-6987788