ALV Reports Part 4: The Field Catalog in Depth
Master the ALV field catalog: DDIC-based merge vs manual build, the important LVC S FCAT fields (texts, output length, key, no out, tech, do sum, cfieldname/qfieldname, ref table/ref field, edit, hotspot, checkbox), and building a catalog for a local structure.
Explanation
📌 KEY POINTS
✅ The field catalog is a table with one row per ALV column describing texts, type, format and behaviour.
✅ Two build methods: merge from DDIC (LVC_FIELDCATALOG_MERGE / REUSE_ALV_FIELDCATALOG_MERGE) or fill manually — often both.
✅ Amounts need cfieldname (currency column), quantities need qfieldname (unit column) for correct formatting.
⚠️ For local TYPES structures, merge by structure name does not work — use ref_table/ref_field or build manually.
━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE
Parts 1–3 used simple catalogs. Now you learn the fields you will adjust most in real reports.
━━━━━━━━━━━━━━━━━━━━
▶ 1. SLIS VS LVC
- REUSE_ALV_* uses SLIS types: slis_t_fieldcat_alv, text fields seltext_s/m/l.
- CL_GUI_ALV_GRID uses LVC types: lvc_t_fcat, text fields scrtext_s/m/l and coltext.
- CL_SALV_TABLE builds the catalog itself from the table's types.\n\n━━━━━━━━━━━━━━━━━━━━\n▶ 2. IMPORTANT LVC_S_FCAT FIELDS\n• fieldname — column name in the output table (uppercase). Mandatory.
- coltext / scrtext_s, scrtext_m, scrtext_l — column headers.
- col_pos — position; outputlen — width.
- key — key column (fixed on the left, colored).
- no_out — hidden but available in layout; tech — technical, never shown.
- do_sum — total this column.
- cfieldname / qfieldname — reference currency / unit field in the same table.
- ref_table / ref_field — take type, texts and F1/F4 help from a DDIC field.
- hotspot, checkbox, icon, edit, emphasize — used in later parts.
- convexit — conversion exit (e.g. ALPHA) for display.
━━━━━━━━━━━━━━━━━━━━
▶ 3. MERGE + ADJUST (MOST COMMON)
Merge from the DDIC structure, then LOOP AT gt_fcat ASSIGNING <fs> and CASE fieldname to change texts or flags. Labels stay translated from DDIC.
━━━━━━━━━━━━━━━━━━━━
▶ 4. LOCAL OUTPUT STRUCTURES
When the output structure is a local TYPE mixing fields from several tables plus calculated fields:
- Create a DDIC structure (ZS_FLIGHT_ALV) — best for reuse and translations; or
- Build manually with ref_table/ref_field for DDIC-typed fields and datatype/inttype/outputlen for calculated fields.
━━━━━━━━━━━━━━━━━━━━
▶ 5. CALCULATED COLUMNS
A utilisation percentage column (TYPE p DECIMALS 1) needs coltext and, if manual, datatype = 'DEC', outputlen = 6, decimals_o = '1'.
━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP
- Run the code example: a local structure with DDIC-referenced fields and one calculated column.
- Remove cfieldname from PRICE and compare the display.
- Set no_out on SEATSMAX and bring it back via the layout dialog.
✅ CHECKPOINT: you can build and adjust a field catalog for any output structure.
Code example
REPORT zalv_fieldcat. TYPES: BEGIN OF ty_out, carrid TYPE s_carr_id, carrname TYPE s_carrname, " from SCARR connid TYPE s_conn_id, fldate TYPE s_date, price TYPE s_price, currency TYPE s_currcode, seatsmax TYPE s_seatsmax, seatsocc TYPE s_seatsocc, util_pct TYPE p LENGTH 5 DECIMALS 1, " calculated column END OF ty_out. DATA: gt_out TYPE STANDARD TABLE OF ty_out, gt_fcat TYPE lvc_t_fcat, gs_fcat TYPE lvc_s_fcat, gs_layout TYPE lvc_s_layo.FIELD-SYMBOLS <ls_out> TYPE ty_out. START-OF-SELECTION. SELECT f~carrid c~carrname f~connid f~fldate f~price f~currency f~seatsmax f~seatsocc FROM sflight AS f INNER JOIN scarr AS c ON c~carrid = f~carrid INTO CORRESPONDING FIELDS OF TABLE gt_out. LOOP AT gt_out ASSIGNING <ls_out> WHERE seatsmax > 0. <ls_out>-util_pct = <ls_out>-seatsocc * 100 / <ls_out>-seatsmax. ENDLOOP. * ===== Manual catalog: DDIC reference where possible ===== PERFORM add_ref USING 'CARRID' 'SFLIGHT' 'CARRID' ''. PERFORM add_ref USING 'CARRNAME' 'SCARR' 'CARRNAME' ''. PERFORM add_ref USING 'CONNID' 'SFLIGHT' 'CONNID' ''. PERFORM add_ref USING 'FLDATE' 'SFLIGHT' 'FLDATE' ''. PERFORM add_ref USING 'PRICE' 'SFLIGHT' 'PRICE' 'CURRENCY'. " amount -> currency PERFORM add_ref USING 'CURRENCY' 'SFLIGHT' 'CURRENCY' ''. PERFORM add_ref USING 'SEATSMAX' 'SFLIGHT' 'SEATSMAX' ''. PERFORM add_ref USING 'SEATSOCC' 'SFLIGHT' 'SEATSOCC' ''. * Calculated column: no DDIC reference, describe it explicitly CLEAR gs_fcat. gs_fcat-fieldname = 'UTIL_PCT'. gs_fcat-coltext = 'Utilisation %'. gs_fcat-datatype = 'DEC'. gs_fcat-inttype = 'P'. gs_fcat-outputlen = 8. gs_fcat-decimals_o = '1'. APPEND gs_fcat TO gt_fcat. * ===== Adjust flags on existing entries ===== LOOP AT gt_fcat INTO gs_fcat. CASE gs_fcat-fieldname. WHEN 'CARRID' OR 'CONNID'. gs_fcat-key = 'X'. WHEN 'SEATSOCC'. gs_fcat-do_sum = 'X'. WHEN 'SEATSMAX'. gs_fcat-no_out = 'X'. " hidden, user can show via layout ENDCASE. MODIFY gt_fcat FROM gs_fcat. ENDLOOP. gs_layout-cwidth_opt = 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING i_callback_program = sy-cprog is_layout_lvc = gs_layout it_fieldcat_lvc = gt_fcat TABLES t_outtab = gt_out EXCEPTIONS OTHERS = 1. *----------------------------------------------------------------------*FORM add_ref USING iv_field TYPE lvc_fname iv_table TYPE lvc_rtname iv_ref TYPE lvc_rfname iv_curr TYPE lvc_cfname. CLEAR gs_fcat. gs_fcat-fieldname = iv_field. gs_fcat-ref_table = iv_table. " texts, type, F1/F4 from DDIC gs_fcat-ref_field = iv_ref. gs_fcat-cfieldname = iv_curr. APPEND gs_fcat TO gt_fcat.ENDFORM.Real project scenario
Users in Japan complained that prices in a sales ALV showed two decimals for JPY amounts, which made values look 100 times too small. The field catalog had no currency reference, so the grid used the default two decimals.
Adding cfieldname = 'WAERK' for all amount columns fixed the display for every currency. The team added a checklist item: every CURR/QUAN column needs its currency or unit reference in the catalog.
Common mistakes
- Missing cfieldname/qfieldname for amounts and quantities.
- Lowercase or misspelled fieldnames.
- Using SLIS fields (seltext_m) with LVC catalogs or vice versa.
- Merging by a local TYPES name (not in DDIC).
- Hardcoded texts instead of DDIC references (no translation).
Best practices
- Prefer DDIC structures or ref_table/ref_field.
- Always link amounts and quantities.
- Use no_out for optional columns and tech for internal ones.
- Adjust merged catalogs in one loop with CASE.
- Describe calculated columns completely (type, length, decimals, text).
Interview angle
Questions: "What is a field catalog?", "How do you create it?", "Why is cfieldname important?", "no_out vs tech?"
Strong answer: one entry per column; merged from DDIC (LVC_FIELDCATALOG_MERGE/REUSE_ALV_FIELDCATALOG_MERGE) or built manually with ref_table/ref_field; key fields: fieldname, coltext, outputlen, key, no_out (hidden but selectable), tech (never shown), do_sum, cfieldname/qfieldname for currency/unit formatting, hotspot, edit, checkbox.
Practice this lesson
Quick check
1. An ALV shows prices in JPY with two decimals. Which field catalog setting fixes this?
2. To auto-fit column widths, call:
3. Which field catalog component instructs classic ALV to automatically calculate and display a subtotal for a numeric column whenever the list is sorted by a preceding field?
Interview questions
1. ALV export to Excel loses leading zeros. Why?
Answer it in your own words first, then compare.
2. A finance ALV shows technical field names as headers and amounts converted to text columns, so totals and currency formatting don't work. How do you fix the field catalog?
Answer it in your own words first, then compare.
Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.
More lessons in this topic
- ALV Reports Part 1: ALV Basics with REUSE_ALV_GRID_DISPLAY
- ALV Reports Part 10: Authorization and Sensitive Data in ALV Reports
- ALV Reports Part 2: Quick ALV with CL_SALV_TABLE
- ALV Reports Part 3: OO ALV with CL_GUI_ALV_GRID and a Custom Container
- ALV Reports Part 5: Layout, Sort, Filter, Totals and Variants
- ALV Reports Part 6: Hotspot and Double-Click Drill-Down
- ALV Reports Part 7: Colors, Icons and Traffic Lights
- ALV Reports Part 8: Toolbar Buttons, PF-STATUS and User Commands