‎2008 Feb 01 2:52 PM
Hi all,
I am developing an ALV report usung the SALV concept.
My requirenment is to have a checkbox field which is editable.Please let me know how it can be done..
Also let me knoe how the List heading can be done in SALV concept.I need to print a heading.
<REMOVED BY MODERATOR>
Thanks,
Arun Chaudhary
Edited by: Alvaro Tejada Galindo on Feb 1, 2008 1:15 PM
‎2008 Feb 01 2:58 PM
Basically "Editable" ALV is not supported with the ALV Object Model, so in the case of a editable checkbox in a regular table display is not possible. You can use the standard functionality of line selection instead. You would use the class CL_SALV_SELECTIONS, to turn this on. Are you interesting in doing this?
Regards,
Rich Heilman
‎2008 Feb 01 2:57 PM
For check box selections use
gr_selections = gr_table->get_selections( level = 1 ).
gr_selections->set_selection_mode( cl_salv_selections=>if_salv_c_selection_mode~multiple ).
gr_table->display( ).
For Ttitle
gr_display = gr_table->get_display_settings( ).
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
gr_display->set_list_header( 'This is your heading' ).
a®
‎2008 Feb 04 12:20 PM
Hi,
I am unable to interpret the solution by you regarding multiple selections..
Can u send me the detailed code please.
I need to select multiple rows and sisplay the data in the next alv based on the clicking of a user command button..
Regards,
Arun
‎2008 Feb 04 12:39 PM
If you follow the instructions in the tutorial step by step, it should help you understand what you need to do. What exactly are you having trouble with or what is not clear?
Regards,
Rich Heilman
‎2008 Feb 01 2:58 PM
Basically "Editable" ALV is not supported with the ALV Object Model, so in the case of a editable checkbox in a regular table display is not possible. You can use the standard functionality of line selection instead. You would use the class CL_SALV_SELECTIONS, to turn this on. Are you interesting in doing this?
Regards,
Rich Heilman
‎2008 Feb 01 3:01 PM
‎2008 Feb 01 3:04 PM
aRs has posted above about the checkbox using the same class, understand that what he has posted above is from a hierarchial sequestion list ALV, which does allow you to implemented checkboxes, but if you are using the regular tabular ALV, class CL_SALV_TABLE, you will not get checkboxes, but simply the row selector column in the grid.
Regards,
Rich Heilman
‎2008 Feb 01 3:06 PM
‎2008 Feb 01 3:11 PM
Hi,
You mean to say if i use the SALV concept i wont be be able to display checkboxes??..
Please provide me with the alternative solution with the sample code it will be really useful.I need to make selections of the rows and do call some functionality.
Please suggest how to do it.
Regards,
Arun Chaudhary
‎2008 Feb 01 3:24 PM
Hi,
Please check the program SALV_TEST_TABLE_SELECTIONS, this have option to select multiple rows and also custom function options
a®
‎2008 Feb 01 3:30 PM
Well, you can display a column as a checkbox, but you won't be able to change it in the tabular ALV. You would need to use the standard selection column. Follow this tutorial.
Regards,
Rich Heilman
‎2008 Feb 01 3:38 PM
Here is an easy to understand example for the Top of Page, or list heading.
REPORT zrich_0001.
DATA: ispfli TYPE TABLE OF spfli.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_functions TYPE REF TO cl_salv_functions.
DATA: gr_display TYPE REF TO cl_salv_display_settings.
START-OF-SELECTION.
SELECT * INTO TABLE ispfli FROM spfli.
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table
CHANGING t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_display = gr_table->get_display_settings( ).
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
gr_display->set_list_header( 'This is the heading' ).
PERFORM build_header.
gr_table->display( ).
*&---------------------------------------------------------------------*
*& Form build_header
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM build_header.
* Set the top of list
DATA: lr_grid TYPE REF TO cl_salv_form_layout_grid,
lr_gridx TYPE REF TO cl_salv_form_layout_grid,
lr_flow TYPE REF TO cl_salv_form_layout_flow,
lr_pict TYPE REF TO cl_salv_form_picture,
lr_logo TYPE REF TO cl_salv_form_layout_logo,
lr_label TYPE REF TO cl_salv_form_label,
lr_text TYPE REF TO cl_salv_form_text.
CREATE OBJECT lr_grid.
lr_grid->create_header_information( row = 1 column = 1
text = 'This is the heading'
tooltip = 'This is the heading' ).
lr_gridx = lr_grid->create_grid( row = 2 column = 1 ).
lr_label = lr_gridx->create_label( row = 2 column = 1
text = 'Program:' tooltip = 'Program' ).
lr_text = lr_gridx->create_text( row = 2 column = 2
text = sy-repid tooltip = sy-repid ).
lr_label = lr_gridx->create_label( row = 3 column = 1
text = 'Run Date:' tooltip = 'Run Date' ).
lr_text = lr_gridx->create_text( row = 3 column = 2
text = sy-datum tooltip = sy-datum ).
lr_label = lr_gridx->create_label( row = 4 column = 1
text = 'Run Time:' tooltip = 'Run Time' ).
lr_text = lr_gridx->create_text( row = 4 column = 2
text = sy-uzeit tooltip = sy-uzeit ).
* Create logo layout, set grid content on left and logo image on right
CREATE OBJECT lr_logo.
lr_logo->set_left_content( lr_grid ).
lr_logo->set_right_logo( 'ENJOYSAP_LOGO' ).
* Set the element top_of_list
gr_table->set_top_of_list( lr_logo ).
ENDFORM. "build_header
Regards,
RIch Heilman
‎2008 Feb 04 7:18 AM
Hi Rich,
Thanks for ur help..Now i am able to have the Top of List..
But the multiple selection code is not clear..
Actually my requirement is to select multiple rows and when i click on a user command button the selected rows must be displayed on the next ALV..
Please let me know how it can be achieved..
Thanks a lot..
Regards,
Arun
‎2008 Feb 04 12:18 PM
Hi Rich,
Can u plz help me out with the selections Concept..
I need to select multiple rows and i want to display the selected rows and display the data in the next ALV on click of a user command.
Itz an urgent issue and i am unable to find the solution..
Please suggest..
Regards,
Arun
‎2011 Sep 22 9:15 AM
Actually you can implement full editable ALV using SALV class. (but usage is questionnable
Check this: /people/naimesh.patel/blog/2008/11/24/power-of-abap-objects-overcome-the-restrictions-of-salv-model
Quick step-by-step:
1. Inherit a local class LCL_SALV_MODEL from the CL_SALV_MODEL_LIST
2. Generate SALV model to generate the ALV object
3. Used narrow casting to get the CL_SALV_MODEL object from the ALV object
4. Passed this CL_SALV_MODEL object to the inherited class LCL_SALV_MODEL. Since LCL_SALV_MODEL is inherited from the CL_SALV_MODEL_LIST, it allows access to the R_CONTROLLER of the CL_SALV_MODEL.
5. Get the GRID object from the object MODEL -> Controller -> Adapter -> Grid.
6. Set the Layout for EDIT and Refresh the ALV.
Kr,
m.
‎2011 Sep 22 9:00 AM
hi,
for adding editable checkboxes you can try this code, i got checkboxes by using this code.
go_column ?= go_columns->get_column( 'CHECK' ).
go_column->set_cell_type( if_salv_c_cell_type=>checkbox_hotspot ).
go_column->set_output_length( 10 ).
thanks and regards,
ramakrishna buddala.