SAP Notes 2239951 already explain this Runtime Error ‘ITAB_ILLEGAL_COMPONENT’ but only specific in MB51, actually it could happen at every ALV list when trying to get a sum of the quantity field meanwhile the referenced Uom field doesn’t exist at the output list.
The root cause is you added the field Quantity field to the output list, but you did not add a referenced field to the output list. This is necessary when the Sum function been used at the ALV list.
The key function module to trigger this dump is ALV_SUBTOTALS_GET. Inside the field category table, IT_OUTTAB entry has a DO_SUM flag while FIELDNAME is a quantity field and its QFIELDNAME is not at the output lits.
For MB51 where the standard program RM07DOCS will be called. Just follow the notes and maintain the view V_MMIM_REP_CUST like below with the output field flag.
For a customized program, better to add the UOM to the output list if want to use this SUM function at the output screen.