Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Former Member
Not what you were looking for? View more on this topic or Ask a question