on 08-28-2008 7:15 AM
Hello Experts,
I have internal table in format shown below
Internal table: T_IT
FIELD1 FIELD2
SAN 10
JAN 20
I need to display this internal table in textview which should be created dynamically at runtime,such that
each row of the internal table is assign to two different text view ( txtview1 and txtview2) and should be
placed on the screen as shown below
Textview1 (SAN) Textview2(10)
Textview3(Jan) TextView4(20)
......
.....
....
And I need to assign this Textview to transparent container.
Please help me how to do this .
Regards,
Sanju
Hi,
Please check this below code.I am getting the output as per your requirement.
method WDDOMODIFYVIEW .
types:begin of ty_tab,
field1(5),
field2(5),
end of ty_tab.
data:it_tab type table of ty_tab,
ls_tab type ty_tab.
ls_tab-field1 = 'Jan'.
ls_tab-field2 = 'Feb'.
append ls_tab to it_tab.
ls_tab-field1 = 'Mar'.
ls_tab-field2 = 'Apr'.
append ls_tab to it_tab.
Data lv_textview1 type ref to cl_wd_text_view.
Data lv_textview2 type ref to cl_wd_text_view.
Data lv_trans_cont type ref to cl_wd_transparent_container.
Data lr_container type ref to cl_wd_uielement_container.
Data: lr_flow_data type ref to cl_wd_flow_data,
lr_horizontal type ref to CL_WD_HORIZONTAL_GUTTER.
data: str1 type string,
str2 type string,
id1 type string,
id2 type string,
lv_tabix type c.
loop at it_tab into ls_tab.
lv_tabix = sy-tabix.
concatenate 'TXT1' lv_tabix into id1.
concatenate 'TXT2' lv_tabix into id2.
str1 = ls_tab-field1.
str2 = ls_tab-field2.
lv_textview1 = cl_wd_text_view=>new_text_view(
ID = id1
TEXT = str1
).
lv_textview2 = cl_wd_text_view=>new_text_view(
ID = id2
TEXT = str2
).
lr_horizontal = cl_wd_horizontal_gutter=>new_horizontal_gutter(
* BIND_ENABLED = BIND_ENABLED
* BIND_HEIGHT = BIND_HEIGHT
* BIND_RULE_TYPE = BIND_RULE_TYPE
* BIND_TOOLTIP = BIND_TOOLTIP
* BIND_VISIBLE = BIND_VISIBLE
* BIND_WIDTH = BIND_WIDTH
* ENABLED = ABAP_TRUE
* HEIGHT = E_HEIGHT-MEDIUM
* ID = 'HORIZONTAL1'
* RULE_TYPE = E_RULE_TYPE-AREA_RULE
* TOOLTIP = TOOLTIP
* VIEW = VIEW
* VISIBLE = E_VISIBLE-VISIBLE
* WIDTH = `100%`
).
lr_flow_data = cl_wd_flow_data=>NEW_FLOW_DATA( element = lv_textview1
).
lr_flow_data = cl_wd_flow_data=>NEW_FLOW_DATA( element = lv_textview2
).
lr_flow_data = cl_wd_flow_data=>NEW_FLOW_DATA( element = lr_horizontal
).
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_container->add_child( lv_textview1 ) .
lr_container->add_child( lv_textview2 ) .
lr_container->add_child( lr_horizontal ) .
endloop.
endmethod.
Still your problem is not solved let me know.
Thanks,
Suman.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Data are appearing vertically and not horizontally , I used grid layout for the container but since
it is going for the dump( type casting error from flow layout to grid layout), i changed the layout
to flow layout,please tell me how to make two textview appear horizontally
Regards,
Sanju
Edited by: Sanju Joseph on Aug 28, 2008 8:25 PM
Edited by: Sanju Joseph on Aug 28, 2008 8:26 PM
Hi,
Please ignore my previous mail , both the textview(textview1 and textview2) data are appearing
horizontally but data are getting concatenated , for example if my texview1 is holding value u201810u2019
and textview2 is holding value u201820u2019 then at time of display it is getting appeared as u20181020u2019 .
I have used grid layout with ColCount as u20182u2019 , beside this I need one more help of triggering
an event when one of the data is selected , for example if I trigger 20 , it should trigger an
event and in the event is should be able to hold the value of 20 and pass this to some local
variable for further processing .Please let me know if this is possible .
Regards,
Sanju
Hi,
As you said , i used grid layout instead of flowlayout and it;s working now
Data: lr_grid_data type ref to cl_wd_grid_data ,"grid layout
lr_horizontal = cl_wd_horizontal_gutter=>new_horizontal_gutter( ) .
lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_textview1
).
lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_textview2
).
lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_horizontal
).
Thanks a lot for your initiative , you got your point , i am creating separate thread for event handling for textview , not sure if it is possible or not
let's try
Regards,
Sanju
Hi,
You can try this:
Data lv_textview1 type ref to cl_wd_text_view.
Data lv_trans_cont type ref to cl_wd_transparent_container.
Data lr_container type ref to cl_wd_uielement_container.
Data lr_flow_data type ref to cl_wd_flow_data.
lv_textview1 = cl_wd_text_view=>new_text_view.
lv_textview1=>set_text ( value = 'Data' ).
lv_trans_cont = cl_wd_transparent_container=>new_transparent_controller.
lv_trans_cont->add_child(lv_textview1).
lr_flow_data = cl_wd_flow_data=>new_flow_data (element = lv_trans_cont ).
lr_container ?= view->get_elememt( 'ROOTUIELEMENTCONTAINER' ).
lr_container=>add_child ( lv_trans_cont )
I hope this will give you a good idea.
Plz revert back wid issues.
Regards,
Sumit Oberoi
Edited by: Sumit Oberoi on Aug 28, 2008 10:04 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.