ALV Reports
ABAP DevelopmentAdvanced

Editable ALV and Changed Data Handling

Learn how editable ALV works and why validation is critical before saving data.

Explanation

Editable ALV allows users to change values directly in the grid. It is powerful but risky because user changes may update business data. Editable ALV normally requires CL_GUI_ALV_GRID and proper changed-data handling. Before saving, the program must transfer frontend changes to the backend internal table, validate changed rows, check authorization, handle locks and update the database safely. Editable ALV should not be used casually for critical business data unless validation and audit requirements are clear.

Code example

ABAP Code
* Purpose:* Save user changes from editable ALV safely.* check_changed_data is required to move frontend grid changes into backend internal table. * Step 1: Transfer changed values from ALV frontend to gt_outputCALL METHOD go_grid->check_changed_data. * Step 2: Process only changed rows, not the full tableLOOP AT gt_output INTO DATA(ls_output) WHERE changed = abap_true.   * Step 3: Validate business rule before database update  IF ls_output-status IS INITIAL.    MESSAGE 'Status cannot be blank' TYPE 'E'.  ENDIF.   * Step 4: Authorization and lock checks should be done before update  * AUTHORITY-CHECK ...  * ENQUEUE object ...   * Step 5: Save only validated changed row  MODIFY zapproval_tab FROM ls_output. ENDLOOP. * Step 6: Commit after successful validation and updateCOMMIT WORK.

Real project scenario

A custom approval maintenance report allows users to update approval comments and status in ALV. The program validates status transition, locks the record, updates only changed rows and writes an audit log.

Common mistakes

- Saving without check_changed_data. - Saving all rows instead of changed rows. - Skipping authorization checks. - Ignoring locks and concurrent edits.

Best practices

- Call check_changed_data before save. - Validate every changed row. - Save only changed rows. - Use locks and authorization checks. - Write audit logs for critical changes.

Interview angle

This is a strong senior-level topic because editable ALV involves UI sync, validation, authorization, locking and database update safety.