‎2011 Dec 17 1:08 PM
Hi Gurus,
Am very munch new to ABAP.
I got a requirement where i have to display ztable data in full screen editable alv grid. where 1 field is editable.when the user change the value or delete the line and then click on save, the changed data have to be captured in ztable as a new entry without changing any data from the ztable.
Can u help me with the sample code or procedure.
am using bapi_reuse_alv_grid.
Thanks & regards.
‎2011 Dec 17 2:09 PM
For editable filed in ALV
while creating field catelog,Just pass fieldcat-edit = 'X' this will set column in editable mode.
for User command on save and delete.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_USER_COMMAND = 'USER_COMMAND' "<--use this
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE iT_tab INTO wa_tab INDEX rs_selfield-tabindex.
WHEN 'SAVE'.
"-->code
WHEN 'DELE'.'
"-->code
ENDCASE.
ENDFORM. "user_command
‎2011 Dec 17 2:09 PM
For editable filed in ALV
while creating field catelog,Just pass fieldcat-edit = 'X' this will set column in editable mode.
for User command on save and delete.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_USER_COMMAND = 'USER_COMMAND' "<--use this
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE iT_tab INTO wa_tab INDEX rs_selfield-tabindex.
WHEN 'SAVE'.
"-->code
WHEN 'DELE'.'
"-->code
ENDCASE.
ENDFORM. "user_command
‎2011 Dec 18 8:44 AM
Hi,
Refer the below mentioned code.
DATA : ref_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = alv_status_set
i_callback_user_command = alv_user_comm
i_grid_title = grid_title
i_save = g_save
is_variant = gs_variant
is_layout = alv_layout
it_fieldcat = alv_fieldcat[]
it_events = gt_events[]
it_sort = alv_sort[]
IMPORTING
e_exit_caused_by_caller = g_exit_caused_by_caller
es_exit_caused_by_user = gs_exit_caused_by_user
TABLES
t_outtab = git_final[].
PERFORM alv_user_comm USING r_ucomm
rs_selfield.
FORM alv_user_comm USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
*Determine the main component beign viewed
READ TABLE git_final INTO gwa_final INDEX rs_selfield-tabindex.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' "This FM will get the reference of the changed data in ref_grid
IMPORTING
e_grid = ref_grid.
IF ref_grid IS NOT INITIAL.
CALL METHOD ref_grid->check_changed_data( ). "After calling this method your internal table will have updated values
git_final_tmp = git_final.
endform.
modify Z* from git_final " Modify your ztable with the last stmnt.
It will definitely solve your issue. Come up with your queries if any..
Cheers
VJ
‎2011 Dec 19 6:54 AM
Hi Gurus,
Everything is working fine..when i change the quantity field and save
its showing : too many decimal places (maximum 0)
MENGE type MENGE_D. "Quantity
Thanks & regards.
‎2011 Dec 19 7:15 AM
Hi ,
The Menge_d type quan13 with 3 decimal places , so its expecting decimal places , please enter value with 3 three decimals or change it into INT , then u didnt get any problem .
Regards
Siva
‎2011 Dec 19 7:21 AM
Hi,
In field catalog pass qfieldname filed and qtabname also ref_fieldname ref_tabname for MENGE.
Regards,
Ravi.
‎2011 Dec 19 10:40 AM