‎2008 Oct 21 5:59 AM
Hello Everyone,
I would like to know how can we implement an ALV grid control report which enables us to edit/change/input data on it..
Any idea about the same if yes could you please help me with the relevant example or code.
Regards,
Ranjith Nambiar
‎2008 Oct 21 6:09 AM
Hi,
Go through the link...
saptechnical.com/Tutorials/ALV/Edit/fieldcatalogue.htm
Regards
Mudit
‎2008 Oct 21 6:09 AM
‎2008 Oct 21 7:28 AM
Hi all,
I would go through and revert to you later
Thanks and regards,
Ranjith Nambiar
‎2008 Oct 22 8:21 AM
Hi,
yes you can enable edit/change option in ALV Grid.
look at the following code.
when you write the fieldcat for fields add wa_fieldcat-edit = 'X' for which field you want it to be editable.
constants : c_user_command type slis_formname value 'USER_COMMAND'
wrk_col_pos = wrk_col_pos + 1.
wa_fieldcat-col_pos = '6'. "wrk_col_pos.
wa_fieldcat-fieldname = 'FILLED_WT'.
wa_fieldcat-seltext_l = 'Gross Weight'.
wa_fieldcat-just = 'L'.
wa_fieldcat-edit = 'X'. " here FILLED_WT field is editable
clear wa_fieldcat.
wrk_col_pos = wrk_col_pos + 1.
wa_fieldcat-col_pos = '4'. "wrk_col_pos.
wa_fieldcat-fieldname = 'CYLNO'.
wa_fieldcat-seltext_l = 'Tanker Number'.
wa_fieldcat-just = 'L'. " here CYLNO field is not editable
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
wrk_col_pos = wrk_col_pos + 1.
wa_fieldcat-col_pos = '5'. "wrk_col_pos.
wa_fieldcat-fieldname = 'TRGEW'.
wa_fieldcat-seltext_l = 'Tar Weight'.
wa_fieldcat-just = 'L'.
wa_fieldcat-edit = 'X'. " here TRGEW' field is not editable
append wa_fieldcat to it_fieldcat.
in function module :
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = wrk_pgm
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fieldcat
i_save = 'A'
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_zprod_qty
exceptions
program_error = 1
others = 2
-
form user_command using p_1 type any p_selfield type slis_selfield .
v_ucomm = sy-ucomm.
case v_ucomm.
when '&DATA_SAVE'.
clear v_ucomm.
write yor conditions and then modity the table (if you have)
modify zprod_qty from table it_modify. "it_zprod_qty.
perform display.
when '&IC1'.
leave program. "to SCREEN 1000.
submit zprod_qut_decl3 via selection-screen. " and RETURN to scree.
endcase.
st_selfield-refresh = 'X'.
endform.
Hope this is helpfull
‎2008 Dec 23 8:18 PM
Hello all - i have my ALV working but for some reason my user entered values are only written back to my internal table if i push the enter key first. See my scenarios below. Any help is greatly appreciated.
Scenario 1 (all okay)
2 records in ALV. My cursor is placed on record 1 and a value is entered in the edit field. Next i use my keyboard arrow keys to move to record 2 and entered a value as well. When I finish i physically press the "enter" key. All is okay and values are accepted and written back to my internal table This also works okay when i push the standard save button.
Scenario 2 (not working quite well)
2 records in ALV. I edit record 1, use the arrow keys to edit record 2, then physically press a button on the application tool bar (custom button i created). My changes to record 1 and record 2 are not saved nor written back to the internal table.
Thanks in advance should you be able to point me in the right direction.
Regards,
Kao
‎2008 Oct 24 9:52 AM
‎2008 Dec 05 2:50 PM
Hello friends
This indeed was a great help.
Thank you all.
However, I want to use some additional functionality.
I want to accept a few values above the grid (like accepting header data in VA01)
before I accept data in the ALV grid (like accepting line-items data in VA01).
an anyone provide me w/ good reference?
Thank you in advance.
Uday