05-30-2018 11:16 AM
Hi Guys!
I am using CL_SALV_TABLE to generate ALV output.
Has anyone managed to bold the text within a column or cell using the functionalities provided by this class?
I am not interested in changing the program to use CL_GUI_ALV_GRID neither FMs REUSE_ALV_GRID_DISPLAY*...
05-30-2018 2:43 PM
It seems there is no easy way to set bold text in SALV cells.
Hard way - get CL_GUI_ALV_GRID object from SALV object, get layout (lvc_s_layo) and set layout-stylefname + style to cell.
Or use colors instead as Simone suggested.
05-30-2018 1:18 PM
Hi Carlo,
it's possible to set a colour with all the styling as per Naimesh's wonderful blog http://zevolving.com/2008/10/salv-table-9-apply-colors/
Applying this solution, you can specify which column is intensified aka bold, since it relies on LVC_S_SCOL structure.
LVC_S_SCOL has structure COLOR with field "INT" you can activate (1) or deactivate (0).
05-30-2018 2:24 PM
Thanks Simone!
But I'm not talking about colors, I specifically mentioned I would like the text in bold/intensified.
This cannot be achieved by the solution you proposed.
Have you ever managed to achieve BOLD with this?
05-30-2018 2:28 PM
As i said
Applying this solution, you can specify which column is intensified aka bold, since it relies on LVC_S_SCOL structure.
LVC_S_SCOL has structure COLOR with field "INT" you can activate (1) or deactivate (0).
The method name is a bit puzzling, but if you just fill the INT field, you got your bold.
Did you read the blog i linked and tried to follow the same path?
05-30-2018 2:31 PM
Simone, I have included the sample code and bold cannot be achieved by the proposed solution.
Proof:
This is why I asked if you have managed to achieve this using INT = 1
05-30-2018 3:19 PM
You can obtain the intensified effect (like on old WRITE LIST ) like this
DATA: lo_cols_tab TYPE REF TO cl_salv_columns_table,
lo_col_tab TYPE REF TO cl_salv_column_table.
cl_salv_table=>factory( IMPORTING r_salv_table = salv
CHANGING t_table = out ).
DATA: ls_color TYPE lvc_s_colo. " Colors strucutre
lo_cols_tab = salv->get_columns( ).
INCLUDE <color>.
TRY.
lo_col_tab ?= lo_cols_tab->get_column( 'VSTEL' ).
ls_color-col = 0 .
ls_color-int = 1.
ls_color-inv = 0.
lo_col_tab->set_color( ls_color ).
CATCH cx_salv_not_found.
ENDTRY.
05-30-2018 3:28 PM
05-30-2018 3:30 PM
I know it's not the bold effect, but if you want to stick with basic alv (SALV does that: quick and dirty lists) it's all you can have, i'm sorry 😕
05-30-2018 2:43 PM
It seems there is no easy way to set bold text in SALV cells.
Hard way - get CL_GUI_ALV_GRID object from SALV object, get layout (lvc_s_layo) and set layout-stylefname + style to cell.
Or use colors instead as Simone suggested.
05-30-2018 2:49 PM
Simone's solution does not work. I have showed that in the comments.
Could you please further explain your solution using CL_GUI_ALV_GRID with code examples if possible? Thanks!
05-30-2018 3:27 PM
I meant that instead of making text bold you can color it. So it will be more visible.
For more help on "hard way" - read this nice blog https://blogs.sap.com/2015/06/25/salv-editable-with-single-custom-method/. Cou can find there how to get CL_GUI_ALV_GRID object and then layout. Setting bold text with lvc_s_layo is then no problem to find...
05-30-2018 3:52 PM
It is indeed a very complicated solution. May not worth it going down that road and just stick to using CL_GUI_ALV_GRID in most cases.
I will advise the business to restrict only to color scheme in this case.
Thanks a lot!