Dropdown list in alv toolbar
Hello,
I am trying to get a dropdown column in an ALV table. While searching in the forum I now have the dropdown in thr ALV column 'VALUE' but I am not able to to get values in the column.
I have one node called 'RES' type WDR_CONTEXT_ATTR_VALUE with the attributs VALUE and TEXT and the following coding:
***********************ALV INIT
data: lr_if_controller type ref to iwci_salv_wd_table,
lr_cmdl type ref to cl_salv_wd_config_table,
lr_cmp_usage type ref to if_wd_component_usage.
Instantiate ALV1 component
lr_cmp_usage = wd_this->wd_cpuse_alv( ).
if lr_cmp_usage->has_active_component( ) is initial.
lr_cmp_usage->create_component( ).
endif.
Get reference to model
lr_if_controller = wd_this->wd_cpifc_alv( ).
lr_cmdl = lr_if_controller->get_model( ).
data: lr_col type ref to cl_salv_wd_column,
lr_dropdown type ref to cl_salv_wd_uie_dropdown_by_key.
create object lr_dropdown
exporting
selected_key_fieldname = 'VALUE'.
lr_cmdl->if_salv_wd_table_settings~set_read_only( abap_false ).
lr_col = lr_cmdl->if_salv_wd_column_settings~get_column( id = 'VALUE' ).
lr_col->set_cell_editor( lr_dropdown ).
data: lt_valueset type table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value,
lr_node type ref to if_wd_context_node,
lr_nodeinfo type ref to if_wd_context_node_info.
lr_node = wd_context->get_child_node( name = wd_this->wdctx_res ).
lr_nodeinfo = lr_node->get_node_info( ).
ls_valueset-value = '1'.
ls_valueset-text = 'eins'.
append ls_valueset to lt_valueset.
ls_valueset-value = '2'.
ls_valueset-text = 'zwei'.
append ls_valueset to lt_valueset.
lr_nodeinfo->set_attribute_value_set(
exporting
name = 'VALUE'
value_set = lt_valueset
data: itab_res type table of wd_this->element_res,
stru_res type wd_this->element_res.
append stru_res to itab_res.
lr_node->bind_table( itab_res ).
Anyone knows what I am doing wrong?
regards
Stefan
Hi ,
I think its not get updated because the external context mapping of the node is done at design time... so remove the design time mapping and do the dyanamic mapping .. once the attributes valueset is updated.. see the below code...
Instantiate ALV component
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.
Pass context node to ALV
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->set_data( dyn_node ).
hope this will help ..............
Regards
Yash
Similar Messages
-
Making field as Dropdown list in ALV
Hi
This is the code for making field as dropdown list in ALV.
But wat do you mean by HANDLE here.
What is the value one indicates.
FORM prepare_drilldown_values.
DATA lt_ddval TYPE lvc_t_drop .
DATA ls_ddval TYPE lvc_s_drop .
ls_ddval-handle = '1' .ls_ddval-value = 'JFK-12' .
APPEND ls_ddval TO lt_ddval .
ls_ddval-handle = '1' .
ls_ddval-value = 'JSF-44' .
APPEND ls_ddval TO lt_ddval .
ls_ddval-handle = '1' .
ls_ddval-value = 'KMDA-53' .
APPEND ls_ddval TO lt_ddval .
ls_ddval-handle = '1' .
ls_ddval-value = 'SS3O/N' .
APPEND ls_ddval TO lt_ddval .
CALL METHOD gr_alvgrid->set_drop_down_table
EXPORTING
it_drop_down = lt_ddval .
ENDFORM. " prepare_drilldown_values
Regards
Sandeep ReddyHi,
REPORT YMS_DROPDOWNLISTBOX.
TYPE-POOLS : VRM.
TABLES : AFKO,AFPO,SSCRFIELDS.
DATA : BEGIN OF IAFKO OCCURS 0,
AUFNR LIKE AFKO-AUFNR,
END OF IAFKO.
DATA : BEGIN OF IAFPO OCCURS 0,
MATNR LIKE AFPO-MATNR,
END OF IAFPO.
DATA : ITAB TYPE VRM_VALUE.
DATA : VID TYPE VRM_ID.
DATA : ITAB1 TYPE VRM_VALUES ,
ITAB2 TYPE VRM_VALUES .
DATA : FLAG.
PARAMETERS : P_AUFNR LIKE AFKO-AUFNR AS LISTBOX VISIBLE LENGTH 15.
INITIALIZATION.
SELECT AUFNR FROM AFKO UP TO 10 ROWS INTO TABLE IAFKO WHERE AUFNR LIKE
'%704%'.
LOOP AT IAFKO.
ITAB-KEY = IAFKO-AUFNR.
ITAB-TEXT = IAFKO-AUFNR.
APPEND ITAB TO ITAB1.
ENDLOOP.
AT SELECTION-SCREEN OUTPUT.
VID = 'P_AUFNR'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = VID
VALUES = ITAB1
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks,
Sankar M -
Hii,
I am showing one of my Column Cells of ALV grid as DropDown List.
I have developed this Code for that.
DATA : ls_drpdwn TYPE lvc_s_drop,
lwa_holders LIKE LINE OF gt_holders,
gt_drpdwn1 TYPE lvc_t_drop.
FIELD-SYMBOLS : <lwa_fcat> TYPE lvc_s_fcat.
LOOP AT lt_fcat ASSIGNING <lwa_fcat>.
IF <lwa_fcat>-fieldname EQ 'SHNAME'.
<lwa_fcat>-edit = 'X'.
<lwa_fcat>-drdn_hndl = 1.
ENDIF.
ENDLOOP.
LOOP AT gt_holders INTO lwa_holders.
ls_drpdwn-handle = 1.
ls_drpdwn-value = lwa_holders-shname.
APPEND ls_drpdwn TO gt_drpdwn1.
CALL METHOD ref_grid->set_drop_down_table
EXPORTING
it_drop_down = gt_drpdwn1.
My Issue is How can I make my column's SHNAME cells to show Different Share Name List for different Holder's Id i.e Cell's should display dynamic List for Different Primary Keys.
Thanks and Regards,
Dhiraj B.Hi Dhiraj,
Check this report which does exactly to your requirement : BCALV_EDIT_07.
Thanks & Regards,
Faheem. -
How create combo/dropdown list in Acrobat toolbar?
Hi! How create combo/dropdown list in my custom Acrobat toolbar (using plugins SDK)?
You can add a dropdown/flyout menu to a toolbar button using the APIs provided. There is a sample in the SDK.
There is no support for an edit field or other type of UI. -
Hi all,
Im using container to display the ALV.
I am passing handler and values in the dropdown.
and in my ALV, by checking the hadler im displaying the data. Everthing seeems fine.
I want to pass the key instead of text in the dropdown .
what to do?
Rgds,
KanalHoe to do it ?
My iternal table conatins,
Key value
10 aaaa
20 bbb
and the value in dropdwn is
lv_filed_cat-drdn_handle = 1
lv_filed_cat-value = itab-value
and the result is coming fine.
While saving , i get an error "maximum 2 char allowed"
Rgds,
SAP -
Make self defined function on ALV toolbar invisible
Hello Experts,
I have defined a self defined function dropdown on standard ALV toolbar on the Lead select event and defined the function too.
But I want at some condition the dropdown should disappear. How can I set the drop down on the ALV toolbar to invisible.
Please suggest.
Thanks and Best Regards,
SahilWhile defining the drop down, just bind the visible property to a context node attribute of type WDUI_VISIBILITY and set it based on your requirement.
Manas Dua -
The History dropdown list has stopped updating. What can I do?
The dropdown list on the toolbar is stuck where it was weeks ago. All other history lists work, ie All history folders and url dropdown.
A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
*http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
*https://support.mozilla.com/kb/Bookmarks+not+saved#w_places-database-file -
How to add a dropdown box in an ALV toolbar??
hi,
i have a requirement where i need to add a dropdown box in my ALV Toolbar. To be precise next to the export button in my ALV.
Plz help me on this, thanks.Hi Frank,
I am providing the some peice of code which will be helpful to you.
Adding the DropDown list to the ALV toolbar:
lr_functions ?= wd_this->r_table.
lr_function = lr_functions->create_function( 'MYDROPDOWNBYINDEX' ).
create object lr_dropdown_by_idx
exporting
texts_elementname = 'DROPDOWNBYINDEX.VALUE'.
lr_dropdown_by_idx->set_label_text( 'MYDROPDOWNBYINDEX' ).
lr_function->set_editor( lr_dropdown_by_idx ).
Providing the values to that DropDown:
Here in my example DROPDOWNBYINDEX.VALUE is the context attrubute. And i write the Supply function for that node as follows:
data:
lt_dropdownbyindex type if_componentcontroller=>elements_dropdownbyindex,
ls_dropdownbyindex type if_componentcontroller=>element_dropdownbyindex.
ls_dropdownbyindex-value = 'Nothing'. "#EC NOTEXT
append ls_dropdownbyindex to lt_dropdownbyindex.
ls_dropdownbyindex-value = 'ActionDropdownByIndex'. "#EC NOTEXT
append ls_dropdownbyindex to lt_dropdownbyindex.
node->bind_table( lt_dropdownbyindex ).
For reference you can refer the WD component SALV_WD_TEST_TABLE_TOOLBR which holds the same code
Hope this will help you. Reward points if it helps.
Cheers,
Darshna. -
I have several dropdown lists in my bookmarks toolbar and would like to access the properties for some of the the items. This used to work fine. However, now, when I go to the list and place the cursor on a particular item, the context menu that is usually available on a right click disappears when I try to access one of the options. This is the menu that begins with Open. What can I do to regain this functionality? I really need the information in the Properties section. I'm using Firefox 3.6.8
Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
Also check the Mouse driver settings in the Control Panel. -
Is it possible to create the ALV output with dropdown list for the columns
Hi forum experts,
Could the ALV output contain the dropdown list for the column names? if yes, then how we can acheive this to happen.
Thanks in advance,
Regards,
Samad.
Edited by: Samad arif on Aug 21, 2009 4:40 PMHi Arif,
Yes we can .FOr the codding check the article,
[dropdowns in ALV|https://wiki.sdn.sap.com/wiki/display/Snippets/DropdownsinALV]
regards,
Archana
Edited by: Archana Kumari on Aug 21, 2009 1:22 PM -
ALV: Dropdown list individual for each line of the table
Hi
Question.. I would like to make a dropdown list for a field in the ALV list. The dropdown list is not the difficult point. But this dropdown list should be based on the line item.
Example:
Material 100.100 has plants (10, 20, 30)
Material 100.800 has plants (60, 70)
so the ALV list should show in the dropdown menu only the plants that this material has.
As I'm not sure, that my explanations are any good, here a example:
<u>
ALV-List</u>
Material Description Plants
100.100 Screwdriver (Dropdown list shows only 10,20,30)
100.800 Hammer (Dropdown list shows only 60,70).
Can anyone tell me if this is feasable? And if so how? Is it do-able with this method?
call method grid->set_drop_down_table
exporting
it_drop_down = lt_dropdown.
The program BCALV_EDIT_07 has sort of two different dropdown lists.. but I have more then two materials, there would be many lists to create.. (many drop_down_handle's)
Any other idea?
I know, this is a tricky one...
Thanks
Petra
Message was edited by:
Petrahi
i have a code for drop down list use this
this code is for selection-screen deop-down list yu can add this same code in ALV
REPORT ZCHETANA_PRAC10 .
Type-pools: VRM.
data: name type vrm_id,
list_month type vrm_values,
list_year type vrm_values,
value type vrm_value.
selection-screen: begin of block b with frame.
parameter: p_year(10) type c as listbox visible length 10,
p_month(10) type c as listbox visible length 10.
selection-screen: end of block b.
at selection-screen output.
value-key = 'JAN'.
value-text = 'JAN'.
append value to list_month.
value-key = 'FEB'.
value-text = 'FEB'.
append value to list_month.
value-key = 'MAR'.
value-text = 'MAR'.
append value to list_month.
value-key = 'APR'.
value-text = 'APR'.
append value to list_month.
value-key = '1998'.
value-text = '1998'.
append value to list_year.
value-key = '1999'.
value-text = '1999'.
append value to list_year.
value-key = '2000'.
value-text = '2000'.
append value to list_year.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'P_MONTH'
VALUES = list_month
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'P_YEAR'
VALUES = list_year
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
write:/ p_year,
p_month. -
How to trigger dropdown list click in editable alv?
I have an editable alv - and wehn a certain field is changed - I want to force the user to update a 2nd field, which is filled via a dropdown list.
Ive trapped the change of the first field, in the handle_data_changed method, but need to from there - call an event to simulate a click onthe 2nd dropdown field, and can not figure out how to do that. the method modify_cell wont work as it expects a value to be passed in and I need to use my dropwdown.
How is this done?
Do I have to change it from a dropdown to an f4 event? I woudl really rather not.Dear srivallika,
first you have do build up an steploop on your dynpro for the it_ccode-bukrs
AT PBO
loop at it_ccode cursor g_ccode_cur into wa_cccode.
my set loopc
module ccode_loopc.
endloop.
Include PBO
module ccode_loopc.
g_ccode_loopc = sy-loopc.
endmodule.
You only see via DIAG Dialog the displayed rows on the Dynpro.
So if you only have a steploop of 4 rows -- you only get 4 rows to the wgate.
Better use the field-set makro.
AT PBO
module rfc_fieldset_ccode.
INCLUDE PBO
module rfc_fieldset_ccode.
data: ls_ccode like line of it_ccode.
data: i type i.
I'll use deeper structure
perform rfc_fieldset_ccode.
but you also can define the code here
loop at it_ccode into ls_ccode.
add 1 to i.
field-set 'INDX' i i .
field-set 'BUKRS' i ls_ccode-bukrs .
endloop.
endmodule.
Why to do this? The field-set makro (don't forget to include AVWRTCXM at your topinclude) will send the data from internal table via AGATE to the WGATE.
Here now you can define the dropdown list:
srivallika, i'll hope i could help you a little. If you have any questions, you won't bother me. ASK!
With best regards
Thorsten -
Hi,everyone.
I have a problem with dropdown field in alv .
When i set some fields dropdown in alv created by oo.
i can't input words in this field . can anyone give me some advice?
ths!Hi,
steps..
1. X_FIELDCAT-DRDN_HNDL = '1'. "pass this to the field you want to show as drop down
2.
DATA: X_OCRC LIKE LINE OF IT_OCRC.
DATA:LT_DRAL TYPE LVC_T_DRAL,
LS_DRAL TYPE LVC_S_DRAL.
LOOP AT IT_OCRC INTO X_OCRC.
* First listbox (handle '1').
IF SY-INDEX = 1.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = ' '.
LS_DRAL-INT_VALUE = ' '.
ELSE.
LS_DRAL-HANDLE = '1'.
LS_DRAL-VALUE = X_OCRC-COMBI.
LS_DRAL-INT_VALUE = X_OCRC-COMBI.
ENDIF.
APPEND LS_DRAL TO LT_DRAL.
ENDLOOP.
**Setting the Drop down table for field1
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = LT_DRAL.
for sample code check here i gave one.
Event for the List Box in ALV Grid Control
Regards
vijay -
F4 help for a dropdown field in ALV
I am trying to enable F4 help for a field in ALV (OO style) that also has a dropdown assigned to it.
If I enable the dropdown in the field catalog, the field does not respond to F4 event at all.
When I remove the dropdown attribute from the field catalog, the F4 help works, but obviously now there is no dropdown.
The reason I am trying to implement it this way is that my dropdown list (which is the same for all rows) is quite large while F4 help depends on the current line in the ALV (so the available values are limited).
I would like to try to avoid creating a dropdown handle for every row in ALV.
Does anybody know if it's even possible to have a dropdown and F4 help at the same time in ALV?Hi
Linking F4 Help to Fields
For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event onf4 at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the onf4 event. For this you must prepare a table of type LVC_T_F4 and register this table using the method register_f4_for_fields. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
1) Pass the fieldname to FIELDNAME
2)Set REGISTER to make the field registered,
3)Set GETBEFORE to provide field content transport before F4 in editable mode
4)Set CHNGEAFTER to make the data changed after F4 in editable mode.
Preparing table for the fields to be registered to trigger F4 event
DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
lt_f4-fieldname = 'PRICE'.
lt_f4-register = 'X' .
lt_f4-getbefore = 'X' .
APPEND lt_f4 .
CALL METHOD gr_alvgrid->register_f4_for_fields
EXPORTING
it_f4 = lt_f4[] .
A sample onf4 method implementation
METHOD handle_on_f1 .
PERFORM f4_help USING e_fieldname es_row_no .
er_event_data->m_event_handled = 'X' .
ENDMETHOD .
Again, we set the attribute er_event_data->m_event_handled to prevent further processing of standard F4 help.
Check this link
http://help.sap.com/saphelp_nw04/helpdata/en/ed/ec623c4f69b712e10000000a114084/content.htm
Check these standard programs
BCALV_GRID_F4_HELP_APPLICATION
BCALV_GRID_F4_HELPM01
BCALV_TEST_GRID_F4_HELP
Regards
Pavan -
How can I use a Dropdown list in a table col and only get the choosen key?
hi!
I have chosen Cell editor = Dropdown for two of the columns in my WD table (ordinary Table not ALV) .
When the table is displayed the first time this looks OK, but if a user selects a value from the dropdown list, both the key and the explanation text is copied into the cell, and the cell column is automatically widened. I want to copy the key value only, and not the connected text. How is this possible?
I started setting the table as fixed and setting the width on the column, but this was a puzzle I gave up since there are quite a lot of columns.
regards, TineWell , the problem is that in the dropdown list I want to see both the key value and the text, like you do in SAP GUI. Fex. if I would like to create a dropdown for langauges, factory calendar or countries, I want to see both the country code (the key) and the name of the country in the dropdown list, and then when user choose a line I would only like to see the keyvalue in the input field. Right now I concatenate the key and the text into the 'value' in the valueset table.
In some cases the user knows the key value better than the explanational text, and then it is good to show both values. But sInce I would like to save space in the table displayed in the view I only want to show the key values selected in the table (ex. NO if user choose Norway) .
But maybe it is better to create this kind of input help as an OVS with no input fields .?
Maybe you are looking for
-
Foreign language setting??
It seems crazy, but I can't figure out how to put pages into a setting so that I can write in Spanish without red underlining every word...there MUST be a way...right? If you have any idea how to change the language setting, PLEASE let me know! It wo
-
My iPhone 4s seems to be running slower and crashes after the ios6 upgrade. The power off button does not appear when I try to power it off, the screen just goes blank.
-
when we create info object, there is a option about reference and template . what does mean by that? here is the screen shoot. http://xs.to/xs.php?h=xs322&d=07501&f=reference-template.jpg
-
I want to set endeca_jsp ref app as preview url in Workbench 3.1.2 , but seems to be its not possbile. It was possible in EM 2.1.2 version Can anyone provide me any pointers to accomplish the same.
-
Download link to server103_apacheplugins.zip broken
Looking for the link to server103_apacheplugins.zip at http://download.oracle.com/otn/bea/weblogic/server103/server103_apacheplugins.zip getting 404 errors. Cannot "Save As" with the link either, file not found error.