SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Задание стилей (bold, cursive, underline) для ячеек alv-grid



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 20, 2008 9:30 pm    Post subject: Задание стилей (bold, cursive, underline) для ячеек alv-grid Reply with quote

Code:
*&---------------------------------------------------------------------
*& 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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ALV Grid / ALV Tree / ALV List All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.