2008 Aug 13 2:44 PM
Hello Experts,
I have a query in a report in which I am using OOALV.
The Internal table contains a field with CHECKBOX and I am using the method REUSE_ALV_GRID_DISPLAY_LVC for displaying the Grid.
The problem I am facing is the value of the CHECK column which is bound to Checkbox doesn't get populated in the Internal Table whether the Checkbox is Checked or Unchecked.
The CHECK Column remains blank.
Please help me out on this.
<removed by moderator>
Regards,
Ravi
Edited by: Mike Pokraka on Aug 13, 2008 3:09 PM
2008 Aug 13 3:19 PM
Check this Sample code.
calling the Function in the user command will help you in getting the updated values to interanl table.
'GET_GLOBALS_FROM_SLVC_FULLSCR'
REPORT ztest_lvc_fm.
TYPE-POOLS: slis.
DATA: x_fieldcat TYPE lvc_s_fcat,
it_fieldcat TYPE lvc_t_fcat.
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-edit = 'X'.
x_fieldcat-checkbox = 'X'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-coltext = '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-coltext = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-edit = 'X'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat_lvc = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 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
*----------------------------------------------------------------------*
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.
"now check the entries in ALV table
BREAK-POINT.
ENDFORM. "USER_COMMANDRegards
Vijay Babu Dudla
Hello Experts,
I have a query in a report in which I am using OOALV.
The Internal table contains a field with CHECKBOX and I am using the method REUSE_ALV_GRID_DISPLAY_LVC for displaying the Grid.
The problem I am facing is the value of the CHECK column which is bound to Checkbox doesn't get populated in the Internal Table whether the Checkbox is Checked or Unchecked.
The CHECK Column remains blank.
Please help me out on this.
<removed by moderator>
Regards,
Ravi
Edited by: Mike Pokraka on Aug 13, 2008 3:09 PM
2008 Aug 13 3:08 PM
Hi,
Hope that your ALV doesnt recieve the event click on the check box.
You need to update the internal table whenever a chekc box is checked.
You can refer to the standard program BCALV_EDIT_05
Hope this helps.
2008 Aug 13 3:19 PM
Check this Sample code.
calling the Function in the user command will help you in getting the updated values to interanl table.
'GET_GLOBALS_FROM_SLVC_FULLSCR'
REPORT ztest_lvc_fm.
TYPE-POOLS: slis.
DATA: x_fieldcat TYPE lvc_s_fcat,
it_fieldcat TYPE lvc_t_fcat.
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-edit = 'X'.
x_fieldcat-checkbox = 'X'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-coltext = '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-coltext = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-edit = 'X'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat_lvc = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 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
*----------------------------------------------------------------------*
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.
"now check the entries in ALV table
BREAK-POINT.
ENDFORM. "USER_COMMANDRegards
Vijay Babu Dudla
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |