Quantcast
Channel: SCN : All Content - Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 3667

Color the Table cell based on the value of the cell.

$
0
0

Hi All,

 

I got a design requirement to color the table cell with red in the shopping cart line item only if it has value.

 

Here is my demo webdynpro -> Modifyview. Firstly I enhanced the context structure adding COLOR field and it is working as desired but where as in the actual requirement i can add this filed in the item structure because it's standard generated by configuration. I don't want to mess up the standard structure adding the color field

 

Need expert's help to do this dynamically with adding field to structure.

 

DATA: lo_cl_wd_table TYPE REF TO cl_wd_table,

           lo_cl_wd_table_column  TYPE REF TO cl_wd_table_column,

 

 

   lo_cl_wd_table ?= view->get_element( id = 'OUT_TABLE' ).

   lo_cl_wd_table_column ?= lo_cl_wd_table->get_grouped_column( id = 'OUT_TABLE_CARRID' ).

   lo_cl_wd_table_column->bind_cell_design( path = 'TB_SFLIGHT.COLOR' ).

 

 

 

   DATA lo_nd_tb_sflight TYPE REF TO if_wd_context_node.

   DATA: lo_el_tb_sflight  TYPE REF TO if_wd_context_element.

    DATA lt_tb_sflight TYPE wd_this->elements_tb_sflight.

   FIELD-SYMBOLS <ls_tb_sflight> TYPE wd_this->element_tb_sflight.

 

   lo_nd_tb_sflight = wd_context->get_child_node( name = wd_this->wdctx_tb_sflight ).

   lo_nd_tb_sflight->get_static_attributes_table( IMPORTING table = lt_tb_sflight ).

 

 

   LOOP AT lt_tb_sflight  ASSIGNING <ls_tb_sflight>.

     IF <ls_tb_sflight>-carrid = 'AF'.

       <ls_tb_sflight>-color = '64'.

     ENDIF.

   ENDLOOP.


  lo_nd_tb_sflight->bind_table(    EXPORTING new_items  = lt_tb_sflight  ).


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>