I'm trying to streamline processes since we need to generate reports in ALVs.
The idea is to get the metadata of a structure (Field Name, Domain, Descriptive) and thus to generate the 'fieldcat' in the ALV creation function and in the sequence to be able to fill it.
Ex:
Traversing the fields of the structure would fill the skeleton table.
CLEAR gs_s_fcat.
gs_s_fcat-fieldname = fieldname. " Nome do campo da Estrutura
gs_s_fcat-outputlen = size. " O tamanho do conteúdo
gs_s_fcat-tabname = table. " Tabela
gs_s_fcat-coltext = header. " Texto do cabeçalho
gs_s_fcat-col_pos = index. " Índice da coluna
gs_s_fcat-emphasize = style. " Estilo, cores e etc.
APPEND gs_s_fcat TO gt_t_fcat.
Call the creation of the generic table.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table = 'X'
it_fieldcatalog = gt_t_fcat
IMPORTING
ep_table = gt_generic_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
{...} - I would fill a field-symbol with the same structure and use the display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = gs_layout
it_fieldcat = gt_t_fcat
TABLES
t_outtab = <fs_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
Ideas?