Application Development and Automation 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: 
Read only

alv

Former Member
0 Likes
725

can anyone suggest me how to make ALV girid editable???

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
693

Set the edit option in the field-catalog...

w_fldcat-edit = 'X'.

Refer these program for more on this.

BCALV_EDIT_01

BCALV_EDIT_02

can anyone suggest me how to make ALV girid editable???

6 REPLIES 6
Read only

Former Member
0 Likes
693

Hi,

Check the following link:

http://sapdev.co.uk/reporting/alv/alvgrid_editable.htm

Regards,

Bhaskar

Read only

Former Member
0 Likes
693

hi there....

check the demo programs BCALV_FULLSCREEN_GRID_EDIT

BCALV_GRID_EDIT

BCALV_TEST_GRID_EDIT_01

BCALV_TEST_GRID_EDITABLE

Just to make things a bit easy

In the layout,there is a property called edit, make it 'X' for the particular field whichever you want to make editable.

hope it helps....

tc

Read only

Former Member
0 Likes
694

Set the edit option in the field-catalog...

w_fldcat-edit = 'X'.

Refer these program for more on this.

BCALV_EDIT_01

BCALV_EDIT_02

Read only

Former Member
0 Likes
693

Hi SaiPriya...

go through this link... its good..

/people/david.halitsky/blog/2007/04/24/so-youve-got-to-code-an-editable-alv-inside-an-sap-provided-exit-and-x-function-group

Regard with Points if Useful

Karan

Read only

Former Member
0 Likes
693

HI.

PROGRAM BCALV_EDIT_01.

*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

  • As far as the edit feature is concerned

  • a cell of the alv grid control can have the following states:

  • 1.non-editable : edit feature not set for this cell

  • 2.editable : edit feature set for this cell

  • The second state ("editable") has two substates:

  • 2a.editable and not ready for input:edit feature set but not active

  • 3b.editable and ready for input :edit feature set and active

  • In this example, all cells are set "editable".

  • You switch between "editable and not ready for input" and

  • "editable and ready for input" using method SET_READY_FOR_INPUT.

*----

-


  • To check program behavior

  • ~~~~~~~~~~~~~~~~~~~~~~~~~

  • Switch the state using the "Display/Change" icon. Initially,

  • the whole grid is in state "editable and deactivated".

  • After switching the state you may change values and enter new

  • lines. No semantic checks are made in this example.

*----

-


  • Essential steps (search for '§')

  • ~~~~~~~~~~~~~~~

  • 1.Set status of all cells to editable using the layout structure.

  • 2.Use SET_READY_FOR_INPUT to activate the edit feature initially.

  • (state "editable activated").

  • 3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.

  • 4.Use SET_READY_FOR_INPUT to switch between the substates.

*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

DATA: ok_code LIKE sy-ucomm,

save_ok like sy-ucomm,

g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',

g_grid TYPE REF TO cl_gui_alv_grid,

g_custom_container TYPE REF TO cl_gui_custom_container,

gs_layout TYPE lvc_s_layo,

g_max type i value 100.

DATA: gt_outtab type table of sflight.

*----


*

  • MAIN *

*----


*

CALL SCREEN 100 starting at 1 1..

*----


*

  • MODULE PBO OUTPUT *

*----


*

MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

set TITLEBAR 'MAIN100'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = g_container.

CREATE OBJECT g_grid

EXPORTING i_parent = g_custom_container.

*§1.Set status of all cells to editable using the layout structure.

gs_layout-edit = 'X'.

select * from sflight into table gt_outtab up to g_max rows.

CALL METHOD g_grid->set_table_for_first_display

EXPORTING i_structure_name = 'SFLIGHT'

is_layout = gs_layout

CHANGING it_outtab = gt_outtab.

*§2.Use SET_READY_FOR_INPUT to allow editing initially.

  • (state "editable and ready for input").

CALL METHOD g_grid->set_ready_for_input

EXPORTING i_ready_for_input = 1.

ENDIF.

ENDMODULE.

*----


*

  • MODULE PAI INPUT *

*----


*

MODULE pai INPUT.

save_ok = ok_code.

clear ok_code.

CASE save_ok.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN 'SWITCH'.

PERFORM switch_edit_mode.

WHEN OTHERS.

  • do nothing

ENDCASE.

ENDMODULE.

*----


*

  • FORM EXIT_PROGRAM *

*----


*

FORM exit_program.

LEAVE PROGRAM.

ENDFORM.

*&----


*

*& Form SWITCH_EDIT_MODE

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM switch_edit_mode.

*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.

IF g_grid->is_ready_for_input( ) EQ 0.

*§4.Use SET_READY_FOR_INPUT to switch between the substates.

CALL METHOD g_grid->set_ready_for_input

EXPORTING i_ready_for_input = 1.

ELSE.

CALL METHOD g_grid->set_ready_for_input

EXPORTING i_ready_for_input = 0.

ENDIF.

ENDFORM. " SWITCH_EDIT_MODE

Reward all helpfull answers.

Regards.

Jay

Read only

Former Member
0 Likes
693

thanks for the reply