11-09-2006 9:52 AM
Hi all!
How do I go about to create an instance of CL_SALV_COLUMN_LIST in AVL?
I can create instances of all other AVL classes using methods such as GET_COLUMNS, GET_EVENT, etc, in one of the three main classes. However I haven't managed to find any method that creates an instance of that perticular class!
BR,
Armin
11-09-2006 11:12 PM
hi Armin,
data lcl_alv1 type ref to CL_SALV_COLUMN_LIST.
create object lcl_alv1
exporting
columnname =
r_columns =
r_table_structure =
.
The above code will create an instance of the class which you mentioned.
Sajan.
11-10-2006 4:19 AM
Hello Armin
I found that the class is used in FORM routine salv_get_celltype (include LKKBLF10 on a ECC5.0, 6.40 release). I have inserted some comments ($Comment):
[code]&----
*& Form salv_get_celltype
&----
text
----
form salv_get_celltype using i_tabname type kkblo_tabname
i_tabindex type syindex
i_fieldname type kkblo_fieldname
changing c_celltype type i.
data: lr_display type ref to if_salv_display_adapter,
lr_columns type ref to cl_salv_columns_list,
<b>*$Comment: here is our class</b>
lr_column type ref to cl_salv_column_list,
l_columnname type lvc_fname,
l_level type i,
lt_celltype type salv_t_int4_column,
ls_celltype type salv_s_int4_column.
clear c_celltype.
check gt_stack3-r_salv_adapter is bound.
try.
<b>* $Comment: I have noticed that these adapers have
been added as additional parameters to
certain ALV function modules like REUSE_ALV_GRID_DISPLAY</b>
lr_display ?= gt_stack3-r_salv_adapter.
<b>*$Comment: retrive the instance holding all columns</b>
case gt_stack-listtype.
when con_listtype-hier_sequ.
l_level = i_tabname.
lr_columns ?= lr_display->get_columns( l_level ).
when others.
lr_columns ?= lr_display->get_columns( ).
endcase.
check lr_columns is bound.
try.
<b>*$Comment: get a single column instance based on fieldname</b>
lr_column ?= lr_columns->get_column( i_fieldname ).
if lr_column is bound.
c_celltype = lr_column->get_cell_type( ).
endif.
catch cx_salv_not_found. "#EC NO_HANDLER
endtry.
l_columnname = lr_columns->get_cell_type_column( ).
case gt_stack-listtype.
when con_listtype-hier_sequ.
case i_tabname.
when gt_stack-i_tabname.
if i_tabindex is not initial.
read table t_outtab_master index i_tabindex.
endif.
assign component l_columnname of structure t_outtab_master to <gt_celltype>.
when gt_stack-i_tabname_slave.
if i_tabindex is not initial.
read table t_outtab_slave index i_tabindex.
endif.
assign component l_columnname of structure t_outtab_slave to <gt_celltype>.
endcase.
when others.
if i_tabindex is not initial.
read table t_outtab index i_tabindex.
endif.
assign component l_columnname of structure t_outtab to <gt_celltype>.
endcase.
if sy-subrc ne 0.
assign lt_celltype to <gt_celltype>.
endif.
read table <gt_celltype> into ls_celltype
with key columnname = gs_fc-fieldname.
if sy-subrc eq 0.
c_celltype = ls_celltype-value.
else.
read table <gt_celltype> into ls_celltype
with key columnname = space.
if sy-subrc eq 0.
c_celltype = ls_celltype-value.
endif.
endif.
catch cx_sy_move_cast_error. "#EC NO_HANDLER
endtry.
endform. " salv_get_celltype[/code]
Regards
Uwe
11-14-2006 12:45 PM
Hi guys!
Thanks for all the suggested answers. U get a 6er each!
Cheers,
Armin