Skip to Content
avatar image
Former Member

Colour in Input field.

Hi all,

Can I use different colours inside input field ? If yes how and if no then my problem is -


I want user to enter one digit or one alphabet in each of my 12 different input fields and its colour has to be different for alphabets and letters and special characters if any.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 05, 2008 at 06:03 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 05, 2008 at 06:15 AM

    Hi,

    Yes this is possible you can give different colors to the different cells.Please check the below code.

    In this code for PRICE column depend up on the price condition i am assigning different colors.

    method wddomodifyview .
    data: obj_table type ref to cl_wd_table,
          lr_column type ref to cl_wd_table_column,
          lr_column1 type ref to cl_wd_table_column,
          lr_input type ref to cl_wd_input_field,
          lr_input1 type ref to cl_wd_input_field.
    
    data:
      node_flights type ref to if_wd_context_node,
      ls_flights type if_main=>element_flights,
      ls_flights1 type sflight,
      it_flights type if_main=>elements_flights,
      it_final type if_main=>elements_flights,
      lr_header type ref to cl_wd_caption.
    
    * navigate from <CONTEXT> to <FLIGHTS> via lead selection
      node_flights = wd_context->get_child_node( name = 'FLIGHTS' ).
    
    select * from sflight
      into corresponding fields of table it_flights up to 100 rows.
    *  where carrid = 'AZ'.
    
    
    obj_table ?= view->get_element( 'TABLE1' ).
    obj_table->set_visible_row_count( value = 50  ).
    
    lr_column = obj_table->get_column(
                   id         = 'TABLE1_PRICE'
    *              INDEX      = INDEX
                     ).
    
    lr_header  = lr_column->get_header( ).
    lr_header->set_text( value = 'Money'   ).
    lr_column->set_header( the_header = lr_header   ).
    
    
    lr_column1 = obj_table->get_column(
                   id         = 'TABLE1_CARRID'
    *              INDEX      = INDEX
                     ).
    
    
    lr_input = cl_wd_input_field=>new_input_field(
          bind_value          = 'FLIGHTS.PRICE'
          id                  = 'IP1'
            ).
    
     lr_input->set_read_only( value = abap_false   ).
     lr_input1 = cl_wd_input_field=>new_input_field(
          bind_value          = 'FLIGHTS.CARRID'
          id                  = 'IP2'
            ).
    
     lr_input1->set_read_only( value = abap_false   ).
    
    
    loop at it_flights into ls_flights .
     if ls_flights-price = '185.00'.
        ls_flights-readonly = abap_true.
     ls_flights-cell_design =
    cl_wd_table_column=>e_cell_design-badvalue_dark.
    else.
     ls_flights-cell_design =
    cl_wd_table_column=>e_cell_design-goodvalue_medium.
    endif.
     append ls_flights to it_final.
    endloop.
    
    lr_column->bind_cell_design( path = 'FLIGHTS.CELL_DESIGN'  ).
    lr_input->bind_read_only( path = 'FLIGHTS.READONLY'   ).
    lr_column->set_table_cell_editor( the_table_cell_editor = lr_input  ).
    lr_column1->set_table_cell_editor( the_table_cell_editor = lr_input1  ).
    
    
    *lr_column->set_cell_design( value =
    *CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GOODVALUE_MEDIUM   ).
    
    node_flights->bind_table(
           new_items            = it_final
    *       SET_INITIAL_ELEMENTS = ABAP_TRUE
    *       INDEX                = INDEX
              ).
    
    endmethod.

    Thanks

    Suman

    Add comment
    10|10000 characters needed characters exceeded