on 05-20-2009 8:14 AM
Hi,
How can i bind the table data into menu in textview.
Please guide me to do this..
Regards,
Kumar L
Hi Kumar,
Is your issue resolved? If yes then please do the needful & close this thread.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kumar,
Just created a dumb example to try paste in here. I am displaying data from SFLIGHT in my table. I want to create MenuItem's dynamically for my first columns textview. (i.e., CARRID) I have created a Menu with id "MENU1" for the textview T1_CARRID. So now I need to create corresponding MenuItems for this menu dynamically. Below is the coding with which I am filling my table (done using a supply function method) & my coding for creating the MenuItems.
Regards,
Uday
Coding to fill my table with data (supply function method):
method SUPPLY_DATA .
data: lt_data type wd_this->elements_sflight.
select carrid
connid
fldate
price from sflight into table lt_data.
node->bind_table( new_items = lt_data ).
endmethod.
Coding to create the MenuItem dynamically:
method WDDOMODIFYVIEW .
check first_time = abap_true.
data: lr_menu type ref to cl_wd_menu,
lr_menu_item type ref to cl_wd_menu_action_item,
lv_str type string,
lt_carrid type standard table of sflight-carrid,
wa_carrid type sflight-carrid.
*** Fetch few carrid values which would be used as texts while creating menu items
select distinct carrid from sflight up to 5 rows into table lt_carrid.
*** Get the reference of the Menu created at design time. We need to add menu items to this element
lr_menu ?= view->get_element( id = 'MENU1' ).
loop at lt_carrid into wa_carrid.
*** Menu item expects the text to be passed to it in a string variable. So swap the variables...
lv_str = wa_carrid.
*** Create a new instance of the MenuActionItem
lr_menu_item = cl_wd_menu_action_item=>new_menu_action_item( ).
*** Add text to the created MenuActionItem
lr_menu_item->set_text( value = lv_str ).
*** Finally associate the created MenuActionItem with the layout's Menu element
lr_menu->add_item( exporting index = sy-index
the_item = lr_menu_item ).
endloop.
endmethod.
So now when I test my component the all textviews in the CARRID column would be having 5 menuitems created with the values as in internal table lt_carrid.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kumar,
Can you please be a bit more clear about your requirement? You mean to say that suppose I give a menu for all the textviews in column1. Then within any of the cells of column1 the user should get a menu with all the possible values for this column?
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 |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.