Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set only one line of a oo alv grid?

Former Member
0 Kudos
348

Hi,

I've got a questions that is, i want to on double click on a line it's became editable.

But the editable is to be on the same list, no pop up, no edition screen.

thkzs all

Regards

Jaime Cordeiro

5 REPLIES 5

Former Member
0 Kudos
209

Hi Jaime, perhaps this will help you if you are using cl_gui_alv_grid.....

-


Class definition----


CLASS lcl_event_handler DEFINITION.

....

edit_row FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING es_row_no,

-


Implementation----


METHOD edit_row.

DATA: l_cond TYPE ty_cond,

ls_celltab TYPE lvc_s_styl,

lt_celltab TYPE lvc_t_styl,

l_row TYPE lvc_s_roid.

l_row = es_row_no.

CLEAR l_cond-celltab[].

ls_celltab-fieldname = 'FIELD1'.

ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

INSERT ls_celltab INTO TABLE lt_celltab.

ls_celltab-fieldname = 'FIELD2'.

ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.

INSERT ls_celltab INTO TABLE lt_celltab.

INSERT lines of lt_celltab INTO TABLE l_cond-celltab.

MODIFY i_cond FROM l_cond INDEX l_row-row_id TRANSPORTING celltab.

CALL METHOD alvgrid->set_ready_for_input

EXPORTING

i_ready_for_input = 1.

CALL METHOD alvgrid->refresh_table_display.

-


l_cond above is the data type you're displaying -- to control the editability you must have this field at the end of your type

-


TYPES : BEGIN OF your_type.

field1 ...

field2 ....

celltab TYPE lvc_t_styl,

END OF your_type.

-


then you must tell the grid display layout the name of the field that controls editability -


gs_layout-stylefname = 'CELLTAB'.

CALL METHOD alvgrid->set_table_for_first_display

EXPORTING

is_layout = gs_layout

Former Member
0 Kudos
209

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">This is a general tutorial on CL_GUI_ALV_GRID</a>

Former Member
0 Kudos
209

Hi,

Thzs for the quick answers.

My question is a bit tricky that is on the double click event only that line became editable and not the all ALV.

To turn all of the ALV editable on double click is safe, i want is only one single line editable and the rest non editable.

Best regards

Jaime Cordeiro

Former Member
0 Kudos
209

I advise you to call another screen with double click the single line, and you can edit the data of this line on that screen. After edited, you press 'save' botton to change the internal table. refresh ALV, then.

How do you think of this way?

regards,

huch.

0 Kudos
209

Hi Chunhai Hu,

thzs for the idea, that's the solution that is implemented.

I wanted to edit only one line but it see it not possible.

I wanna thank you all for the help

Regards

Jaime Cordeiro