‎2007 Jul 27 11:53 AM
Hi all,
As per my requirement, my ALV Grid should be able to edit the cell. I achieved editing output.
But my doubt is When i edit a cell, I can enter a maximum of 10 characters in the editable cell even if i edit a cell which has 20 characters, but not more than that.
What is the reason behind that?
Your efforts will be appreciated.
Regards,
Pavan
‎2007 Jul 27 11:55 AM
HI
CHANGE THE LENGTH OF THE FIELD IN THE CATALOG
regards
ravish
<b>plz dont forget to reward points if useful</b>
‎2007 Jul 27 11:55 AM
HI
CHANGE THE LENGTH OF THE FIELD IN THE CATALOG
regards
ravish
<b>plz dont forget to reward points if useful</b>
‎2007 Jul 27 11:57 AM
The length of the fieldcat in that field is of 20 characters. But i can enter only 10 characters.
I've checked your answer but couldn't be resolved.
‎2012 Feb 11 1:02 PM
Hi
I want to edit specific cell in ALV using OOPS at runtime i.e. If there are 10 rows and 10 columns in a table
Now I select 5 rows randomly and I have to edit only one column for that selected 5 rows as well after edit i have to save that changed values to database
Please suggest me how can I do.
I will appreciate if you will give me some examples
Thanks.
‎2007 Jul 27 11:57 AM
‎2007 Jul 27 11:59 AM
Hi
try like this gs_layout-edit = '20'.
Check this sample report
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_MODECheck out these sample programs
BCALV_GRID_01
This program illustrates how the events for print processing PRINT_TOP_OF_PAGE,
PRINT_END_OF_PAGE, PRINT_TOP_OF_LIST,PRINT_END_OF_LIST are handled. The
corresponding handler methods control the appearance of the list printed.
BCALV_GRID_02
Show a detail list in an amodal window. There is no second dynro needed in contrast to
BCALV_GRID_03.
BCALV_GRID_03
This program implements a function on event DOUBLE_CLICK. According to the selected line data
from table SBOOK is selected and displayed by a second ALV Control in a dialog dynpro.
BCALV_GRID_04
Illustrates the use of exceptions (lights or leds). According to the values of SFLIGHT-SEATSOCC, the
lights are set to 1 (red), 2 (yellow) or 3 (green).
BCALV_GRID_05
Demonstrate the creation of an own toolbar button.
BCALV_GRID_06
Demonstrate the creation of an own context menu.
BCALV_GRID_07
Append a menu button to the standard toolbar.
BCALV_GRID_08
Append a menu with default button to the standard toolbar. It is exactly the same as
BCALVC_TB_WITH_MENU except for methods HANDLE_MENU_BUTTON and HANDLE_TOOLBAR.
Editable ALV grids
BCALV_EDIT_01
This report illustrates the simplest case of using an editable/noneditable ALV Grid Control.
BCALV_EDIT_02
This report illustrates how to set chosen cells of an ALV Grid Control editable.
BCALV_EDIT_03
In this example the user may change values of fields SEATSOCC (occupied seats) and/or PLANETYPE.
The report checks the input value(s) semantically and provides protocol messages in case of error
BCALV_EDIT_04
This report illustrates how to add and remove lines to a table using the ALV Grid Control and how to
implement the saving of the new data.
BCALV_EDIT_05
This example shows how to use checkboxes within an ALV Grid Control. You learn:
(1) how to define a column for editable checkboxes for an attribute of your list
(2) how to evaluate the checked checkboxes
(3) how to switch between editable and non-editable checkboxes
BCALV_EDIT_06
This example shows how to define a dropdown listbox for all cells of one column in an editable ALV
Grid Control.
BCALV_EDIT_07
This example shows how to define dropdown listboxes for particular cells of your output table.
BCALV_EDIT_08
This report implements an ALV Grid Control with an application specific F4 help. The following aspects
are dealt with:
(1) how to replace the standard f4 help
(2) how to pass the selected value to the ALV Grid Control
(3) how to build an f4 help, whose value range depend on a value of another cell.
Check this link tooo
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/07/23/oopsALVin+ABAP&showComments=true
Reward all helpfull answers
Regards
Pavan
Message was edited by:
Pavan praveen
‎2007 Jul 27 12:10 PM
gs_layout-edit is a character variable of size 1. It has values 'X' or ' '.
gs_layout-edit = '20' has no significance.
Regards,
Pavan
‎2007 Jul 27 12:25 PM
This thread couldn't provide me answers, so i'm using another thread