2008 Jun 03 7:46 AM
2008 Jun 03 7:50 AM
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???
2008 Jun 03 7:47 AM
2008 Jun 03 7:49 AM
2008 Jun 03 7:50 AM
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
2008 Jun 03 7:51 AM
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
2008 Jun 03 8:00 AM
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
2008 Jun 03 12:00 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |