Alv Editable and Saving Into Database Table
Alv Editable and Saving Into Database Table
Alv Editable and Saving Into Database Table
DATABASE TABLE
Posted on 24 de Jun de 2008 às 12:43 | 772 Views
Follow
HI, this program is working fine but data is not saving in the database table.
REPORT ZALV_INSERT.
wa TYPE ztest,
TABLES ztest.
&----
PBO
----
IF o_docking IS INITIAL.
PERFORM create_object.
PERFORM create_fieldcat.
PERFORM modify_fieldcat.
Registering edit
PERFORM register_edit.
PERFORM display_output.
ENDIF.
&----
&----
PAI
----
lv_ucomm = sy-ucomm.
CASE lv_ucomm.
PERFORM free_objects.
LEAVE PROGRAM.
WHEN 'BACK'.
PERFORM free_objects.
LEAVE SCREEN.
WHEN 'SAVE'.
PERFORM save_database.
ENDCASE.
&----
&----
Creating Docking Container and grid
----
FORM create_object .
IF sy-subrc EQ 0.
Creating Grid
ENDIF.
&----
&----
----
FORM create_fieldcat .
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
&----
&----
----
FORM modify_fieldcat .
CASE <fs_fieldcat>-fieldname.
WHEN 'STKOT'.
<fs_fieldcat>-edit = 'X'.
ENDCASE.
ENDLOOP.
&----
*& Form register_edit
&----
Registering Edit
----
FORM register_edit .
&----
&----
----
FORM display_output .
w_variant-report = sy-repid.
EXPORTING
is_variant = w_variant
i_save = 'A'
CHANGING
it_outtab = itab
it_fieldcatalog = i_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
&----
&----
Free Objects
----
FORM free_objects .
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
&----
&----
Save in database
----
FORM save_database .
Getting the selected rows index
IF sy-subrc EQ 0.
MOVE-CORRESPONDING wa TO w_modified.
ENDIF.
ENDLOOP.
ENDFORM.