cancel
Showing results for 
Search instead for 
Did you mean: 

How to change font while displaying data through an ALV table in WDA?

Former Member
0 Kudos

Hi all,

I am displaying data through and ALV table. Now I want to change the FONT only for few rows. Is this possible?

If so then do the needful to me..

Thanks & Regards,

Yugesh A.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

I am using salv_wd_table.

Regards,

Yugesh A.

Former Member
0 Kudos

Hello Aslam,

Thank you very much for your reply. Here I am not using ALV FIELD CATALOG MERGE to display output.

I am using ALV table ( CL_SALV_WD_CONFIG_TABLE, CL_SALV_WD_COLUMN) to display the output.

Is it possible here to change the font here?

Regards,

Yugesh A.

Former Member
0 Kudos

Hi,

Please try the following

DATA: i_dataTYPE STANDARD TABLE OF sflight. Internal table for field catalog info

DATA: i_fields TYPE lvc_t_fcat.

SELECT * FROM sflight INTO TABLE i_data.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'SFLIGHT'

CHANGING

ct_fieldcat = i_fields

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3

.

IF sy-subrc = 0

LOOP AT i_fields ASSIGNING <wa_fields>.

IF sy-tabix > 4.

<wa_fields>-style = ALV_STYLE_FONT_ITALIC.

ELSE.

<wa_fields>-style = ALV_STYLE_FONT_BOLD.

ENDIF.

ENDLOOP.

ENDIF.

Former Member
0 Kudos

Hi Aslam,

I am using SALV_WD_TABLE to display the output. I am able to change the color for the columns.

But I want to change the FONT for few rows. Is this possible?

Regards,

Yugesh A.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I believe as you have found 'LVC_FIELDCATALOG_MERGE' would only work with the classic dynpro (SAPGUI based) version of the ALV.

You won't be able to control the font the same way in the WDA version of the ALV. You will need to create a custom cell editor for the column(s) in question. You can then bind context attributes to the properties of the cell editor. You will need extra attributes in your bound context to control these settings on the row level. Also you will be restricted by the changing the DESIGN property. This means only the values allowed for the DESIGN of the particluar UI element. For a TextView that wouldn't be the font directly (the font of course comes from the Theme).

DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
  l_salv_wd_table = wd_this->wd_cpifc_alv_adv( ).
  DATA l_table TYPE REF TO cl_salv_wd_config_table.
  l_table = l_salv_wd_table->get_model( ).

  data textview type ref to CL_SALV_WD_UIE_TEXT_VIEW.
  l_column = l_table->if_salv_wd_column_settings~get_column( 'ADD_PARTICIPANTS' ).
  create object textview.
  textview->SET_TEXT_FIELDNAME( 'ADD_PARTICIPANTS' ).
  textview->set_design_fieldname( 'ADD_DESIGN' ).
  textview->set_wrapping( abap_true ).
  l_column->set_cell_editor( textview ).

DESIGN supports the following options:

Value

Visual Display

Description

emphasized

Text is highlighted in default size

groupTitle

Header for forms

This enumeration value is deprecated. Instead, use SectionHeader.

header1

Text is highlighted with font size +4 in relation to the default font size.

header2

Text is highlighted with font size +5.08 cm relation to the default font size.

header3

Text is highlighted in default size

header4

Text is highlighted in font size -1 (small) in relation to the default font size (like the legend but highlighted)

label

Text is display in the default font type. A space is always inserted after the text.

label_small

Text is displayed in default font type, as with label, onyl that font size is -1 (like the font size for header4).

legend

Text is displayed with default font type in size -1.

reference

Text is in italics and in default font size.

standard

Text is displayed in default font size. No text attributes are defined for this value.

monospace

Text is displayed in no-proportional font type. Each letter takes up the same space.

Former Member
0 Kudos

Hello Thomas,

Thank you very much for your reply. It really helped in changing the FONT size of the text.

I also want to change the BACKGROUND colour for few columns in ALV table. Is it possible?

If so.. then please do the needful.

Thanks and Regards,

Yugesh A.

Former Member
0 Kudos

Hi Yogesh,

We can do that using the interface series of SXFT classes.

CL_ISR_SXFT_AREA               XFT area
CL_ISR_SXFT_CONTENT_ELEMENT    XFT Content Element
CL_ISR_SXFT_FACTORY            XFT Factory
CL_ISR_SXFT_FORMAT_OBJECT      XFT Formatting Object
CL_ISR_SXFT_ITEMS              XFT Items
CL_ISR_SXFT_MARGIN             XFT Margin
CL_ISR_SXFT_TEMPLATE           XFT Template
CL_ISR_SXFT_UI                 XFT UI
CL_SXFT_API_DEMO               Example Class for API Usage
CL_SXFT_AREA                   XFT AREA
CL_SXFT_BASIS                  XFT Base Functions
CL_SXFT_BORDER_ELEMENT         XFT Border Element
CL_SXFT_CONTENT_ELEMENT        XFT Content Element
CL_SXFT_CONTENTAREA            XFT Content Area
CL_SXFT_DRAW                   XFT Draw
CL_SXFT_EXCLGROUP
CL_SXFT_FACTORY                XFT Factory
CL_SXFT_FIELD                  XFT Field
CL_SXFT_FONT_CONTROL           XFT Font Control
CL_SXFT_FORMAT_OBJECT          XFT Formatting Object
CL_SXFT_INTELLIGENCE           XFT Programming Facilities
CL_SXFT_ITMES                  XFT Items
CL_SXFT_PAGEAREA               XFT Page Area
CL_SXFT_SET_ELEMENT            XFT Set Elements
CL_SXFT_SUBFORM                XFT Subform
CL_SXFT_TEMPLATE               XFT Template
CL_SXFT_UI                     XFT UI
CL_SXFT_UI_ELEMENT             UI Elements

You can also check the code example at [FONT/BACKGROUND COLOR|http://www.se80.co.uk/sapreports/r/rsxf/rsxft_xft_api_demo.htm]

Regards,

-Wahid Hussain Syed.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>We can do that using the interface series of SXFT classes.

What exactly does this have to do with the Web Dynpro ABAP ALV?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>I also want to change the BACKGROUND colour for few columns

Have you tried SET_SEMANTIC_COLOR_FIELDNAME? That's not exactly background color - but text color instead.

Former Member
0 Kudos

Hi Thomas,

I checked it thomas. I used set_cell_design method to change the background of the column.

Thank You very much for your reply.

Thanks and Regards

Yugesh A.

Former Member
0 Kudos

Hello Thomas,

I want to merge the Rows in my table.. Is it possible..??

I already posted a new thread for that. Please do the needful..

Regards,

Yugesh A.