cancel
Showing results for 
Search instead for 
Did you mean: 

color Row in ALV

Former Member
0 Kudos

Hi All

I have an requirement of COLORING a Row in ALV in webdynpro

There are few ways in module pool ALV but in ALV webdynpro i am not getting how to do it.

Please help

Regards

Amarendra Tripathi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Amarendar,

Just look at the following code ,you may get something out of it.


          DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

          lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
           IF lo_cmp_usage->has_active_component( ) IS INITIAL.
                       lo_cmp_usage->create_component( ).
           ENDIF.

           DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
           lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).

            DATA lo_value TYPE REF TO cl_salv_wd_config_table.
            lo_value = lo_interfacecontroller->get_model(  ).

             data: lr_column_settings type ref to if_salv_wd_column_settings,
             lr_column          type ref to cl_salv_wd_column,
             lr_column_header   type ref to cl_salv_wd_column_header.

             data : lt_column type salv_wd_t_column_ref,
              ls_column type salv_wd_s_column_ref.

              data:  lr_field_amnt type ref to cl_salv_wd_field.
              data: lv_aggr_rule   type ref to cl_salv_wd_aggr_rule.
              data: lr_sort_rule   type ref to cl_salv_wd_sort_rule.


              lr_column_settings ?= lo_value.

              lt_column = lr_column_settings->get_columns( ).


               * for a particular cell color.
                loop at itab into ls_sflight.
                 if ls_sflight-carrid = 'AA'.
                         ls_sflight-celldesign =
                        cl_wd_table_column=>e_cell_design-goodvalue_light.
 
                        modify itab from ls_sflight.
                 endif.
                 endloop.

                  loop at lt_column into ls_column.

                          case ls_column-id.
                           when 'PRICE'.
                  * logic for colouring the column*
                          CALL METHOD ls_column-r_column->set_cell_design_fieldname
                              EXPORTING
                          value = 'CELLDESIGN'."cl_wd_table_column=>e_cell_design-bad_light.
                  endloop.
                       

former_member199125
Active Contributor
0 Kudos

hi,

There were so many topics and posts about coloring in alv cells. Please search it.

or search by set_cell_design , it's a method to set the color.

search and let me know if you still din't get , i wl provide.

Regards

`srinivas

Former Member
0 Kudos

HI Srinivas,

I have tried finding it alot but there are methods for Coloring column in webdynpro ALV and coloring row in module pool

but there is no method for coloring row in alv

if you know how to color row as you said then please tell.

Regards

Amarendra

Former Member
0 Kudos

Hi,

I think there is no particular method to color ALV row, follow the procedure of coloring for all the cells.

Please go through this...

https://wiki.sdn.sap.com/wiki/display/Snippets/ABAPWebDynproALV-ChangeCellColourbasedonContent

Thanks,

Shailaja Ainala.

arjun_thakur
Active Contributor
0 Kudos

Hi Amarendra,

You can use the set_design method of interface if_salv_wd_table_settings to set the color of the rows of the ALV.

refer the following code:


DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
DATA: lr_header TYPE REF TO cl_salv_wd_header.
  DATA: lr_column_settings type ref to if_salv_wd_column_settings.
  DATA: lr_column type ref to cl_salv_wd_column.
  DATA: lr_header_col type ref to cl_salv_wd_column_header.
  DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
  DATA l_table TYPE REF TO cl_salv_wd_config_table.

  lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
  IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
  ENDIF.

  l_salv_wd_table = wd_this->wd_cpifc_alv( ).
  l_table = l_salv_wd_table->get_model( ).
  lr_table_settings ?= l_table.
  lr_header = lr_table_settings->get_header( ).

CALL METHOD lr_table_settings->set_design
  EXPORTING
    value  = CL_WD_TABLE=>E_DESIGN-ALTERNATING.

There are 4 standard values that you could pass to the set_design method:

CL_WD_TABLE=>E_DESIGN-ALTERNATING

CL_WD_TABLE=>E_DESIGN-STANDARD

CL_WD_TABLE=>E_DESIGN-TRANSPARENT

CL_WD_TABLE=>E_DESIGN-TRANSPARENT_WITH_GRID

I hope it helps.

Regards

Arjun