09-05-2007 6:26 PM
How to add a refresh button to this report. Thank you.
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.
DATA: gr_columns TYPE REF TO cl_salv_columns_table.
DATA: gr_column TYPE REF TO cl_salv_column_table.
DATA: gr_sorts TYPE REF TO cl_salv_sorts.
data: gr_filter type REF TO cl_salv_filters.
DATA: color TYPE lvc_s_colo.
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' ).
gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'CITYTO').
gr_column->set_long_text( 'Destination' ).
gr_column->set_medium_text( 'Test' ).
gr_column->set_short_text( 'Test' ).
color-col = '3'.
color-int = '1'.
color-inv = '0'.
gr_column->set_color( color ).
gr_sorts = gr_table->get_sorts( ).
gr_sorts->add_sort( 'CITYTO' ).
gr_filter = gr_table->get_filters( ).
gr_filter->add_filter( columnname = 'CARRID' low = 'LH') .
gr_table->display( ).
09-05-2007 6:42 PM
Ok first you need to copy the gui status STANDARD from the function group SALV into your program. This is the standard gui status used for the toolbar in your program, next modify it and add a button to the toolbar for your refresh. Then in you program, you need to tell it to use this status instead.
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table
CHANGING t_table = ispfli ).
* Here you are telling the alv object to use this gui status instead
gr_table->set_screen_status(
pfstatus = 'STANDARD'
report = sy-repid
set_functions = gr_table->c_functions_all ).
Now, you will have your button on the toolbar, but you will still need to handle it.
Check program SALV_DEMO_TABLE_FUNCTIONS to see what the procedures are to handle your custom button.
REgards,
Rich Heilman
09-05-2007 6:42 PM
Ok first you need to copy the gui status STANDARD from the function group SALV into your program. This is the standard gui status used for the toolbar in your program, next modify it and add a button to the toolbar for your refresh. Then in you program, you need to tell it to use this status instead.
cl_salv_table=>factory( IMPORTING r_salv_table = gr_table
CHANGING t_table = ispfli ).
* Here you are telling the alv object to use this gui status instead
gr_table->set_screen_status(
pfstatus = 'STANDARD'
report = sy-repid
set_functions = gr_table->c_functions_all ).
Now, you will have your button on the toolbar, but you will still need to handle it.
Check program SALV_DEMO_TABLE_FUNCTIONS to see what the procedures are to handle your custom button.
REgards,
Rich Heilman
09-05-2007 6:44 PM
Also, here is a tutorial which will walk you thru the entire process. With screenshots. Hope it is helpful.
Regards,
Rich Heilman
09-05-2007 6:47 PM
09-05-2007 6:51 PM
gr_table->set_screen_status(
pfstatus = 'STANDARD'
report = sy-repid
set_functions = gr_table->c_functions_all ).
This is giving me a dump
09-05-2007 6:53 PM
09-05-2007 6:55 PM
09-05-2007 7:01 PM
Go to SE80, enter the name of the function group and hit enter, you can either copy the gui status from function group SALV, or the standard gui status from function group SALV_METADATA_STATUS. I think it may be better to use the SALV_TABLE_STANDARD from function group SALV_METADATA_STATUS instead of the STANDARD from SALV function group. Go to this funciton group, and right-click on the status that you want to copy, and choose copy. In the dialog, give the name of your program where you want to copy the status too. Once it has been copied, you need to add the button, also make sure that you pass the correct name of the status to the method below.
gr_table->set_screen_status(
pfstatus = 'SALV_STANDARD' "<-- this is the name of the copied gui status
report = sy-repid
set_functions = gr->c_functions_all ).
Again, check out the document I have supplied above, it will walk you thru the entire process(except for copying the gui status)
Regards,
Rich Heilman
09-05-2007 7:22 PM
When I put this code, I do not see the refresh button. It doesnt dump though, so thats good
gr_table->set_screen_status(
pfstatus = 'SALV_TABLE_STANDARD'
report = sy-repid
set_functions = gr_table->c_functions_all ).
09-05-2007 7:26 PM
Did you add the button to the toolbar in this gui status? You must do that. Essential what you are doing is copying the standard toolbar, and now you need to add your custom button to it. Once you have added the button and activated the gui status, it will then show up on your toolbar when the ALV is displayed, again, you should check out that document above.
Regards,
Rich Heilman
08-04-2016 8:58 PM
Hi Rich,
I know the above will seem ages ago.
I have a similar requirement and need to introduce an editable check-mark against each row of the fetched rows from a DB Table.
Can you please let me know how to introduce the editable check mark and then based on the final state of the checked record-set need to read the set and update the DB Table ?
THanks,
Pankaj