ALV Report Flow: Selection, Data Preparation and Display
Understand the standard structure of a clean ALV report from selection screen to final output.
Explanation
A good ALV report has three clear parts: input selection, data preparation and display. The selection screen collects filters such as company code, date range, plant, sales organization or customer. The data preparation layer reads the database, applies business rules and builds the final output internal table. The ALV display layer only presents the prepared data with headings, layout, sorting, colors or navigation. Weak ABAP reports mix all three responsibilities together, making debugging and enhancement difficult. A clean ALV report allows any support developer to quickly identify where input validation happens, where data is fetched, where business rules are applied and where ALV formatting is handled.
Code example
* Purpose:* This is a clean ALV report flow.* We separate validation, data fetch, business processing and display.* This makes the report easier to debug and maintain. START-OF-SELECTION. * Step 1: Validate user input before expensive database access PERFORM validate_input. * Step 2: Read required data from database into internal tables PERFORM fetch_data. * Step 3: Apply business logic and prepare final output table PERFORM prepare_output. * Step 4: Display only the final prepared output in ALV PERFORM display_alv. FORM display_alv. * CL_SALV_TABLE is good for simple display-only ALV reports cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv) CHANGING t_table = gt_output ). * Display ALV after all data is prepared lo_alv->display( ). ENDFORM.Real project scenario
A finance reconciliation report takes company code and posting date as input, selects accounting documents, calculates open/cleared status and displays an ALV with color-coded exception rows.
Common mistakes
- Writing SELECT logic inside display routine. - Formatting ALV before final data is prepared. - Not validating selection-screen input. - Using one giant FORM or method for the entire report.
Best practices
- Keep report flow modular. - Build final output table before ALV display. - Keep display logic separate from business logic. - Use meaningful routine or method names.
Interview angle
Interviewers may ask how you structure an ALV report. A strong answer separates validation, data selection, business processing and ALV display.