2011 Aug 31 7:28 AM
Hi,
I am using an ALV report with check box field as the first field.There are totally 5 fields.
There are 2 buttons which i have created in application toolbar.
Button name : %OCC
In user command this sy-ucomm is displaying the button name and everything is fine till there.
The problem is,
After the report has been displayed,I have checked two rows using that check box field.Next i clicked this custom button in application toolbar,the execution is entering the user command subroutine.the internal table is not showing the records clicked.
the X value not coming in internal table.
but if i click a button in functional tool bar (Fuctional Keys) the check field in internal table is coming as X while debugging.
How to overcome this
2011 Aug 31 7:54 AM
Hi,
why do you use checkboxes? Can't you use the ALV standard way of selecting lines? Then you can use standard ALV methods to check which lines have been selected.
If you need to get the updated values from the table, you need a server roundtrip. Maybe use method dispatch or refresh_table_display?
Roy
2011 Aug 31 7:54 AM
Hi,
why do you use checkboxes? Can't you use the ALV standard way of selecting lines? Then you can use standard ALV methods to check which lines have been selected.
If you need to get the updated values from the table, you need a server roundtrip. Maybe use method dispatch or refresh_table_display?
Roy
2011 Aug 31 8:33 AM
Hi
Did you wrote the code for user command as
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&POSTING'.
PERFORM POST_DOC.
ENDCASE.
ENDFORM.
if you have written that then
in the subroutine you can directly write as
delete ifinal where sel ne 'X' . "sel indicates Check box
and then
if not ifinal[] is initial .
loop at ifinal.
endloop.
endif.
hope this helps..
Regards,
Vishwanath
2011 Aug 31 8:44 AM
I have given the code which you have mentioned.
But the check box field is not displaying X.
2011 Aug 31 8:53 AM
Hi
did you write the code as
ls_fieldcat-checkbox = 'X'.
modify gt_fieldcat from ls_fieldcat
transporting checkbox
where fieldname eq 'SEL'.
after declaring your field catalog.
2011 Aug 31 9:02 AM
I have given the fieldcatalog-checkbox = 'X'.
But where i need to give the modify command
can you guide me with a sample code
2011 Aug 31 9:09 AM
ls_fieldcat-col_pos = .
ls_fieldcat-fieldname = sel.
ls_fieldcat-tabname = ifinal.
ls_fieldcat-ref_fieldname = ''.
ls_fieldcat-ref_tabname = ''.
ls_fieldcat-seltext_l = ''.
ls_fieldcat-seltext_m =''.
ls_fieldcat-seltext_s = ''.
ls_fieldcat-reptext_ddic =''.
ls_fieldcat-ddictxt = 'L'.
ls_fieldcat-do_sum = ''.
ls_fieldcat-no_out = ''.
ls_fieldcat-emphasize = s300.
in this way you give a field catalog right?
after this declaration write the above code
Regards
Vishwanath
2011 Aug 31 9:08 AM
Call the method check_changed_data as below: -
CALL METHOD gr_grid_db_200->check_changed_data
IMPORTING
e_valid = w_alv_changed.
2011 Aug 31 9:14 AM
Hi,
fill the field catallog for the check box..
chebox = 'X' and edit = ' X' .
if you selected the check box then modify the final internal table ith the check box field as 'X'.
and place the above code..
hope this will be helpful...
Regards
Aravind.
2011 Aug 31 9:15 AM
Ya i have did as per your comments.
But it was only not working for application tool bar buttons.
working fine for Functional tool bar buttons
2011 Aug 31 9:24 AM
place the code in the class ...method user command..
ur internal table should be declared in global..
write above logic in the that method user command ... hope this will solved...
Regards
Aravind.
2011 Aug 31 9:27 AM
Hi
Which kind of ALV are you using?
OOP ALV or function ALV?
Max
2011 Aug 31 9:49 AM
Did you give
ps_layout-box_fieldname = 'SEL'.
in the layout structure?
2011 Aug 31 10:58 AM
I think you are using Reuse_alv_grid_display function module. i don't know how to do in using function module, but i know using CL_gui_alv_grid, after updating data do following changes in program
CALL METHOD p_alv_grid->check_changed_data .
Kind Rgds
Ravi Lanjewar