ALV popup based on classic style REUSE_ALV_POPUP_TO_SELECT function module
This is sample ALV popup based on REUSE_ALV_POPUP_TO_SELECT function module (classic style).
It includes only buttons for ENTER and CANCEL to make this dialog simple for a user.
Other buttons related to ALV standard functions are excluded.
Here the sample popup:
and the related coding:
REPORT zkm_test.
TYPE-POOLS:
slis.
PERFORM display_popup.
FORM display_popup.
DATA:
BEGIN OF ls_popup,
text(60) TYPE c,
END OF ls_popup,
lt_popup LIKE TABLE OF ls_popup,
lt_fcat TYPE slis_t_fieldcat_alv,
ls_fcat TYPE slis_fieldcat_alv,
lt_excl TYPE slis_t_extab,
ls_excl TYPE slis_extab,
lv_exit TYPE c.
ls_popup-text = 'First line'. APPEND ls_popup TO lt_popup.
ls_popup-text = 'Second line'. APPEND ls_popup TO lt_popup.
ls_popup-text = 'Third line'. APPEND ls_popup TO lt_popup.
ls_fcat-col_pos = 1.
ls_fcat-fieldname = 'TEXT'.
ls_fcat-outputlen = 60.
ls_fcat-seltext_m = 'Title of the table'.
APPEND ls_fcat TO lt_fcat.
ls_excl-fcode = '&ETA'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '%SC'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '%SC+'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&OUP'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&ODN'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&ILT'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&OL0'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRB'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRL'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRR'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRE'. APPEND ls_excl TO lt_excl.
* ls_excl-fcode = '&AC1'. APPEND ls_excl TO lt_excl. " cancel
ls_excl-fcode = '&ALL'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&SAL'. APPEND ls_excl TO lt_excl.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Title of the popup'
i_selection = ''
i_screen_start_column = 1
i_screen_start_line = 1
i_screen_end_column = 62
i_screen_end_line = 10
i_tabname = 'LT_POPUP'
it_fieldcat = lt_fcat
it_excluding = lt_excl
IMPORTING
e_exit = lv_exit
TABLES
t_outtab = lt_popup.
IF lv_exit = 'X'.
* cancel
ELSE.
* do action
ENDIF.
ENDFORM.
TYPE-POOLS:
slis.
PERFORM display_popup.
FORM display_popup.
DATA:
BEGIN OF ls_popup,
text(60) TYPE c,
END OF ls_popup,
lt_popup LIKE TABLE OF ls_popup,
lt_fcat TYPE slis_t_fieldcat_alv,
ls_fcat TYPE slis_fieldcat_alv,
lt_excl TYPE slis_t_extab,
ls_excl TYPE slis_extab,
lv_exit TYPE c.
ls_popup-text = 'First line'. APPEND ls_popup TO lt_popup.
ls_popup-text = 'Second line'. APPEND ls_popup TO lt_popup.
ls_popup-text = 'Third line'. APPEND ls_popup TO lt_popup.
ls_fcat-col_pos = 1.
ls_fcat-fieldname = 'TEXT'.
ls_fcat-outputlen = 60.
ls_fcat-seltext_m = 'Title of the table'.
APPEND ls_fcat TO lt_fcat.
ls_excl-fcode = '&ETA'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '%SC'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '%SC+'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&OUP'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&ODN'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&ILT'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&OL0'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRB'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRL'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRR'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&CRE'. APPEND ls_excl TO lt_excl.
* ls_excl-fcode = '&AC1'. APPEND ls_excl TO lt_excl. " cancel
ls_excl-fcode = '&ALL'. APPEND ls_excl TO lt_excl.
ls_excl-fcode = '&SAL'. APPEND ls_excl TO lt_excl.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Title of the popup'
i_selection = ''
i_screen_start_column = 1
i_screen_start_line = 1
i_screen_end_column = 62
i_screen_end_line = 10
i_tabname = 'LT_POPUP'
it_fieldcat = lt_fcat
it_excluding = lt_excl
IMPORTING
e_exit = lv_exit
TABLES
t_outtab = lt_popup.
IF lv_exit = 'X'.
* cancel
ELSE.
* do action
ENDIF.
ENDFORM.
See other related notes in my infodepot:
Full list of examples in my infodepot
If you have a question, have found an error or just want to contact me, please use this form.
If you have a question, have found an error or just want to contact me, please use this form.
Copyright (C) 2010 http://www.kerum.pl/infodepot/
Disclaimer: I am not affiliated or related to any division or subsidiary of SAP AG.
Trademarks or registered trademarks of any products or companies referred to on this site belong to those companies.
Anyone using the given solutions, is doing it under his/her own responsibility and at own risk.