Code: Alles auswählen.
METHOD get_lvc_t_fcat_4_itab.
*Importing IT_TABLE TYPE TABLE
*Returning VALUE( RT_FCAT ) TYPE LVC_T_FCAT
DATA:
lo_columns TYPE REF TO cl_salv_columns_table,
lo_aggregations TYPE REF TO cl_salv_aggregations,
lo_salv_table TYPE REF TO cl_salv_table,
lr_table TYPE REF TO data.
FIELD-SYMBOLS:
<table> TYPE STANDARD TABLE.
* create unprotected table from import data
CREATE DATA lr_table LIKE it_table.
ASSIGN lr_table->* TO <table>.
*...New SALV Instance ...............................................
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = abap_false
IMPORTING
r_salv_table = lo_salv_table
CHANGING
t_table = <table> ).
CATCH cx_salv_msg. "#EC NO_HANDLER
ENDTRY.
* get columns object (raw fieldcatalog)
lo_columns = lo_salv_table->get_columns( ).
* get aggregationss object (sorts)
lo_aggregations = lo_salv_table->get_aggregations( ).
rt_fcat =
cl_salv_controller_metadata=>get_lvc_fieldcatalog(
r_columns = lo_columns
r_aggregations = lo_aggregations ).
ENDMETHOD.