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

Column settings in ALV Object Model

Former Member
0 Likes
1,955

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,667

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

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,668

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

Read only

Former Member
0 Likes
1,667

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

Read only

Former Member
0 Likes
1,667

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

Read only

0 Likes
1,667

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