2008 Mar 24 4:28 AM
2008 Mar 24 5:31 AM
Hi,
Think by using REUSE_ALV_GRID_DISPLAY_LVC we can change the font style in ALV report.
Check the following code:
Include for all style values
INCLUDE <cl_alv_control>.
Internal table for final output data
DATA: it_scarr TYPE STANDARD TABLE OF scarr.
Internal table for field catalog info
DATA: it_fields TYPE lvc_t_fcat.
Field symbol for field catalog
FIELD-SYMBOLS: <wa_fields> TYPE lvc_s_fcat.
Select data
SELECT * FROM scarr
INTO TABLE it_scarr.
IF sy-subrc = 0.
Get field catalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SCARR'
CHANGING
ct_fieldcat = it_fields
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
.
IF sy-subrc = 0.
Changing the style of field catalog
LOOP AT it_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.
Calling the FM to display ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_structure_name = 'SCARR'
i_grid_title = 'Style demo'(001)
it_fieldcat_lvc = it_fields
TABLES
t_outtab = it_scarr
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.ENDIF.
You can refer to this link below:
http://www.saptechnical.com/Tutorials/ALV/Font/change.htm
Hope this is helpful.
Plz reward points if helpful.
Thanks.
2008 Mar 24 5:31 AM
Hi,
Think by using REUSE_ALV_GRID_DISPLAY_LVC we can change the font style in ALV report.
Check the following code:
Include for all style values
INCLUDE <cl_alv_control>.
Internal table for final output data
DATA: it_scarr TYPE STANDARD TABLE OF scarr.
Internal table for field catalog info
DATA: it_fields TYPE lvc_t_fcat.
Field symbol for field catalog
FIELD-SYMBOLS: <wa_fields> TYPE lvc_s_fcat.
Select data
SELECT * FROM scarr
INTO TABLE it_scarr.
IF sy-subrc = 0.
Get field catalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SCARR'
CHANGING
ct_fieldcat = it_fields
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3
.
IF sy-subrc = 0.
Changing the style of field catalog
LOOP AT it_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.
Calling the FM to display ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_structure_name = 'SCARR'
i_grid_title = 'Style demo'(001)
it_fieldcat_lvc = it_fields
TABLES
t_outtab = it_scarr
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.ENDIF.
You can refer to this link below:
http://www.saptechnical.com/Tutorials/ALV/Font/change.htm
Hope this is helpful.
Plz reward points if helpful.
Thanks.