‎2008 Aug 21 11:18 AM
Hi all,
i want to know is there any way to get multiple checkboxes when i am using FM Reuse_alv_fieldcatalog_merge.. to create ALV...
I know that by giving the style we can get one checkbox.. but i need to display 5 checkboxes...
Help me out frens.
Regards,
Syed
‎2008 Aug 21 12:36 PM
Hi,
can you give me some piece of code by which i can get a clear idea to get multiple checkboxes in the ALV List output.
Regards,
Syed
‎2008 Aug 21 12:27 PM
Hi,
you can give a field namely as checkbox in your internal table declaration and then while manually populating field-catalog set the field namely checkbox as X and it appears in the ALV display.
Declare your Fieldcatalog as : W_FIELDCAT TYPE LVC_T_FCAT,
and set W_FIELDCAT-CHECKBOX = 'X'.
and this is achieved when you use OOPs concept.
Use SET_TABLE_FOR_FIRST_DISPLAY instead of REUSE_ALV_GRID_DISPLAY.
‎2008 Aug 21 12:30 PM
Hi,
see i know that it can be done through OOps concept but i want to know is there any way to do it with the help of Reuse_alv_fieldcatlog-merge FM...
regards,
Syed
‎2008 Aug 21 12:30 PM
using fieldcatalog option
CHECKBOX = 'X'. you can get the check box.
Style are used to Disable or Enable the Checkboxes conditionally.
if you want the checkbox to appear for all the columns then use CHECKBOX = 'X' for that column when you are populating the Fieldcatalog population.
‎2008 Aug 21 12:36 PM
Hi,
can you give me some piece of code by which i can get a clear idea to get multiple checkboxes in the ALV List output.
Regards,
Syed
‎2008 Aug 21 12:38 PM
You mean this... This shows a column with a check box for each row.
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),
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.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = l_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*&---------------------------------------------------------------------*
*& 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-chk = 'X'.
MODIFY itab TRANSPORTING chk WHERE vbeln = itab-vbeln .
ENDLOOP.
rs_selfield-refresh = 'X'.
BREAK-POINT.
ENDFORM. "USER_COMMAND