Google Search - Blog...........

ABAP - Pop Up Window With Check Box.

REPORT ztest_alv_check MESSAGE-ID zz .

TYPE-POOLS: slis.
DATA: x_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE slis_t_fieldcat_alv,
l_layout TYPE slis_layout_alv,
x_events TYPE slis_alv_event,
it_events TYPE slis_t_event.

DATA: BEGIN OF itab OCCURS 0,
vbeln LIKE vbak-vbeln,
posnr LIKE vbap-posnr,
chk(1),
color(4),
END OF itab.

SELECT vbeln
posnr
FROM vbap
UP TO 20 ROWS
INTO TABLE itab.

x_fieldcat-fieldname = 'CHK'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 1.
x_fieldcat-input = 'X'.
x_fieldcat-edit = 'X'.
x_fieldcat-checkbox = 'X'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-hotspot = 'X'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.


DATA selfield TYPE slis_selfield.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Select Data'
i_selection = 'X'
i_zebra = 'X'
i_screen_start_column = 5
i_screen_start_line = 5
i_screen_end_column = 50
i_screen_end_line = 10
i_checkbox_fieldname = 'CHK'
i_tabname = 'ITAB'
i_scroll_to_sel_line = 'X'
it_fieldcat = it_fieldcat
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
IMPORTING
es_selfield = selfield
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1.

*&---------------------------------------------------------------------*
*& Form STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_EXTAB text
*----------------------------------------------------------------------*
FORM status USING p_extab TYPE slis_t_extab.

SET PF-STATUS 'STATUS'.
ENDFORM. " STATUS

*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

DATA: gd_repid LIKE sy-repid, "Exists
ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data .
ENDIF.

LOOP AT itab WHERE chk = 'X'.
itab-color = 'C300'.
MODIFY itab INDEX sy-tabix TRANSPORTING color.
ENDLOOP.
rs_selfield-refresh = 'X'.
BREAK-POINT.

ENDFORM. "USER_COMMAND


ALSO READ:

- F4 (Value On Request) For Parameter On Selection Screen.

- Updating Value Of Another Field On The Selection Screen.

- Complex Selection Screen (Using Macros).

- Printing Selection Screen Data On The Report Output.

- Creating The Listbox Using Macros.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.

1 comment:

  1. is that subroutine "status" used at all? what i know is we can only exclude buttons but not modifying the gui status. pls advise.

    ReplyDelete