Skip to Content
avatar image
Former Member

Colouring a cell in the ALV report.

Hi All,

I have an ALV report display to which i am inserting a new row. I have to guide the user which cell to insert next. For that i am trying to color the cell in which the next entry is to be made. The following is the code i have written

DATA : lr_text TYPE REF TO cl_salv_wd_uie_text_view,

lr_column TYPE REF TO cl_salv_wd_column,

lr_value TYPE REF TO cl_salv_wd_config_table,

lr_cv TYPE REF TO cl_salv_wd_cv.

If column1 is filled, the next is column2 to be filled. the assistance class gets the dropdown values to be filled to the column2

IF r_param->attribute = 'COLUMN1'.

*Call assistance class method to get dropdown values

wd_assist->get_dropdown_values( EXPORTING

im_requesterid = wd_this->gv_user_id

im_column = r_param->attribute

im_mas_type = 'S'

CHANGING

ch_row = i_new_row

ch_COLUMN2 = i_column2

).

SORT i_COLUMN2 ASCENDING.

CLEAR: x_COLUMN2,x_COLUMN2_valueset.

LOOP AT i_COLUMN2 INTO x_COLUMN2.

x_COLUMN2_valueset-value = x_COLUMN2.

x_COLUMN2_valueset-key = x_COLUMN2.

APPEND x_COLUMN2_valueset TO i_COLUMN2_valueset.

ENDLOOP.

lo_node_info->set_attribute_value_set( EXPORTING

name = 'COLUMN2'

value_set = i_COLUMN2_valueset ).

This is the code i wrote to color the column2 cell. I am using a CELL VARIANT for column2. But i am getting an dump here saying OBJECTS_OBJREF_NOT_ASSIGNED.

lr_column = lr_value->if_salv_wd_column_settings~get_column( 'COLUMN2' ).

CREATE OBJECT lr_cv.

lr_cv->set_key( value = 'COLOR' ).

lr_column->add_cell_variant( r_cell_variant = lr_cv ).

lr_column->set_sel_cell_variant_fieldname( 'COLOR' ).

lr_text->set_semantic_color_fieldname( value = 'BLUE' ) .

ENDIF.

I am new to WebDynpro.Can anyone please guide me wat to write so that i can color the COLUMN2 cell?

Thanks In Advance

Regards,

Heera

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 09, 2009 at 05:23 AM

    set the editor for the cell variant.

    data: lr_ddk type ref to cl_salv_wd_uie_dropdown_by_key.

    lr_ddk = lr_column->get_cell_editor( ). " lr_column is column2 reference

    lr_cv->set_editor( <column2 cell editor>' ).

    however, i don't see design property for the drop down ui element.

    Thanks

    Abhi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 09, 2009 at 09:32 AM

    Hi

    Use ALV class properties to do this.

    http://help.sap.com/saphelp_nw04/helpdata/en/10/e4eb40c4f8712ae10000000a155106/content.htm

    cl_salv_table

    Please refer above articales for your reference.

    Best Regards

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 09, 2009 at 05:27 AM
    Add comment
    10|10000 characters needed characters exceeded