Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SALV Problem?

Former Member
0 Likes
2,057

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

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,430

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

15 REPLIES 15
Read only

former_member194669
Active Contributor
0 Likes
1,430

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®

Read only

0 Likes
1,430

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

Read only

0 Likes
1,430

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?

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899...

Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,431

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

Read only

0 Likes
1,430

If you want to use the standard selection functinality of the grid, have a good look at the example program SALV_DEMO_TABLE_SELECTIONS

Regards,

Rich Heilman

Read only

0 Likes
1,430

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

Read only

0 Likes
1,430

Anothef example program SALV_DEMO_TABLE_FORM_EVENTS will show how to do the top of page for your report heading.

REgards,

Rich Heilman

Read only

0 Likes
1,430

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

Read only

0 Likes
1,430

Hi,

Please check the program SALV_TEST_TABLE_SELECTIONS, this have option to select multiple rows and also custom function options

a®

Read only

0 Likes
1,430

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.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899...

Regards,

Rich Heilman

Read only

0 Likes
1,430

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

Read only

0 Likes
1,430

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

Read only

0 Likes
1,430

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

Read only

0 Likes
1,430

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.

Read only

Former Member
0 Likes
1,430

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.