Skip to Content
author's profile photo Former Member
Former Member

How to make a particular column bold in alv?

Dear Experts,

I have searched many threads on this. I have used control break events to get the subotals and totals. The requirement is to make the text and the figure of subtotal and total bold.

I am still not able to find the thread to make a particular column text in bold. And about colouring, I have used collect statement in my final structure so I am unable to use cellcolor type lvc_t_scol.

Is there any way to make the subtotals and totals in bold? If not able, I may go for coloring.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 28, 2014 at 07:54 AM

    Hello mani,

    Try this:

    TYPES : BEGIN OF ty_outtab,
    celltab TYPE lvc_t_styl.
    TYPES END OF ty_outtab.

    DATA : gt_outtab TYPE TABLE OF ty_outtab WITH HEADER LINE,
    gs_layout TYPE lvc_s_layo,
    ls_celltab TYPE lvc_s_styl,
    lt_celltab TYPE lvc_t_styl.


    ls_celltab-style = '00000121'.

    INSERT ls_celltab INTO lt_celltab INDEX 1.

    READ TABLE gt_outtab INDEX 1.
    gt_outtab-celltab = lt_celltab.

    INSERT gt_outtab INDEX 1.

    gs_layout-stylefname = 'CELLTAB'.

    i_structure_name = 'MARA'
    is_layout_lvc = gs_layout
    t_outtab = gt_outtab
    program_error = 1
    OTHERS = 2.

    I hope you help.

    MATERIAL.png (34.2 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 28, 2014 at 07:56 AM


    If you want to use collect and lvc_t_scol you need to do the collect into intermediate table

    and then use the intermediate as input to your final table (Add the colors,style etc.) .

    Note the include of tp_bffr_1 .

    TYPES: BEGIN OF tp_bffr_1 .
    TYPES: row_type TYPE dd40l-rowtype .
    INCLUDE TYPE sflight AS sflight .
    TYPES: END OF tp_bffr_1 .

    TYPES: tp_bffr_1_tab TYPE TABLE OF tp_bffr_1 .
    TYPES: BEGIN OF tp_alv_data_1 .

    TYPES: ex_flag TYPE abekz ,
    it_scol TYPE lvc_t_scol ,
    it_styl TYPE lvc_t_styl ,
    li_info TYPE ehsbe_vai_linecolor .

    INCLUDE TYPE tp_bffr_1 AS bffr_1 .

    TYPES: END OF tp_alv_data_1 .

    TYPES: tp_alv_data_1_tab TYPE TABLE OF tp_alv_data_1 .


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 28, 2014 at 08:59 AM


    There was a message here that was deleted....

    In the following code I sum sflight into differen levels.

    CONSTANTS: gc_type_lvl_40 TYPE dd40l-rowtype VALUE 'Airline ' .
    CONSTANTS: gc_type_lvl_30 TYPE dd40l-rowtype VALUE 'Connection' .
    CONSTANTS: gc_type_lvl_20 TYPE dd40l-rowtype VALUE 'Aircraft ' .
    CONSTANTS: gc_type_lvl_10 TYPE dd40l-rowtype VALUE 'Date ' .

    FORM get_data_1 .

    DATA: it_sflight TYPE flighttab .

    FIELD-SYMBOLS: <st_sflight> LIKE LINE OF it_sflight .

    DATA: st_alv_data_1 LIKE LINE OF it_alv_data_1 .

    CLEAR: it_alv_data_1[] .

    SELECT * INTO TABLE it_sflight
    FROM sflight
    carrid IN s_carrid AND
    connid IN s_connid AND
    fldate IN s_fldate AND
    planetype IN s_planet .

    DATA: it_bffr_1 TYPE tp_bffr_1_tab .
    DATA: st_bffr_1 LIKE LINE OF it_bffr_1 .

    FIELD-SYMBOLS: <st_bffr_1> LIKE LINE OF it_bffr_1 .

    LOOP AT it_sflight ASSIGNING <st_sflight> .

    st_bffr_1-sflight = <st_sflight> .
    st_bffr_1-row_type = gc_type_lvl_10 .
    APPEND st_bffr_1 TO it_bffr_1 .

    CLEAR: st_bffr_1-sflight-fldate .
    st_bffr_1-row_type = gc_type_lvl_20 .
    COLLECT st_bffr_1 INTO it_bffr_1 .

    CLEAR: st_bffr_1-sflight-fldate,st_bffr_1-sflight-planetype .
    st_bffr_1-row_type = gc_type_lvl_30 .
    COLLECT st_bffr_1 INTO it_bffr_1 .

    CLEAR: st_bffr_1-sflight-connid .
    st_bffr_1-row_type = gc_type_lvl_40 .
    COLLECT st_bffr_1 INTO it_bffr_1 .


    SORT it_bffr_1 BY carrid connid planetype fldate .

    * Now we transfer the it_bffr_1 data to the final table.
    * Now we can add styles ,colors etc.

    LOOP AT it_bffr_1 ASSIGNING <st_bffr_1> .

    CLEAR st_alv_data_1 .

    st_alv_data_1-bffr_1 = <st_bffr_1> .

    APPEND st_alv_data_1 TO it_alv_data_1 .


    ENDFORM . "get_data_1


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.