Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DD_STYLE_TABLE

Former Member
0 Likes
713

Hi everyone,

Will anybody let me know how to use DD_STYLE_TABLE with Grid.

Like how to display the alv grid display with bold text by using the methods

used in DD_STYL_TABLE program.

I am confused with the both, will anybody let me know how to display the alv grid

with bold heading

Regards.

3 REPLIES 3
Read only

former_member195698
Active Contributor
0 Likes
517

I don' think you will be able to use the concept of dynamic documents within the ALV Grid. You have to use a different Control for showing any text using DD.

Regards,

aj

Read only

uwe_schieferstein
Active Contributor
0 Likes
517

Hello Madhavi

Have a look at the sample report ZUS_SDN_ALV_CELL_STYLE_1. Different styles can be assigned using different INT4 values for the style, e.g.:

* 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'.

Please note that the "code value" for <b>BOLD </b>was taken from thread

*&---------------------------------------------------------------------*
*& 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

Read only

0 Likes
517

Hi Uwe,

Thanks for your update.

I need only Heading at heading level of the grid.

I wan to display grid, as well i need to display heading with bold on top of the Gird

like in DD_STYLE_TABLE.

But whenever i am trying like in DD_STYLE_TABLE the HTML container is overlapping with GRID container.

Will you pls let me know how to rectify it and also let me in DD_STYLE_TABLE

how to call the internal table data instead of text.