on 10-21-2014 11:17 PM
Hi friends.
In a dynamic way, I need to get the bind text of a label, which is an attribute of a context node.
I tryied to get it but without sucess.
In debbuging mode, I can see attribute name inside
LR_VIEW_ELEMENT-_PROPERTY_BINDINGS-PATH_NAME
and LR_VIEW_ELEMENT-_PROPERTY_BINDINGS-ATTRIBUTE_NAME
But I could not find how to get it and after that, get the value of context node.
I'm doing something like this:
IF p_i_r_root_element IS INITIAL.
lr_comp_ctrl ?= p_i_r_comp.
lr_v_main_ctrl ?= lr_comp_ctrl->get_controller( name = p_i_view_name ).
lr_v_root_elem ?= lr_v_main_ctrl->get_root_element( ).
DATA: tt_v_elements TYPE wdr_element_tab,
e_element TYPE wdr_element_line,
lc_label_text TYPE string.
tt_v_elements = lr_v_main_ctrl->get_elements( ).
LOOP AT tt_v_elements INTO e_element.
IF e_element-view_element->_definition_name = 'LABEL'.
*** here I need to get label text/value. It's inside a context node named LABELS.attrib1...N
ENDIF.
ENDLOOP.
ENDIF.
thank you
Glauco
Hi,
You want to get the Value of Label or the Attribute to which it is bound? Try the below code to get both text and binding path.
DATA: lr_label TYPE REF TO cl_wd_label,
lv_path TYPE string,
lv_text TYPE string.
lr_label ?= view->get_element( id = 'LABEL' ).
* Get Binding Path
lv_path = lr_label->bound_text( ).
* Get Label Text
lv_text = lr_label->get_text( ).
hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's simply perfect!
Now I can get the text and do not need to get path.
It works great like you said.
lc_label_text = lr_label->get_text( ).
Now I need to get element bind to label for property to see if it is mandatory. I think I must open another post to this new subject.
best regards friend.
Glauco
Hi Glauco,
Please modify your code as below
IF p_i_r_root_element IS INITIAL.
lr_comp_ctrl ?= p_i_r_comp.
lr_v_main_ctrl ?= lr_comp_ctrl->get_controller( name = p_i_view_name ).
lr_v_root_elem ?= lr_v_main_ctrl->get_root_element( ).
DATA: tt_v_elements TYPE wdr_element_tab,
e_element TYPE wdr_element_line,
lr_label type ref to cl_wd_label,
lv_text type string,
lc_label_text TYPE string.
tt_v_elements = lr_v_main_ctrl->get_elements( ).
LOOP AT tt_v_elements INTO e_element.
IF e_element-view_element->_definition_name = 'LABEL'.
*** here I need to get label text/value. It's inside a context node named LABELS.attrib1...N
" collect object into lr_label
lr_label ?= e_element-view_element.
"Get the text of label
if lr_label is bound.
lv_text = lr_label->get_text( ). "use this text based on your requirement
endif.
ENDIF.
ENDLOOP.
ENDIF.
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi glauco,
will you please send the remaining code if possible so that i can check it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.