Skip to Content

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

Regarding row wise editing in ALV using cell variant

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

Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question