REUSE_ALV_LIST_DISPLAY- 12

light11Use of ALV LAYOUT- Enabling shortcut key (F2) to display detailed popup window

 

 

 

The previous post REUSE_ALV_LIST_DISPLAY- 11 shows how to adjust the title of detailed popup window. This post shows how to enable shortcut key (F2) to display detailed popup window.

In the overview screen, select a line and then press F2 key and the detailed pop up screen not displayed.

14.jpg


Code Snippet: Enable F2 key to display detailed popup window


———-data declarations——–
TYPE-POOLS: slis.
TYPES: BEGIN OF ty_flight.
INCLUDE STRUCTURE spfli.
TYPES: END OF ty_flight.
DATA: lt_spfli TYPE TABLE OF ty_flight.
DATA: ls_spfli TYPE ty_flight.
DATA: ls_layout TYPE slis_layout_alv.
———————————–

START-OF-SELECTION.
PERFORM build_data.
PERFORM build_layout.
PERFORM display_list_alv.

&————————————————-
& Form BUILD_DATA
&————————————————-
FORM build_data.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE lt_spfli.
ENDFORM. ” BUILD_DATA
&————————————————–
& Form BUILD_LAYOUT
&————————————————–
FORM build_layout.
ls_layout-zebra = ‘X’.
ls_layout-detail_popup = ‘X’.
ls_layout-detail_titlebar = ‘Detailed Flight Info’.
ls_layout-f2code = ‘&ETA’.        ” provide the function code to activate F2 key
ENDFORM. ” BUILD_LAYOUT
&—————————————————
& Form DISPLAY_LIST_ALV
&—————————————————-*
FORM display_list_alv.
CALL FUNCTION ‘REUSE_ALV_LIST_DISPLAY’
EXPORTING
i_callback_program = sy-cprog
i_structure_name = ‘SPFLI’
is_layout = ls_layout
TABLES
t_outtab = lt_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE ‘Program Error’ TYPE ‘I’.
WHEN OTHERS.
ENDCASE.
ENDFORM. ” DISPLAY_LIST_ALV


Program Output:

15.jpg


 

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s