cancel
Showing results for 
Search instead for 
Did you mean: 

ALV: set different cell editor for single cell

Former Member
0 Kudos

Hi,

I have an ALV in my Webdynpro and in some cases i want a single cell to become a drop-down list. In all other cases it has to be a normal field.

I'm familiar with changing the entire column to a dropdown box, but i want to change only a single cell.

Has anyone got an idea how to establish this?

Many thanks in advance,

Jos

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hie Jos van Hinsberg ,

i went through the solution you gave for individual cell editor.I have a query similar to yours though not very much similar....I need seperate f4 help for every cell in a column,as in the f4 help should give different o/os for every cell and should not be common with any cell of that column.So i have to fetch the data for f4 help from different dictionary for every cell.

I m sure you can give me some hint on how to go about it.

thnx and regards.....

Vinit.B.Mehta

Former Member
0 Kudos

All right lets get things aligned first...

Are you trying to use a table but every cell of the <b>same column</b> should have a different F4 help?? This sounds quite confusing.

When you define a context node you should reference to a particular dictionary type for every column.

This allows you to add a value help which belongs to the dictionary type.

If you don't want to use this option...

You should use the freely programmed F4 help for this particular column.

See this link to SAP help:<a href="http://help.sap.com/saphelp_nw04s/helpdata/en/5d/395e4254139041e10000000a1550b0/frameset.htm">Input help</a> . With the freely used F4 help you can provide every imaginable F4 help you want ( as long as you can create it! ).

Hope this helps.

Kind regards,

Jos

Former Member
0 Kudos

Well this is quite general, but i think you can manage to modify it for your own use.

METHOD alv_cell_variant.

DATA:

zlo_cell_var TYPE REF TO cl_salv_wd_cv_standard,

zlo_checkbox TYPE REF TO cl_salv_wd_uie_checkbox,

zlo_header TYPE REF TO cl_salv_wd_column_header,

zlo_textview TYPE REF TO cl_salv_wd_uie_text_view,

zls_column TYPE salv_wd_s_column_ref,

zlt_columns TYPE salv_wd_t_column_ref,

zlo_node TYPE REF TO if_wd_context_node,

zlt_flights TYPE if_componentcontroller=>elements_flights,

zls_flights TYPE if_componentcontroller=>element_flights,

zlv_erg TYPE i.

  • get flights from context

zlo_node = wd_context->get_child_node( 'FLIGHTS' ).

zlo_node->get_static_attributes_table( IMPORTING table = zlt_flights ).

  • add information, what cellvariant shall be used for which cell in Master Data Table

  • every second line, use the cellvariant having the name TEXT_VIEW for all cells

  • this information will overwrite general column information

LOOP AT zlt_flights INTO zls_flights.

zlv_erg = sy-tabix MOD 2.

IF zlv_erg = 0.

zls_flights-cellvariant = 'TEXT_VIEW'.

ENDIF.

MODIFY zlt_flights FROM zls_flights.

ENDLOOP.

zlo_node->bind_table( zlt_flights ).

*-Get the Columns

zlt_columns = ic_model->if_salv_wd_column_settings~get_columns( ).

LOOP AT zlt_columns INTO zls_column.

CREATE OBJECT zlo_cell_var.

zlo_cell_var->set_key( 'TEXT_VIEW' ).

CREATE OBJECT zlo_textview.

zlo_textview->set_text_fieldname( zls_column-id ).

zlo_cell_var->set_editor( zlo_textview ).

zls_column-r_column->add_cell_variant( r_cell_variant = zlo_cell_var ).

zls_column-r_column->set_sel_cell_variant_fieldname( 'CELLVARIANT' ).

CASE zls_column-id.

WHEN 'CHECK'.

CREATE OBJECT zlo_checkbox

EXPORTING checked_fieldname = zls_column-id.

zls_column-r_column->set_cell_editor( zlo_checkbox ).

zlo_header = zls_column-r_column->get_header( ).

zlo_header->set_text( 'Check' ).

........

ENDCASE.

ENDLOOP.

ENDMETHOD.

Make sure you add an extra element to your context node (in this case "CELLVARIANT" type STRING).

The variable ic_model is a reference to "cl_salv_wd_config_table".

If you want to change just a single cell_editor, just change the text in the field "CELLVARIANT" to the type of cell_editor you prefer, and make sure that this cell_editor is used by assigning it as the type.

Hope this is helpful!

Jos

Former Member
0 Kudos

Hi Jos,

i have the same requirement like above.ie row wise editable.

My case is for single fielid.ie i have three fields in my alv report.

A B C

x 1 l (link to action)

y 3 h

x 2 m (link to action)

x 4 t (link to action)........................etc

like abovw whever the value of "A" = x we need to give the link to action to the cloumn "C" at that row.....

How can i achieve that.............

please help me to resolve this.................

Regards,

Ravi

Former Member
0 Kudos

Hi,

That's quite simple.

In my example code above, just replace the textview with a link to action (make sure you define the object of the right type. CL_WD_LINK_TO_ACTION)

Define an action in your View an map this action to your object. (method SET_ON_ACTION).

Good luck with it.

Regards,

Jos

Former Member
0 Kudos

Can you please share you experience, prefebly coding as I also need to have same functionality .

Regards

Rohit Chowdhary

Former Member
0 Kudos

Ok, i already solved it.

Took some time... But it was worth it.