on 01-06-2009 6:36 PM
hi
i want to created dynamic attribute i find IF_WD_CONTEXT_NODE_INFO for use to create dynamic attirubute .
but I dont use ADD_ATTRIBUTE method . I dont know to use this method .
how can I use ADD_ATTRIBUTE method ??
Thanks For Reply
Joshua .
Hi,
This is how you can use add attribute method.....
data: lv_info type ref to if_wd_context_info,
ls_attribute type wdr_context_attribute_info.
lv_info = wd_context->get_node_info( )
ls_attribute-name = 'carrid'
ls_attribute-type_name = 's_carr_id'
call methods lv_info->add_attribute
exporting
attribute_info = ls_attribute
regards
Pranav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
your answer thanks
but i have any problem .
data: lv_info type ref to IF_WD_CONTEXT_NODE,
ls_attribute type wdr_context_attribute_info.
lv_info = wd_context->get_node_info( ).
ls_attribute-name = 'carrid'.
ls_attribute-type_name = 's_carr_id'.
call method lv_info->add_attribute
exporting
attribute_info = ls_attribute.
firstly ," The result type of the function method cannot be converted into the type of LV_INFO. ."
i do lv_info = wd_context->get_child_node( 'GT_MASTER' ).
and other error,
"add_attribute" method is absent in IF_WD_CONTEXT_NODE . it's F_WD_CONTEXT_NODE_INFO.
hi
CALL METHOD LT_ROOT_INFO->GET_CHILD_NODE
EXPORTING
NAME = 'GT_MASTER'
RECEIVING
CHILD_NODE = lr_flights_info
.
" Define attribute Carrid
ls_attribute-name = 'LGART1'.
ls_attribute-type_name = 'LGART'.
ls_attribute-value_help_mode = '0'.
call method lr_flights_info->add_attribute
exporting attribute_info = ls_attribute.
this is run
thanks Uday Gubbala and Pranav Nagpal
finally
im use this is on alv and i must do change field text
you think how can i do ?
Hi Joshua,
I guess that you want to change the column heading that appears within the ALV. By default the column text shown in the ALV are the S (short) texts from the domain. You can set the M or L text like this:
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_col_header TYPE REF TO cl_salv_wd_column_header.
lr_column_settings ?= wd_this->r_table.
" get table of column settings - each line one column
DATA: lt_columns TYPE salv_wd_t_column_ref.
lt_columns = lr_column_settings->get_columns( ).
DATA: ls_column TYPE salv_wd_s_column_ref.
LOOP AT lt_columns INTO ls_column.
" get header of column
lr_col_header = ls_column-r_column->get_header( ).
" change columnheader text to medium text of domain
CALL METHOD lr_col_header->set_ddic_binding_field
EXPORTING value = if_salv_wd_c_column_settings=>ddic_bind_medium.
ENLOOP.
Regards,
Uday
Hi Joshua,
If you however intend to set an entirely new text for the column (different from the S/M/L texts maintained at domain level) then you need to delete the DDIC bindings for the column text as well as set the new texts for the column. Try go through the code fragment below which am passing on to you from Thomas Jung's post in [here|;:
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data l_salv_wd_table type ref to iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv( ).
data l_table type ref to cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
data l_column type ref to cl_salv_wd_column.
data l_header type ref to cl_salv_wd_column_header.
l_column = l_table->if_salv_wd_column_settings~get_column( 'CREATED_BY' ).
l_header = l_column->get_header( ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_text
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_tooltip
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_tooltip( `TTCreated By` ).
l_header->set_text( `Created By` ).
Regards,
Uday
Hi Joshua,
You can define new attributes for the previously created context node by calling the method add_attribute( ) from the reference to the metadata of the node.
ex:
data: lt_root_info type ref to if_wd_context_node_info,
lr_flights_info type ref to if_wd_context_node_info,
ls_attribute type wdr_context_attribute_info.
" Get the meta data information of the root context node
lr_root_info = wd_context->get_node_info( ).
" Create node with name FLIGHTS without attributes
lr_flights_info = lr_root_info->add_new_child_node
exporting name = 'FLIGHTS'
is_mandatory = abap_false
is_multiple = abap_true
is_mandatory_selection = abap_false
is_multiple_selection = abap_false
is_singleton = abap_true
is_initialize_lead_selection = abap_true
is_static = abap_false
receiving
child_node_info = lr_flights_info.
" Define attribute Carrid
ls_attribute-name = 'CARRID'.
ls_attribute-type_name = 'S_CARR_ID'.
ls_attribute-value_help_mode = '0'.
call method lr_flights_info->add_attribute
exporting attribute_info = ls_attribute.
Creating a context node and its attributes comprises a lot of manually written coding since the method add_attribute( ) has to be called once for each attribute. You can instead use the the method add_new_child_node( ) to even create related attributes by using the static_element_type / static_element_rtti / attribute parameters of this method. Try refer the documentation for more information regarding this.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.