Application Development 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: 

How to Color Specific Row with SALV Factory Method with Dynamic Internal Table?

Former Member
0 Kudos

Hi everyone,

I have one report which is written by SALV Factory Method, and main table is created dynamic.

I need to color one specific row , I couldnt still achieve this.

I tried to add field one field which has type of 'lvc_s_scol' but I couldnt see it in my dynamic internal table,

thats way I couldnt fill the values for lvc_s_scol field.

Is there any solution to color a specific row in dynamic internal table which report was written by salv factory method?

,

any help will be apprecited ,

thank you

best regards.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

You wrote:


How to Color Specific Row

(...)

I tried to add field one field which has type of 'lvc_s_scol' but I couldnt see it in my dynamic internal table,

Which tool did you use to create the itab, which error did you get when adding an element with either type LVC_T_SCOL for cell colot or a single CHAR length 4 field for row color (and not a LVC_S_SCOL?)

Ref: Look for Coloring Rows and/or Coloring Cells in online help.

Regards,

Raymond

4 REPLIES 4

raymond_giuseppi
Active Contributor
0 Kudos

You wrote:


How to Color Specific Row

(...)

I tried to add field one field which has type of 'lvc_s_scol' but I couldnt see it in my dynamic internal table,

Which tool did you use to create the itab, which error did you get when adding an element with either type LVC_T_SCOL for cell colot or a single CHAR length 4 field for row color (and not a LVC_S_SCOL?)

Ref: Look for Coloring Rows and/or Coloring Cells in online help.

Regards,

Raymond

0 Kudos

Hi,

I used the method of create_dynamic_table as u see in the below,

I didnt get any error, when I added the field 'lvc_t_scol' in my internal table,

after creating dynamic itab ,the field doesnt seem on my dynamic table.

Does dynamic table support the field which type is table type(lvc_s_scol)?

thanks

CALL METHOD cl_alv_table_create=>create_dynamic_table

     EXPORTING

       it_fieldcatalog = gt_lvcfcat

     IMPORTING

       ep_table        = gt_newtable.

   ASSIGN gt_newtable->* TO <gt_newtable> .

0 Kudos

You should use RTTS instead of the method cl_alv_table_create=>create_dynamic_table. Refer to Dynamic Internal Table with Deep structure - ABAP Help Blog for creating deep dynamic table using RTTS.

For color:


          ls_s_color-color-col = col_positive.

          ls_s_color-color-int = 0.

          ls_s_color-color-inv = 0.

          APPEND ls_s_color TO lt_s_color.

     CLEAR  ls_s_color.


*     Modify that data back to the output table

      la_vbak-t_color = lt_s_color.



*   COLUMNS tab reference for the specific colors

    TRY.

        lo_cols_tab->set_color_column( 'T_COLOR' ).

      CATCH cx_salv_data_error.                         "#EC NO_HANDLER

    ENDTRY.

Refer to http://zevolving.com/2008/10/salv-table-9-apply-colors/ for applying the color at row level on SALV.

Regards,
Naimesh Patel

0 Kudos

Try to add a break-point at statement "generate subroutine pool" of include "LSKBHF06", look at generated values in lt_source.


Regards,

Raymond