‎2013 Jun 26 2:56 PM
Hi, I'm new to ABAP. I want to display an alv report using oops abap. While populating field catalog I'm defining work area type lvc_s_fcat and an internal table type lvc_t_fcat and doing the field catalog population as follows:
i_fieldcatalog type lvc_s_fcat
t_fieldcatalog type lvc_t_fcat
clear i_fieldcat
i_fieldcatalog-colpos = 1.
i_fieldcatalog-fieldname = 'MATNR'.
i_fieldcatalog-tabname = 'IT_FINAL'.........
...........
append i_fieldcatalog to t_fieldcatalog.
............
.............
in similar manner i'm populating the field catalog internal table and finally calling set_table_for_first_display method and passing structure and internal table to it and I'm getting the alv.
Instead of this manner is there any other manner by which I can populate field catalog i.e., is there any global class which I can use by which when I call that class and pass my internal table to its parameter and my field catalog internal table will be automatically populated ??? Please respond.....
‎2013 Jun 26 3:19 PM
Hi Vidhya,
Your should fill the following fields:
Also you can use the function 'LVC_FIELDCATALOG_MERGE' or use SALV model.
Best regards,
Alex
‎2013 Jun 26 3:19 PM
Hi Vidhya,
Your should fill the following fields:
Also you can use the function 'LVC_FIELDCATALOG_MERGE' or use SALV model.
Best regards,
Alex
‎2013 Jun 26 3:21 PM
Hello,
have you tried the SALV-Framework? There, you do not have to deal directly with the field-catalog.
Look at the classes CL_SALV_TABLE.
Example:
DATA:
lt_sflight TYPE TABLE OF sflight.
DATA:
lr_columns TYPE REF TO cl_salv_columns_list,
lr_funcs TYPE REF TO cl_salv_functions_list,
lr_salv TYPE REF TO cl_salv_table.
SELECT * FROM sflight INTO TABLE lt_sflight.
cl_salv_table=>factory(
IMPORTING r_salv_table = lr_salv
CHANGING t_table = lt_sflight
).
lr_funcs = lr_salv->get_functions( ).
*lr_funcs->set_default( ).
lr_funcs->set_all( ).
lr_columns = lr_salv->GET_COLUMNS( ).
* Modify columns.
lr_salv->display( ).
Kind regards,
Hendrik