2007 Nov 21 7:18 PM
Hi ALL
i want to write fields (text) in bold. What is the statement.
Thanks.
2007 Nov 21 7:30 PM
2007 Nov 21 7:30 PM
2007 Nov 21 9:21 PM
Hello
Perhaps the following sample report <b>ZUS_SDN_ALV_CELL_STYLE_1</b> may be of interest for you.
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_ALV_CELL_STYLE_1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zus_sdn_alv_cell_style_1.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1.
TYPES: celltab TYPE lvc_t_styl. " cell style
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA:
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
gt_fcat TYPE lvc_t_fcat.
DATA:
gt_outtab TYPE ty_t_outtab.
START-OF-SELECTION.
SELECT * FROM knb1 UP TO 100 ROWS
INTO CORRESPONDING FIELDS OF TABLE gt_outtab
WHERE bukrs = '1000'.
PERFORM set_layout_and_variant.
PERFORM set_cell_style.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_structure_name = 'KNB1'
* I_BACKGROUND_ID = ' '
i_grid_title = 'Cell Styles'
* I_GRID_SETTINGS =
is_layout_lvc = gs_layout
* it_fieldcat_lvc =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
* IT_SORT_LVC =
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'A'
is_variant = gs_variant
TABLES
t_outtab = gt_outtab
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.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form SET_LAYOUT_AND_VARIANT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM set_layout_and_variant .
CLEAR: gs_layout,
gs_variant.
gs_layout-cwidth_opt = abap_true.
gs_layout-stylefname = 'CELLTAB'.
gs_variant-report = syst-repid.
gs_variant-handle = 'STYL'.
ENDFORM. " SET_LAYOUT_AND_VARIANT
*&---------------------------------------------------------------------*
*& Form SET_CELL_STYLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM set_cell_style .
* define local data
CONSTANTS:
lc_style_bold TYPE int4 VALUE '00000121',
lc_style_red TYPE int4 VALUE '00000087',
lc_style_cursive TYPE int4 VALUE '00008700',
lc_style_underline_faint TYPE int4 VALUE '00008787',
lc_style_underline TYPE int4 VALUE '00008707',
lc_style_underline_red TYPE int4 VALUE '00008007'.
DATA:
ls_outtab TYPE ty_s_outtab,
ls_style TYPE lvc_s_styl,
lt_celltab TYPE lvc_t_styl.
CLEAR: ls_style.
ls_style-fieldname = 'BUKRS'.
ls_style-style = lc_style_bold.
INSERT ls_style INTO TABLE lt_celltab.
*
CLEAR: ls_style.
ls_style-fieldname = 'KUNNR'.
ls_style-style = lc_style_red.
INSERT ls_style INTO TABLE lt_celltab.
*
CLEAR: ls_style.
ls_style-fieldname = 'ERDAT'.
ls_style-style = lc_style_cursive.
INSERT ls_style INTO TABLE lt_celltab.
*
CLEAR: ls_style.
ls_style-fieldname = 'ERNAM'.
ls_style-style = lc_style_underline.
INSERT ls_style INTO TABLE lt_celltab.
ls_outtab-celltab = lt_celltab.
MODIFY gt_outtab FROM ls_outtab
TRANSPORTING celltab
WHERE ( bukrs = '1000' ).
ENDFORM. " SET_CELL_STYLE
Regards
Uwe