‎2008 Aug 27 2:09 PM
Hello experts,
I have created alv display with SALV:
*->Importing the object reference into GR_TABLE and passing the internal table
CL_SALV_TABLE=>FACTORY( IMPORTING R_SALV_TABLE = GR_TABLE
CHANGING T_TABLE = GT_DATA ).
*-> Set toolbar
GR_FUNCTIONS = GR_TABLE->GET_FUNCTIONS( ).
GR_FUNCTIONS->SET_ALL( ABAP_TRUE ).The problem is that i cant find the way to add the "SAVE LAYOUT" function button.
best regards,
sagit.
‎2008 Aug 27 2:12 PM
hmmm i have it done like following:
*** part of the global data declaration ***
DATA: salv TYPE REF TO cl_salv_table,
alv TYPE REF TO cl_gui_alv_grid,
ccontrol TYPE REF TO cl_gui_custom_container,
functions TYPE REF TO cl_salv_functions_list.
FORM init_salv .
IF salv IS INITIAL.
* create instance of ALV table
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = salv
CHANGING
t_table = gt_kalkschema.
CATCH cx_salv_msg .
ENDTRY.
functions = salv->get_functions( ).
functions->set_all( abap_true ).
* display table
salv->display( ).
ENDIF.
ENDFORM. " init_alv
i dont see much difference here between our code so i´m somehow dissappointed, but maybe you can see something.
‎2008 Aug 27 2:25 PM
Hi,
I found thr answer:
gr_layout = gr_table->get_layout( ). key-report = sy-repid. gr_layout->set_key( key ). gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
‎2008 Aug 27 2:27 PM
great, gotta archieve this in my "frequently done errors" database
thank you.
‎2011 Oct 07 3:52 PM
Hello experts,
how to put a structure layout to intenal table??
thanks!!!!
METHOD generate_output.
DATA: lx_msg TYPE REF TO cx_salv_msg.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = o_alv
CHANGING
t_table = gt_tab ).
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.
Setting up the PF-Status
CALL METHOD set_pf_status
CHANGING
co_alv = o_alv.
Setting up the Layout
CALL METHOD set_layout
CHANGING
co_alv = o_alv.
Displaying the ALV
o_alv->display( ).
*
ENDMETHOD. "generate_output
METHOD set_pf_status.
DATA: lo_functions TYPE REF TO cl_salv_functions_list.
lo_functions = co_alv->get_functions( ).
lo_functions->set_default( abap_true ).
ENDMETHOD. "set_pf_status
METHOD set_layout.
DATA: lo_layout TYPE REF TO cl_salv_layout,
lf_variant TYPE slis_vari,
ls_key TYPE salv_s_layout_key.
get layout object
lo_layout = co_alv->get_layout( ).
set Layout save restriction
1. Set Layout Key .. Unique key identifies the Differenet ALVs
ls_key-report = sy-repid.
lo_layout->set_key( ls_key ).
2. Remove Save layout the restriction.
lo_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
set initial Layout
lf_variant = p_layout.
lo_layout->set_initial_layout( lf_variant ).
ENDMETHOD. "set_layout
ENDCLASS. "lcl_report IMPLEMENTATION
‎2011 Oct 08 6:19 AM
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = C_PF_STATUS
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fcat
it_sort = it_sort
it_events = it_events
i_default = c_flag
i_save = c_flag "this part of code will give save layout option for that
i_grid_title = title
tables
t_outtab = it_sale1
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message 'Error in Display the list'
type 'I'.
leave to list-processing.
endif.
data:c_flag type c value 'X',
thanks
abhishek