on 04-06-2009 7:54 AM
Hi ,
i m trying to create meeting planner application , on one view i want to display location booking information in alv with columns havaing headings as dates like 1-APR-09 ,2-APR-09 ....ETC of week & rows names marked with time of day like 7:00 ,8:00 ...etc HOW I CAN SET THE FIELD CATALOG DYNAMINCALLY FOR THE ALV IN WEB DYNPRO ABAP
Hi,
Please use the following Class methods to accomplish your task,
CL_SALV_TABLE
CL_SALV_COLUMN_TABLE
CL_SALV_COLUMN_LIST
Best Regards
Ravi Golla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please check out this code.
Use the cl_alv_table_create=>create_dynamic_table
to cretate a dynamic FCAT.
DATA:
lt_fcat TYPE lvc_t_fcat, " Field Catalog
lt_table TYPE REF TO data, " Dynamic Internal Table
ls_line TYPE REF TO data, " Line Type of Dynamic Table
DATA:
lt_efforts TYPE REF TO data,
lr_s_eff TYPE REF TO cl_abap_typedescr,
lr_t_eff TYPE REF TO cl_abap_tabledescr,
lr_handler_eff TYPE REF TO data,
lr_strucdescr TYPE REF TO cl_abap_structdescr,
lr_nd_eff TYPE REF TO if_wd_context_node,
lr_nd_eff_info TYPE REF TO if_wd_context_node_info,
lr_nd_root_info TYPE REF TO if_wd_context_node_info,
lo_cmp_usage TYPE REF TO if_wd_component_usage,
lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE,
lv_value TYPE ref to cl_salv_wd_config_table.
FIELD-SYMBOLS:
<fs_table> TYPE STANDARD TABLE.
* fill the LV_T_FCAT to have your own fields
* To create a dynamic table importing field catalog table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fcat
IMPORTING
ep_table = lt_efforts
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN lt_efforts->* TO <fs_table>.
**Get the structure
if sy-subrc eq 0.
MOVE cl_abap_structdescr=>describe_by_data_ref( lt_efforts ) ?TO lr_s_eff.
endif. "IF sy-subrc eq 0.
**Get the table type from the structure
lr_t_eff ?= lr_s_eff.
**Create handler for table type
CREATE DATA lr_handler_eff TYPE HANDLE lr_t_eff.
ASSIGN lr_handler_eff->* TO <fs_tab_efforts2>.
<fs_tab_efforts2> = <fs_tab_efforts1>.
**Get the Structure from the Table Object
lr_strucdescr ?= lr_t_eff->get_table_line_type( ).
** create node dynamically
lr_nd_root_info = wd_context->get_node_info( ).
lr_nd_eff_info = lr_nd_root_info->add_new_child_node(
name = wd_assist->gc_periodcost "PERIODCOST'
static_element_rtti = lr_strucdescr "RTTI structure
is_static = abap_false
is_mandatory = abap_false
is_mandatory_selection = abap_false
is_multiple = abap_true
is_multiple_selection = abap_true
is_singleton = abap_false ).
** bind table to node
lr_nd_eff = wd_context->get_child_node( NODENAME ).
lr_nd_eff->bind_table( <fs_tab_efforts2> ).
**If ALV component is initial, then create it
lo_cmp_usage = wd_this->wd_cpuse_u_alv_pwc( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif. "IF lo_cmp_usage->has_active_component( ) is initial.
** Get reference of ALV interface controller
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_u_alv_pwc( ).
if lo_interfacecontroller is not initial.
lo_interfacecontroller->set_data(
* only_if_new_descr = " wdy_boolean
r_node_data = lr_nd_eff " ref to if_wd_context_node
).
lv_value = lo_interfacecontroller->get_model( ).
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.