cancel
Showing results for 
Search instead for 
Did you mean: 

customizing a specific row in a table ( making bold and add colour )

Former Member
0 Kudos

Hi,

I want to change some particular row based on some condition by making it bold and adding color to them..

how can this be done?

Thanks

Akash

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Akashdeep,

Follow this link....

Surely ur problem will be solved....

Regards,

Rohit

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Akashdeep,

If you are working for table,so defaultly all the columns are text views,so text views has the property design and semantic color to change the style and color of the text view.To do this

Create 2 attributes one is for design of type WDUI_TEXT_VIEW_DESIGN and color of type WDUI_TEXTVIEW_SEM_COL in addition to your context node attributes.

Then write the below logic in the method WDDOMODIFYVIEW.

method WDDOMODIFYVIEW .
here i populated design and color attributes conditionally.
DATA:lo_nd_hcm TYPE REF TO if_wd_context_node,
        lo_el_hcm TYPE REF TO if_wd_context_element,
        ls_hcm TYPE wd_this->element_hcm,
        it_hcm type table of wd_this->element_hcm,
        it_final type table of wd_this->element_hcm,
        ls_final type wd_this->element_hcm,
        l_var type abap_bool,
        lr_table type ref to cl_wd_table,
        lr_column1 type ref to cl_wd_table_column,
        lr_column2 type ref to cl_wd_table_column.

*  navigate from <CONTEXT> to <HCM> via lead selection
   lo_nd_hcm = wd_context->get_child_node( 'HCM' ).

  select * up to 20 rows from pa0001 into corresponding fields of table it_hcm .
  loop at it_hcm into ls_hcm.
  move-corresponding ls_hcm to ls_final.
  if l_var = abap_true.
   ls_final-design = CL_WD_TEXT_VIEW=>E_DESIGN-HEADER1.
   ls_final-color = CL_WD_TEXT_VIEW=>E_SEMANTIC_COLOR-POSITIVE.
   l_var = abap_false.
  else.
   ls_final-design = ''.
   ls_final-color = ''.
   l_var = abap_true.
  endif.
  append ls_final to it_final.
  endloop.

  LO_ND_hcm->BIND_TABLE(
      NEW_ITEMS            = it_final
      SET_INITIAL_ELEMENTS = ABAP_TRUE ).


  lr_table ?= VIEW->GET_ELEMENT( 'TABLE1' ).
  CALL METHOD LR_TABLE->REMOVE_COLUMN
    EXPORTING
      ID          = 'TABLE1_DESIGN'
*      INDEX      =
    RECEIVING
      THE_COLUMN = lr_column1.


 CALL METHOD LR_TABLE->REMOVE_COLUMN
    EXPORTING
      ID          = 'TABLE1_color'
*      INDEX      =
    RECEIVING
      THE_COLUMN = lr_column2.

endmethod.

Now bind the 2 two attributes to the all the columns text views.

For ALV check my Article

Conditionally Assigning Colors and Input Enable to ALV Columns in Web Dynpro ABAP

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b7...

former_member209217
Active Contributor
0 Kudos

Hi Akashdeep,

Please check the following link

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b7...

Regards,

Lakshman.

Edited by: Lakshman N on Nov 3, 2008 12:29 PM