Example in which field settings are altered. Note, these are only a few of the supported options.
Effectively the ready-to-run functionality will determine most field/column details automatically, but if you want to alter a description, turn your column into a key field or apply other options, here's how:
The system will help you with column descriptions and column width. But you may want to set your own description or bombard your column to a key column. The easy ALV class hat prepared a method for this purpose, which is probably the most-used method on the class. SET_FIELD
.
report ZDEMO_ALV_2_FIELDSETTINGS. include ZABAPCADABRA_EASY_ALV. data: gt_data type table of t100, go_alv type ref to lcl_easy_alv. "Define start-of-selection. select * from t100 up to 20 rows into table gt_data. create object go_alv. go_alv->set_alv_from_template( changing content = gt_data ). * Note that the system already recognizes this field as key field go_alv->set_field( fieldname = 'SPRSL' description_overall = 'Language code' ). go_alv->set_field( fieldname = 'ARBGB' is_key = abap_true tooltip = 'This is a tooltip' ). go_alv->set_field( fieldname = 'MSGNR' ddic_reference = 'T100-MSGNR' ). * Sort on material number go_alv->set_sort( 'ARBGB' ). "First sort field go_alv->set_sort( 'MSGNR' ). "Second sort field go_alv->display( ). "Report
The result of this demo