‎2010 Mar 25 9:38 PM
Hello all,
I have created a Dynamic ALV using RTTS classes like cl_abap_structdescr,cl_abap_tabledescr and cl_abap_datadescr.
The number of columns to be displayed is dynamic and i am able to display the same.
Now i need to perform SUBTOTAL on few of the columns.
In dynamic table how do i assign those columns as Type 'I' so that i can perform DO_SUM.
I used the method GET_I of class cl_abap_elemdescr but unable to achive the same.
Kindly suggest.
Regards,
Arun
‎2010 Mar 26 12:10 AM
Hi,
Could you please let us know your definition part of source code on the GET_I ?
BTW, you also need to set the DO SUM attribute in the fieldcatalog.
Cheers,
‎2010 Mar 26 2:40 AM
I know when I need to create a dynamic alv I use the following (plumbing code removed).
DATA: it_field_catalog TYPE lvc_t_fcat.
DATA: dyn_table TYPE REF TO data.
FIELD-SYMBOLS: <dyn_table> TYPE table. create your alv as normal. Or auto create the entries based on the tables, whatever conditions you use to determine the structure of the table at run time.
ls_fcat-fieldname = '???'.
ls_fcat-inttype = '?' .
ls_fcat-outputlen = '?' .
ls_fcat-coltext = '?' .
ls_fcat-seltext = '?' .
ls_fcat-f4availabl = '?'.
ls_fcat-edit = '?'.
ls_fcat-key = '?'.
APPEND ls_fcat TO it_field_catalog .
.....
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = it_field_catalog
IMPORTING ep_table = dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1.
ASSIGN dyn_table->* TO <dyn_table>.
This field symbol to the table can then be passed in place of the table when calling your alv and performing operations on it.
‎2010 Mar 26 3:43 AM
You can use the below code, lt_components will have the details of type of each component in your dynamic structure.
lo_struc_descr ?= cl_abap_typedescr=>describe_by_data( <workarea> ).
lt_components = lo_struc_descr->get_components( ).
Hope it helps.
Cheers,
Ravikiran
‎2010 Mar 29 9:33 PM