cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding row wise editing in ALV using cell variant

Former Member
0 Kudos

Hi All,

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 h (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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Take two context attributes one is for cell_variant of type string and the other is context attribute of your column C.

Populate values into these two attributes.Then add key to the cell variant and set editor with link to action..

check this link and see the Thomas reply.

Thanks

Suman

Former Member
0 Kudos

check this code ...

I have created check box for some cells and text views for some cells in one column.

method get_flight_details .

data:node_flights type ref to if_wd_context_node,

it_flights type sflight_tab1,

ls_flights type sflight,

it_final type if_componentcontroller=>elements_flights,

ls_final type if_componentcontroller=>element_flights.

select * from sflight into table it_flights

up to 100 rows.

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

loop at it_flights into ls_flights.

move-corresponding ls_flights to ls_final.

if ls_final-price = '185.00'.

ls_final-readonly = abap_true.

ls_final-celldesign =

cl_wd_table_column=>e_cell_design-badvalue_light.

ls_final-cell_variant = 'TEXT_VIEW'.

else.

ls_final-readonly = ' '.

ls_final-celldesign =

cl_wd_table_column=>e_cell_design-goodvalue_light.

ls_final-cell_variant = ' '.

endif.

append ls_final to it_final.

endloop.

node_flights->bind_table(

new_items = it_final

set_initial_elements = abap_true

  • INDEX = INDEX

).

data: l_ref_cmp_usage type ref to if_wd_component_usage.

l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).

if l_ref_cmp_usage->has_active_component( ) is initial.

l_ref_cmp_usage->create_component( ).

endif.

data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

data:

l_value type ref to cl_salv_wd_config_table.

l_value = l_ref_interfacecontroller->get_model(

).

*How to use cell variant

data:lr_check type ref to CL_SALV_WD_UIE_CHECKBOX,

l_cv type ref to cl_salv_wd_cv_standard,

l_column2 type ref to cl_salv_wd_column,

lr_text type ref to CL_SALV_WD_UIE_TEXT_VIEW.

l_column2 = l_value->if_salv_wd_column_settings~get_column( 'CONNID' ).

CREATE OBJECT lr_check

EXPORTING

checked_fieldname = 'CONNID'

.

  • Create check boxes

l_column2->set_cell_editor( lr_check ).

  • To make some cells Text views

CREATE OBJECT lr_text.

lr_text->set_text( value = 'Check' ).

CREATE OBJECT l_cv.

l_cv->set_key( value = 'TEXT_VIEW' ).

l_cv->set_editor( value = lr_text ).

l_column2->add_cell_variant( r_cell_variant = l_cv ).

l_column2->set_sel_cell_variant_fieldname( 'CELL_VARIANT' ).

l_value->if_salv_wd_column_settings~delete_column( id = 'CELL_VARIANT' )

.

endmethod.

this is working apply same code in your case too.

Thanks

suman

Former Member
0 Kudos

Hi Suman,

i tried with the same code... i m getting checkboxes as in some rows it got clicked.in some other initial .like wise i tries for my requirement.

ie i need to give link to action for one column.that to row wise based on another column values.

ie. in one cloumn ,in some rows it have link to action ,in other rows it must be non editable

How can enable & Disable in one cloumn of ALV...

Please help me to resolve this.

Regards,

Ravi.

Former Member
0 Kudos

Hi Suman,...

Thanks alot .My problem is solved according to you and with thread by Thomas ..

Regards,

Ravi

Answers (0)