‎2008 Feb 07 8:43 AM
Hi,
I have a classical ALV in which one of the fields is editable.I have a SAVE button on the APPL Toolbar.So when ever i edit some cell/cells
and press the SAVE button the contents of the grid should be read and only the updated cell/cells should be updated in the database table.How can i do that.Please suggest the solution.Also Please provide a sample code if available.
‎2008 Feb 07 8:51 AM
hi,
check this demo program
BCALV_TEST_GRID_EDITABLE
Regards,
priya.
‎2008 Feb 07 8:57 AM
hi,
hi,
You need to pass the value 'U' to the 'i_save' parameter for saving the layout.
Example:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_background_id = 'ALV_BACKGROUND'
i_callback_program = l_repid
i_callback_pf_status_set = l_status
i_callback_user_command = l_user_command
I_STRUCTURE_NAME = 'VBUK'
is_layout = lf_layout
it_fieldcat = lf_fieldcat[]
IT_EXCLUDING =
it_special_groups = lf_sp_group
I_DEFAULT = 'X'
i_save = 'U'
is_variant = l_variant
it_events = lf_events[]
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = l_spetab .
Also:
u can write SET PF-STATUS 'ZSTAT' in initialization or start-of-selection.
then double click on given name ( here ZSTAT) it will allow u to create ur own menu ( tool bar ) then u can handle created buttons in AT USER-COMMAND event.
TABLES : vbrk.
DATA : off TYPE i,
lin TYPE i,
fld TYPE char10.
DATA : BEGIN OF itab OCCURS 0,
vbeln LIKE vbrk-vbeln,
fkart LIKE vbrk-fkart,
fkdat LIKE vbrk-fkdat,
netwr LIKE vbrk-netwr,
kunag LIKE vbrk-kunag,
END OF itab.
TOP-OF-PAGE.
ULINE AT /1(80).
FORMAT COLOR 3 ON.
WRITE:/1 sy-vline,
3 'Billing Doc.',
18 sy-vline,
20 'Billing Type',
33 sy-vline,
35 'Billing Date',
48 sy-vline,
50 'Net Value',
68 sy-vline,
69 'Customer',
80 sy-vline.
ULINE AT /1(80).
FORMAT COLOR OFF.
START-OF-SELECTION.
SET PF-STATUS 'TEST'.
SELECT vbeln fkart fkdat netwr kunag FROM vbrk
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE vbeln LIKE '00000033%'.
LOOP AT itab.
WRITE:/1 sy-vline,
itab-vbeln UNDER 'Billing Doc.' HOTSPOT ON,
18 sy-vline,
itab-fkart UNDER 'Billing Type',
33 sy-vline,
itab-fkdat UNDER 'billing Date',
48 sy-vline,
itab-netwr UNDER 'Net Value' LEFT-JUSTIFIED,
68 sy-vline,
itab-kunag UNDER 'Customer' HOTSPOT ON,
80 sy-vline.
ENDLOOP.
ULINE AT /1(80).
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'BACK' OR 'UP' OR 'CANC'.
LEAVE PROGRAM.
ENDCASE.
Reward Points if found helpfull..
Cheers,
Chandra Sekhar.