2013 Jul 19 10:21 AM
Hi Experts,
I am developing a report using ALV Object Model class CL_SALV_TABLE. There are many field in my final internal table which I am passing in FACTORY method of CL_SALV_TABLE class. But out of these fields I just want to display few fields in my ALV output and rest of the fields neither I want to display nor I want to hide them.
Right now I am doing column settings on each column individually one by one using methods of class CL_SALV_COLUMNS_TABLE and CL_SALV_COLUMN. The columns which I dont want to be there in output I am hiding them one by one using SET_VISIBLE method of class CL_SALV_COLUMN. But as I mentioned earlier I also dont want them to be shown nor hidden.
Earlier I used to create ALV using function modules where we simply add the required columns in the field catalog with the required settings. Is this possible in the ALV Object Model or I have to remove all the non required columns from my final output table i.e the internal table which I am passing to FACTORY method of CL_SALV_TABLE class???
Regards
Sameer
2013 Jul 19 5:00 PM
Hi,
You use set_technical method to remove the column from the output.
Ex..
data: obj_col type ref to cl_salv_column.
obj_col = obj_cols_tab->get_column( 'BUKRS' ).
obj_col->set_technical( 'X' ).
Thanks
Naren
2013 Jul 19 5:00 PM
Hi,
You use set_technical method to remove the column from the output.
Ex..
data: obj_col type ref to cl_salv_column.
obj_col = obj_cols_tab->get_column( 'BUKRS' ).
obj_col->set_technical( 'X' ).
Thanks
Naren
2013 Jul 20 6:24 AM
Hi Narendran,
Thank you for your reply. Its really helpful. But do I need to use this set_technical for all fields one by one which i dont want to display? If yes it would be a lengthy procedure because there are plenty of fields.
Regards
Sameer
2013 Jul 22 6:51 AM
Hi,
You can store non required columns in t_columns internal table and then use the below code.
LOOP AT t_columns ASSIGNING <lfs_columns>.
TRY .
MOVE lr_columns->get_column( columnname = <lfs_columns>-columnname ) TO lr_column.
lr_column->set_technical( 'X' ).
CATCH cx_salv_not_found.
ENDTRY.
ENDLOOP.
Hope this helps..
Thanks,
Supratik
2013 Jul 29 6:18 AM
Hi Supratik,
I was also planning to do the same way. But on the other hand was thinking to do settings only on those fields which are required and non required fields should automatically be set as technical....but i guess its not possible in ALV OM.
Regards
Sameer
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |