ALV Grid in Edit mode
Dear all,
I would like to do a refresh of the ALV GRID table display in event "handle_data_changed_finished".
"refresh_table_display" is NOT working.
I obviously need to go through PAI & PBO to refresh the table display.
Is there something to syncronize the data?
There must be an easy solution...
bye
Niko
Niko Prindesis
Itelligence AG
Dear Andreas,
thank you!
If I call "SAPGUI_SET_FUNCTIONCODE" in "handle_data_changed_finished", I can trigger the PAI/PBO.
So this solves my problem!
But ...
... isn't there a solution without going through PAI/PBO???
I want to stay in the ALVGrid control!
bye
Niko
Similar Messages
-
Problem with ALV grid in edit mode
Hello, gurus!
I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell. And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
Thanks,
MikhailHi Prabhu,
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
title_of_report = text-010.
SET TITLEBAR '0100' WITH title_of_report.
DATA: g_event_receiver TYPE REF TO lcl_event_handler.
IF z_custom_container IS INITIAL .
CREATE OBJECT z_custom_container
EXPORTING
container_name = 'ALV_ZAC'.
CREATE OBJECT alv_grid
EXPORTING
i_parent = z_custom_container.
g_repid = sy-repid.
gs_variant-report = g_repid.
x_save = 'A'.
PERFORM check_alv_grid_fields.
ps_layout-cwidth_opt = 'X'.
ps_layout-edit = 'X'.
CALL METHOD alv_grid->set_ready_for_input
EXPORTING
i_ready_for_input = '1'.
* CALL METHOD alv_grid->register_edit_event
* EXPORTING
* i_event_id = cl_gui_alv_grid=>mc_evt_enter.
APPEND s_list_rec to it_list_rec.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = ps_layout
is_variant = gs_variant
i_save = x_save
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = it_list_rec[].
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDIF.
FORM check_alv_grid_fields .
DATA: ls_fcat LIKE LINE OF pt_fieldcat.
REFRESH pt_fieldcat .
CLEAR: ps_layout, ls_fcat.
ls_fcat-fieldname = 'VBELN'.
ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table = 'LIPS'. " .
ls_fcat-outputlen = 9.
* ls_fcat-datatype = 'CHAR'.
* ls_fcat-inttype = 'C'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR: ls_fcat.
ls_fcat-fieldname = 'ERDAT'.
ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
ls_fcat-outputlen = 9.
* ls_fcat-f4availabl = 'X' .
* ls_fcat-datatype = 'DATS'.
* ls_fcat-inttype = 'D'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR: ls_fcat.
ENDFORM. " check_alv_grid_fields
FORM save_p .
CLEAR l_valid.
CALL METHOD alv_grid->check_changed_data
IMPORTING
e_valid = l_valid.
IF l_valid IS INITIAL.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-i01
txt1 = text-i02
txt2 = text-i03
txt3 = text-i04.
ELSE.
i_dat_reg = zrumm_prr-cdprr.
CLEAR is_temp_otc.
freshit i_prrpus_fax.
freshit i_list2_ot.
LOOP AT it_list_rec INTO s_list_rec.
MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
i_list2_ot-fgrup = 'RECE'.
i_list2_ot-prrnu = i_num_prr.
APPEND i_list2_ot.
MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
APPEND i_prrpus_fax.
ENDLOOP.
ENDIF.
Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM -
ALV Grid Handle Edit Event (Lost Focus)
Hi all,
I have some problems with the ALV Grid.
Target:
I have an ALV Grid with editable Column. If the user insert, update or delete the content of the column and leave the column (column lost focus) i'd like to do somthing - this means I need a event for this action. Can anybody help me to solve this problem?
Thanks StefanUse Event data_changed and data_changed_finished of the cl_gui_alv_grid.Then all you have to do is registering your event to the ALV and fill the methods with what you want to do.In ALV Grid, There is no event to capture the lost focus of a column if you don't modify it.
CLASS lcl_event_receiver DEFINITION.
METHODS:
*$ Check the change
handle_data_changed FOR EVENT data_changed
OF cl_gui_alv_grid
IMPORTING er_data_changed
e_ucomm
e_onf4
e_onf4_before
e_onf4_after,
handle_data_changed_finished
FOR EVENT data_changed_finished
OF cl_gui_alv_grid
IMPORTING e_modified
et_good_cells
sender,
ENDCLASS. "LCL_EVENT_RECEIVER DEFINITION -
Hello,
I have an ALV grid with an editable checkbox column.
Now I have two problems regarding the colors:
1. as you know, when in edit mode, the colors change. I overrode them with custom colors, but the editable column's cells have still a white margin which I cannot get rid of
2. Zebra layout does not work anymore. If I color the rows with a zebra pattern manually, I would have to re-do it everytime the table is resorted.
Can anyone think of a better way to handle coloring in edit mode?
Thanks a lot.hi,
Chk this link.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
Regards
Reshma -
Dear Colleagues,
I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
Thanks a lot and kind regards
Petervs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
APPEND vs_toolbar_excluding TO i_toolbar_excluding.
* Displaying the output in ALV Grid
vs_layout_grid-no_rowmark = 'X'.
vs_layout_grid-zebra = 'X'.
vs_layout_grid-cwidth_opt = 'X'.
vs_layout_grid-edit = 'X'.
vs_layout_grid-ctab_fname = 'CT'.
vs_layout_grid-stylefname = 'CELLTAB'.
CALL METHOD v_grid->set_table_for_first_display
EXPORTING
i_save = 'X'
is_layout = vs_layout_grid
it_toolbar_excluding = i_toolbar_excluding[]
CHANGING
it_outtab = itab[]
it_fieldcatalog = it_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
STOP.
ENDIF. " IF sy-subrc NE 0
ELSE. " IF w_custom_container...
* Refresh the container if it already exists
CALL METHOD v_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
STOP.
ENDIF. -
hi all,
have a requirement where I have to create a webdynpro for ABAP table for new row/rows entry, delete row/rows and update row/rows data. This is something like table control in normal ABAP.
how can I achieve this? Is there any such feature in ALV component?
Any code sample will be really helpfull.
Please help!
Thanks
RaviHi Ravi Raju
In alv you can edit, add and append rows. First you have to initialize the ALV usage in WDDOINIT method of the view in which SALV_WD_TABLE is added as component usage. Then you have to disable the read only attribute of the ALV. If you set the property to abap_false, then append, insert, delete buttons will be added automaticaly. Then you can set the appropriate cell editor for each column.
initialize ALV Component
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.
Get model data
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( ).
set read only mode to false (and display edit toolbar)
data: lr_table_settings type ref to
if_salv_wd_table_settings.
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
set cell editor for input fields (~make colum editable)
DATA: lr_column TYPE REF TO cl_salv_wd_column.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
lr_column_settings ?= l_value.
lr_column = lr_column_settings->get_column( 'SAMPLE' ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname =
'SAMPLE'.
lr_column->set_cell_editor( lr_input_field ).
Hope it helps ;>)
Regards
Rakesh. -
Group feature at ALV grid with editable columns
Am I right ?
Group function by using a sorted layout is disabled while having one (or more) editable columns, isn't it ?
... or is there a possibility to use gouped rows ?
Greetings
MarkusAlso...
*& Report ZDEMO_ALVGRID_EDIT *
*& Example of a simple ALV Grid Report *
*& The basic ALV grid, Enhanced to display specific fields as *
*& editable depending on field value *
REPORT ZDEMO_ALVGRID_EDIT .
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
field_style TYPE lvc_t_styl, "FOR DISABLE
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: it_fieldcat TYPE lvc_t_fcat, "slis_t_fieldcat_alv WITH HEADER LINE,
wa_fieldcat TYPE lvc_s_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE lvc_s_layo, "slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM set_specific_field_attributes.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-scrtext_m = 'Purchase Order'.
wa_fieldcat-col_pos = 0.
wa_fieldcat-outputlen = 10.
wa_fieldcat-emphasize = 'X'.
wa_fieldcat-key = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-scrtext_m = 'PO Item'.
wa_fieldcat-col_pos = 1.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'STATU'.
wa_fieldcat-scrtext_m = 'Status'.
wa_fieldcat-col_pos = 2.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'AEDAT'.
wa_fieldcat-scrtext_m = 'Item change date'.
wa_fieldcat-col_pos = 3.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-scrtext_m = 'Material Number'.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MENGE'.
wa_fieldcat-scrtext_m = 'PO quantity'.
wa_fieldcat-col_pos = 5.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'MEINS'.
wa_fieldcat-scrtext_m = 'Order Unit'.
wa_fieldcat-col_pos = 6.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'NETPR'.
wa_fieldcat-scrtext_m = 'Net Price'.
wa_fieldcat-edit = 'X'. "sets whole column to be editable
wa_fieldcat-col_pos = 7.
wa_fieldcat-outputlen = 15.
wa_fieldcat-datatype = 'CURR'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'PEINH'.
wa_fieldcat-scrtext_m = 'Price Unit'.
wa_fieldcat-col_pos = 8.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
Set layout field for field attributes(i.e. input/output)
gd_layout-stylefname = 'FIELD_STYLE'.
gd_layout-zebra = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
is_layout_lvc = gd_layout
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO CORRESPONDING FIELDS OF TABLE it_ekko.
ENDFORM. " DATA_RETRIEVAL
*& Form set_specific_field_attributes
populate FIELD_STYLE table with specific field attributes
form set_specific_field_attributes .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
Populate style variable (FIELD_STYLE) with style properties
The NETPR field/column has been set to editable in the fieldcatalog...
The following code sets it to be disabled(display only) if 'NETPR'
is gt than 10.
LOOP AT it_ekko INTO wa_ekko.
IF wa_ekko-netpr GT 10.
ls_stylerow-fieldname = 'NETPR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
"set field to disabled
APPEND ls_stylerow TO wa_ekko-field_style.
MODIFY it_ekko FROM wa_ekko.
ENDIF.
ENDLOOP.
endform. " set_specific_field_attributes
REWARD POINTS IF usefful !! -
Hi
I am displaying one quanity field in alv. which is in Editable mode. while running and editing it is behaving strangly. if I enter the value 7,00 it is becoming 0,07 in the internal table .
Please guide me in this regard.
jaffer vali shaikJaffer Please check the Below.
Case#1.
REPORT ztest_alv_oo22.
TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_cat TYPE slis_fieldcat_alv.
DATA: BEGIN OF it_data OCCURS 0,
vbeln TYPE vbeln,
matnr TYPE matnr,
menge TYPE p DECIMALS 2,
END OF it_data.
DO 10 TIMES.
it_data-menge = '10.00'.
APPEND it_data.
ENDDO.
wa_cat-fieldname = 'VBELN'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'POSNR'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'MENGE'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Qty'.
wa_cat-edit = 'X'.
wa_cat-decimals_out = 2.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
*& Form user_command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
BREAK-POINT.
ENDFORM. "user_command
Case#2. with out Decimals_out option.
REPORT ztest_alv_oo22.
TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_cat TYPE slis_fieldcat_alv.
DATA: BEGIN OF it_data OCCURS 0,
vbeln TYPE vbeln,
matnr TYPE matnr,
menge TYPE p DECIMALS 2,
END OF it_data.
DO 10 TIMES.
it_data-menge = '10.00'.
APPEND it_data.
ENDDO.
wa_cat-fieldname = 'VBELN'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'POSNR'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Test'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
wa_cat-fieldname = 'MENGE'.
wa_cat-tabname = 'IT_DATA'.
wa_cat-seltext_l = 'Qty'.
wa_cat-edit = 'X'.
APPEND wa_cat TO it_fieldcat.
CLEAR wa_cat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_data
EXCEPTIONS
program_error = 1.
*& Form user_command
* text
* -->UCOMM text
* -->SELFIELD text
FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
BREAK-POINT.
ENDFORM. "user_command
Change the Qty in the output and use refresh .
and see. -
ALV Grid Display Editable Field Disables Zebra Style
Hi all,
First of all, I want to say: "I did my research." I found a post with a very similar question but not identically my case, or at least I can't solve it the same way. [Here is the reference post.|Re: Check box impact on ALV grid (Using OOPS)]
My Goal: I have an ALV Grid which I want to display using the ZEBRA style in the layout and also make one field in the field catalog editable.
My Issue: As soon as you make one field editable in the field catalog using the EDIT option, the ZEBRA style in the layout does not works. I also have key fields in the ALV Grid which I want to keep as KEY and which get painted dark blue.
I can't use the individual row coloring method used in the reference link above since this overrides the blue coloring of the key fields in the ALV. I haven't gone through all the effort of individually painting each cell on the grid, and honestly I don't think it is efficient.
My Question: Is there a way to have editable fields in the ALV Grid and keep the ZEBRA setting working?
Please, I will really appreciate if you can read and try to understand my issue before posting incoherent solutions or answers. I don't want to waste anybody's time nor mine.Shiva,
Thanks for your reply; it someway addresses what I am looking for. Unfortunately, I've already went through that reference code; it has exactly the same problem that I am facing.
If you take that code for example, and you throw it u201Cas-isu201D in your ABAP editor you'll see that even when the ZEBRA style is being used in the layout, since the EDIT option in the field catalog is being set for field NETPR, the ZEBRA style gets lost; only the whole editable column gets white. You can go ahead and play a little bit with that piece of code and you will see what I am saying.
Regards -
ALV Grid Options ( Editable/Drill Down)
Hi ,
I have a requirement, in which i need a replace a view content with an editable,drop
down to fields in an ALV grid and should be able to drill down or a pop up view on some of the field
attributes. can you please provide some sample code to do in ABAP WEBDYNPRO.
Thanks and Regards,
KumarHi,
Please refer this article: https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c060fcb4-2c62-2b10-d2b2-f32407a5cc6f
I hope it helps.
Regards
Arjun -
Problem with alv grid control editable
Hello all. I ask your help with this question because I did not find the answer in the forum. Sorry for my pour english.
I have an alv grid control (OO) with the standards buttons 'insert a line', 'delete a line', 'copy a line'.
My problem is I want to catch the event of these buttons, because after I register the events mc_evt_enter y mc_evt_modifies, when I push the button to insert a new line the alv grid show the new line and then get a dump with error: Field symbol has not yet been assigned.
My problem is that no event is launched when I push the button. I tried to catch the event before command but it does not happen.
It is like these standard buttons works apart and it is not possible to find out what they are doing.
I have read the manual easy reference for alv grid control, and I created the class lcl_event_handler exactly equal.
I have tried to debug the code in order to find the error but I can find out where it has been done.
Thank you in advance. If anybody needs to see my code I will send you or post you.David,
What you need to do for that is to enable the editing field by field. You will have to add a field STYLE type LVC_T_STYL to the DATA table. This nested internal table will hold the information for each field of the row, whether the column is editable or not. So, if you have 5 columns, then the nested internal table will have 5 rows for each row of the main internal table.
Once this is done, you will have to append a blank row to the table, making all the fields editable and REFRESH the display.
Regards,
Ravi
Note: Please mark the answers as helpful if they help. -
ALV grid field editable/non editable at runtime
Hi All,
I am working on alv grid using containers. I have to make few cells in grid to editable and few othres to non editable which I did using styles by defining table type lvc_t_styl and updating my main internal table. Now once grid is displayed for first time (using set_table_for_first_display) it has required fields in editable and non editable as required. But now on triggering of data_changed event I have to change the editable cells to non editable and the non editable cells to editable. I tried doing this as same way as I have done before calling set_table_for_first_display method i.e. by defining table of type lvc_t_styl in data_changed event and modifying my main internal table but this time the editable fields are changed to non editable and again becomes editable. Same problem with non editable cells also. They become editable and again becomes non ediatble of there own. Can anyone suggest any solution.
<b>Note: Points awarded for helpful answers</b>
nullHi,
Check this link.I am explaining the steps for this.
Kindly reward points by clicking the star on the left of reply,if it helps.<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database(OOPS)">Editing OOPS ALV</a> -
ALV GRID CELL EDIT without object use
Hi !
I'm not using grid object, I'm using the standard
function.
I want to edit one cell only in the grid,
again - I'm not using the alv grid object.
how can I change the style of one cell.
thank you
AdiHi,
You can edit one column as below.But I am not sure about editing a cell.
DATA: line_fieldcat TYPE slis_fieldcat_alv.
line_fieldcat-fieldname = 'WS_CHAR'.
line_fieldcat-tabname = 'I_DATA'.
line_fieldcat-seltext_l = 'Test Character Field'.
line_fieldcat-datatype = 'CHAR'.
line_fieldcat-outputlen = '15'.
line_fieldcat-edit = 'X'.
APPEND line_fieldcat TO i_fieldcat. " column. -
ALV Grid after EDIT has to UPDATE DB........
Hi,
I am using FM 'REUSE_ALV_GRID_DISPLAY' and in FIELD CATALOG I set EDIT option for some coloumns.
Now every thing is working fine and values are changing in output when I press ENTER after value is changed.
Now I want to know how to catch that changed values in Internal table and I want to Update DATABASE Table.
So let me know what are the events I have to process.
If any one has example code plzzzz post it.
Thanks in advance.Hi,
Here is the sample code.If you executed the program and edited something,then after pressing back you will get the changed value in output.For that,I have used loop..Endloop. after FM.SInce your requirement is to update DB,you use
modify db from table itab.
That will insert/update the entries in db.
Kindly reward points by clicking the star on the left of reply,if it helps.
TYPE-POOLS: slis.
DATA: report_id LIKE sy-repid.
DATA: ws_title TYPE lvc_title VALUE 'An ALV Report'.
DATA: i_layout TYPE slis_layout_alv.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
types : begin of ty,
pernr type pa0001-pernr,
SEQNR type pa0001-seqnr,
end of ty.
data itab type standard table of ty.
data wa type ty.
select pernr seqnr from pa0001 into table itab.
report_id = sy-repid.
PERFORM f1000_layout_init CHANGING i_layout.
PERFORM f2000_fieldcat_init CHANGING i_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = report_id
i_grid_title = ws_title
is_layout = i_layout
it_fieldcat = i_fieldcat
i_save = 'A'
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Use modify statement here instead of loop
<b>loop at itab into wa.
write : / wa-pernr, wa-seqnr.
endloop.</b>
FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.
CLEAR i_layout.
i_layout-colwidth_optimize = 'X'.
i_layout-edit = 'X'.
ENDFORM.
FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.
DATA: line_fieldcat TYPE slis_fieldcat_alv.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'PERNR'. " The field name and the table
line_fieldcat-tabname = 'ITAB'. " name are the two minimum req.
line_fieldcat-key = 'X'. " Specifies the column as a key (Blue)
line_fieldcat-seltext_m = 'Personal No.'. " Column Header
APPEND line_fieldcat TO i_fieldcat.
CLEAR line_fieldcat.
line_fieldcat-fieldname = 'SEQNR'.
line_fieldcat-tabname = 'ITAB'.
line_fieldcat-seltext_l = 'No. of records with same key'.
line_fieldcat-edit = 'X'. APPEND line_fieldcat TO i_fieldcat.
ENDFORM. " f2000_fieldcat_init -
Like SM30 ,table should be display in editable ALV Grid(for Dynamic DB )
Hi Friends,
plese help me how to display ALV grid in editable mode for differnt types of data base tables.
same as like SM30 transaction.
Moderator message: please search for available information/documentation/previous discussions before asking.
Edited by: Thomas Zloch on Nov 11, 2010 6:40 PMHi,
In SLIS_T_FIELDCAT_ALV you specify the field as edit = X.
Give it as mentioned, where you assign fieldname and positions etc.
Thanks&Regards
Maybe you are looking for
-
My iphone 4 wont let me open my text messages
MY iphone 4 just wont let me open my text messages, its just a blank screen whenever I open it and its driving me crazy. I've already turned it off, then on again and have already done a hard reset and both failed to fix the problem. Help!
-
Birthday's in iCal right. Birthdays on iPhone wrong!
I track birthdays in iCal using the Birthdays calendar. I sync iCal to MobileMe. I then sync my iPhone with MobileMe and I display the Birthdays calendar in the iPhone all calendars view. OK so far. So, I have three contacts with birthdays on consecu
-
Hi Can anyone help me. I have been with BT for eons, but recently I cannot access any WiFi hotspots with my mobile devices. When I try checking my status on line (at home) I get the message "customer product is not on allowed product list". I upgrade
-
How do I get my photo's from my mac to my ipad.
I just got a new Ipad for Christmas. Very cool, but I am having a difficult time getting my data that is on my Mac (which doesn't have Icloud) to the ipad. If I buy Iphoto - will I be able to log in to my macs Iphoto and and drag and drop the pictu
-
Payment Advice Generation during Dunning
Hi - we are on ECC6.0 and I have noticed in the dunning table MHNK that there is a field for payment advice. Does anyone know how to generate a payment advice from the dunning run that can be printed on the form and then referenced when the customer