Module 4: UI Display Controller - alv_report and Related Forms
← Back to Overview | ← Previous: Output Builder | Next: Period Utilities →
Module Overview
Lines: 3799-3963
Importance: Tier 3 (Medium) - User interface and interaction handling
Purpose: Controls ALV grid display, user interactions, and drill-down functionality
Business Context - The "Report Theater"
Think of this module as a theater presentation system that:
- Sets up the "stage" (ALV grid layout and appearance)
- Presents the "show" (data in a user-friendly format)
- Handles "audience interaction" (user clicks, drill-downs, toolbar actions)
- Provides "program notes" (detailed views and popups)
Module Structure and Components
Detailed Form Analysis
Form 1: alv_report (Lines 3799-3802)
FORM alv_report.
PERFORM fill_layo_ind.
CALL SCREEN 100.
ENDFORM.
Purpose: Main entry point for ALV display Function:
- Sets up the grid layout settings
- Calls the dynpro screen that contains the ALV container
Analogy: Like a theater manager who sets up the stage and opens the curtains
Form 2: fill_layo_ind (Lines 3811-3840)
FORM fill_layo_ind.
DATA: lw_title TYPE char34.
IF p_pd = true.
lw_title = 'Production Demand'(t01).
ELSEIF p_co = true.
lw_title = 'Planned Supply'(t02).
ELSE.
lw_title = 'Schedule lines/Purchase Orders'(t03).
ENDIF.
wa_layo-cwidth_opt = 'X'. " Optimize column width
wa_layo-grid_title = lw_title.
wa_layo-no_totarr = 'X'. " No totals button
wa_layo-sel_mode = 'A'. " Multiple selection allowed
ENDFORM.
Key Settings Explained:
| Setting | Value | Business Impact |
|---|---|---|
cwidth_opt = 'X' | Auto-optimize columns | Columns resize to fit content |
grid_title | Dynamic title | Shows report type to user |
no_totarr = 'X' | No totals toolbar | Prevents confusing summary calculations |
sel_mode = 'A' | Multiple selection | Users can select multiple rows |
Dynamic Title Logic:
Form 3: display_list (Lines 3849-3963)
This form handles drill-down functionality when users click on quantity cells:
FORM display_list.
DATA: lw_index LIKE sy-tabix,
lv_index LIKE sy-tabix,
lw_qty LIKE mdez-mng01,
lv_fieldname TYPE char2.
IF r_weeks = c_x.
" Weekly drill-down logic
DO w_columns TIMES VARYING lw_qty FROM wa_output-qty1
NEXT wa_output-qty2.
READ TABLE t_fcat INTO wa_fcat INDEX lw_index.
t_item-text = wa_fcat-coltext. " Period name
t_item-qty = lw_qty. " Period quantity
APPEND t_item.
ENDDO.
ELSE.
" Monthly/Period drill-down logic
" Similar logic for accounting/calendar periods
ENDIF.
" Display popup with period details
CALL SCREEN 200 STARTING AT 10 10.
ENDFORM.
Drill-Down Processing Flow:
Screen Processing Modules
MODULE display_alv OUTPUT (Line 1162)
MODULE display_alv OUTPUT.
IF w_container IS INITIAL.
" First time setup
CREATE OBJECT w_container
EXPORTING
container_name = 'CONTAINER1'.
CREATE OBJECT w_grid
EXPORTING
i_parent = w_container.
" Register event handlers
CREATE OBJECT w_event_receiver.
SET HANDLER w_event_receiver->handle_hotspot_click FOR w_grid.
SET HANDLER w_event_receiver->handle_toolbar FOR w_grid.
SET HANDLER w_event_receiver->handle_user_command FOR w_grid.
ENDIF.
" Display the data
CALL METHOD w_grid->set_table_for_first_display
EXPORTING
is_layout = wa_layo
is_variant = w_xvariant
i_save = v_save
CHANGING
it_fieldcatalog = t_fcat[]
it_outtab = t_output[].
ENDMODULE.
ALV Setup Sequence:
Event Handling Class - lcl_event_receiver
Method: handle_hotspot_click (Lines 1070-1077)
METHOD handle_hotspot_click.
CHECK NOT e_row_id-index IS INITIAL
AND e_row_id-rowtype IS INITIAL
AND NOT e_column_id-fieldname IS INITIAL.
READ TABLE t_output INDEX e_row_id-index INTO wa_output.
CHECK sy-subrc = 0.
PERFORM display_list.
ENDMETHOD.
What this does:
- Validates click: Ensures user clicked on a data cell (not header)
- Gets row data: Retrieves the material information for the clicked row
- Shows drill-down: Calls
display_listto show period breakdown
Method: handle_toolbar (Lines 1079-1092)
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
" Add separator
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
" Add download button
CLEAR ls_toolbar.
MOVE 'DWNL' TO ls_toolbar-function.
MOVE icon_export TO ls_toolbar-icon.
MOVE 'Download to local file'(tb1) TO ls_toolbar-quickinfo.
MOVE 'Download'(tb2) TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
Toolbar Customization:
Method: handle_user_command (Lines 1094-1137)
METHOD handle_user_command.
DATA: lt_rows TYPE lvc_t_row.
CALL METHOD w_grid->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
CASE e_ucomm.
WHEN 'DWNL'.
PERFORM download_file.
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
Command Processing Flow:
Screen Flow and User Experience
Screen 100 (Main ALV Display)
- Purpose: Contains the ALV grid container
- Layout: Full screen with maximized grid
- Navigation: OK/Back buttons for exit
Screen 200 (Drill-down Popup)
- Purpose: Shows period-by-period breakdown
- Layout: Popup window (STARTING AT 10 10)
- Content: Simple list of periods and quantities
User Interaction Patterns:
- Normal View: User sees aggregated data in grid format
- Drill-down: User clicks quantity cell to see period details
- Download: User clicks toolbar button to export data
- Multi-select: User can select multiple rows for operations
Data Flow in Display Module
Configuration and Customization
Layout Variant Support:
The ALV supports saving user-specific layouts:
- Variant ID: Stored in
w_xvariant - Save Mode: Controlled by
v_save(user/global) - Layout Fields: Column width, sorting, filtering
Field Catalog Integration:
- Column headers come from
t_fcat - Column properties (width, type, hotspot) defined in field catalog
- Dynamic columns based on time periods selected
Performance Considerations
Efficient Event Handling:
- Events only fire for actual user interactions
- CHECK statements prevent unnecessary processing
- Single event receiver handles all grid events
Memory Management:
- Container and grid objects created once
- Reused for subsequent displays
- Proper cleanup on program exit
Common User Experience Issues
Issue 1: Column Width
Problem: Too many time periods make columns too narrow
Solution: cwidth_opt = 'X' allows auto-sizing
Issue 2: Confusing Totals
Problem: Standard ALV totals don't make sense for time-based data
Solution: no_totarr = 'X' removes totals button
Issue 3: Period Identification
Problem: Users can't tell which period a column represents Solution: Hotspot click shows detailed period breakdown
Integration Points
Incoming Dependencies:
t_outputtable with complete data frombuild_output_table_newt_fcatfield catalog fromfill_field_catalog- Layout settings from user parameters and selection screen
Outgoing Results:
- Interactive ALV report for business users
- Export functionality to local files
- Drill-down capability for detailed analysis
User Workflow Integration:
- User runs report with selection criteria
- Sees summarized data in ALV grid
- Clicks on specific cells for details
- Downloads data for further analysis
- Saves personalized layout variants
This module completes the user-facing aspect of the aggregate demand report, providing both overview and detailed analysis capabilities in an intuitive interface.
Navigation
← Back to Overview | ← Previous: Output Builder | Next: Period Utilities →
Related Modules
- Output Table Builder - Provides the t_output data for display
- Period Calculations - Defines time bucket columns
- Complete Reference Guide - Technical implementation details