On basis of drop down by key values i want to enable and disable ui elements is wda
How to enable and disable ui elements on basis of drop down by key values as i show in screen shot i have 3 values in drop down by key on basis of those values i need to enable and disable ui elements in webdynpro abap kindly reply back
Hi Sreedhara,
There are many tutorials on SCN for learning Web Dynpro ABAP. If the following steps don't make sense to you, please do a search for some tutorials and read through the tutorial materials. Hopefully the tutorials will help you to become familiar with some of the basics of Web Dynpro ABAP.
Here is how to enable or disable a UI element upon selection from a DropDownByKey.
In your view context, create a context attribute of type wdy_boolean. For now, let's call this attribute IS_ENABLED
In your view layout, bind the enabled property of the UI element to the context attribute IS_ENABLED.
In your view actions, create an action-- let's call it SET_ENABLED-- and bind this action to the DropDownByKey element's onSelect event in the view layout.
In the event handler method for the SET_ENABLED action, use the Code Wizard to read the value of the DropDownByKey selected value, then use the Code Wizard again to set the value of context attribute IS_ENABLED to either true or false.
Now when a value is selected from the DropDownByKey, the SET_ENABLED action will be triggered and the IS_ENABLED context attribute will be set to either true or false. Since your UI element's enabled property is bound to this true or false value via the context binding, the UI element will change to enabled or disabled.
Good luck!
Cheers,
Amy
Similar Messages
-
Hi,
when i built value set for the first time for drop down by key, values( texts ) are displayed correctly, however when it is re-built based on other drop down instead of showing texts it is showing the key value in drop down, however if select drop down, text will be selected though key is displayed.
i think it is something to do with drop down by key size adjustment, how to solve this.
i guess we can use 'CALC_WIDTH4DDLBBYKEY' method of cl_wd_utilities, but how to use this??
Please suggest!!
Edited by: kranthi kumar on May 5, 2011 3:58 PMHi Kranthi,
You cant adjust drop down size manually.
According to the values inserted in the dropdown, its size increased automatically.
If there are no values in dropdown it will be small in size but with values its size increases.
You can adjust WIDTH of drop down, but after filled with values it takes value size.
While filling drop down key and value, pass same value to key and value.
Example code :
DATA : node_info TYPE REF TO if_wd_context_node_info,
value TYPE wdy_key_value,
set TYPE wdy_key_value_table,
k2 type string value 'BOX',
v2 type string value 'BOX',
k3 type string value 'LOOSE',
v3 type string value 'LOOSE'.
value-key = k2.
value-value = v2.
APPEND value to set.
value-key = k3.
value-value = v3.
APPEND value to set.
node_info = wd_context->get_node_info( ).
node_info = node_info->get_child_node( 'PACK_MAT' ).
node_info->set_attribute_value_set( name = 'PACK_MATERIAL'
value_set = set ).
Cheers,
Kris. -
Restrict the number of visible values in drop down by key?
Hello,
Is it possible to restrict the max. number of entries displayed in a drop down by key element? By default i get 10 entries which i would like to limit to 5. Thanks.
Regards,
VasuHi,
If you have a set of default values (which come from the domain), you can restrict them to the specific values which you need to display. In the INIT method of the view in which this UI element is present, you will have to write code to delete the entries which you do not wish to show in the drop down by key element.
Have a look at this code snippet:
data: node_info type ref to if_wd_context_node_info,
elem_attr type wdr_context_attribute_info.
node_info = wd_context->get_node_info( ).
node_info = node_info->get_child_node( 'CHILD_NODE' ).
data: lt_valueset type wdr_context_attr_value_list,
l_value type wdr_context_attr_value.
call method node_info->get_attribute
exporting
name = 'ATTR1'
receiving
attribute_info = elem_attr.
lt_valueset = elem_attr-value_set.
delete lt_valueset where value = 'VALUE1'.
node_info->set_attribute_value_set(
name = 'ATTR1'
value_set = lt_valueset ).
Hope this helps.
Regards,
Wenonah -
Clear the values in Drop down by key
hi all ,
i m using drop down by key (Combo box) ..
i have populated some values in that ..
then i navigate to next view ... from that view i m again navigating back to the
previous view .. now the values which was filled needs to be cleared ..
i used invalidete method also even though the values are present in the list ..
can any one help in this ...
points will be rewarded
Thanks and regards
JKHi,
Do you want the currently selected value to be reset, or do you want to delete the entire list of values? If you want to only reset your current selection, node->invalidate( ) should do it. Invalidate your node in the inbound plug handler.
Regards
Nithya -
Drop Down BY Index Vs Drop Down By Key
What is the difference between Drop Down By Index & Drop Down By Key.
How Do we retrive What value is selected in a drop down
regards
NileshHello Nilesh,
//Create ISimpleTypeModifiable to fill the dropdownbox
//XXX is your Desc field
IWDAttributeInfo soAttribInfo= wdContext.getNodeInfo().getAttribute("XXX");
ISimpleTypeModifiable soType = soAttribInfo.getModifiableSimpleType();
soType.setFieldLabel("XXXX");
IModifiableSimpleValueSet soSet= soType.getSVServices().getModifiableSimpleValueSet();
soSet.clear();
//To Get desc and key from web services you pass some information to the run the given Webservice do it here
wdContext.currentRequest_XXXViDocument_getDescnKeyArrayElement().setInfo(infonr);
wdThis.wdGetXXXController().getDescObjects();
int size = wdContext.nodeResult_getDescObjectsArray().size();
if (size != 0)
//Filling the desc in the dropdownbykey field
for (int i=0; i<wdContext.nodeResult_getDescObjectsArray().size(); i++ )
IPrivateXXView.IResult_getDescObjectsArrayElement soElement =
wdContext.nodeResult_getDescObjectsArray().getResult_getDescObjectsArrayElementAt(i);
soSet.put(soElement.getkey(),
soElement.getDesc().trim() + " " + soElement.getkey().trim() );
Implement this code for populating the drowdown when that works I can tell you the next step.
Good Luck,
Dharmi -
Hi,
Explaining my problem with an example.
There is a hotel table where user enter hotel details
Like City, Dep Date, Arr Date, No of Days , rate etc and these in turn get saved to table say USER_HOTEL_DETAILS . When user comes to his plan/entered details again, previously saved data is shown to him.
For making a selection for City I have to give a dropdown to user with cities list that are maintained in other table say HOTEL_DATA which has city, rate, and currency fields and city is the key of table.
Now if I use drop down by key or index for city I need to fetch city values from table HOTEL_DATA and have to populate context of city field of USER_HOTEL_DETAILS.
For dropdown my value text is going to be city .For key if I try to give serial numbers say 1, 2, 3 as key for populating dropdown, the key will get stored in database table against city name. To avoid this while saving data I have to write additional code while saving and retrieving data that take value against selected key.
To avoid this one way is to use city name as both Key and Value. What is the other alternative I can use for? Please help
Regards,
MadhvikaHi ,
It is better to have citykey in HOTEL table and maintain a text table for the same.This is good approach.
Because tommorow if city needs to be displayed in other text also just adding the same in the text table would be suffice.
For city texts retrieve it from text table and bind to the node.
Regards,
Madhu -
Hi all,
I Inserted several drop down by key in my view at design time. When I try to run the application it displays an error as
java.lang.ClassCastException at com.sap.tc.webdynpro.progmodel.context.Paths.getAttributeInfoFor(Paths.java:202)
My requirement is,
I am getting a table with two fields(key,value) from R/3 I want to display these in the drop down by key box how to bind them to this drop down.Hi Refer the below link
DropdownList box to display R/3 table
Re: DropdownList box to display R/3 table
see this link for when to use DropDownByIndex (DDI) vs DDK (DropDownByKey) and how populate data from R/3.
Re: webdynpro populating dropdown values programmatically
populating dropdownbyvalue with the r/3 value?
Re: Regarding DropDown Box
/message/2187817#2187817 [original link is broken]
Re: DropdownList box to display R/3 table
create context value attribute and bind to drop down by key
not getting value from DropDownByKey
Dropdown by key
dynamic DropDownByKey
http://help.sap.com/saphelp_nw04/helpdata/en/4a/8613e41629344194e4f40393740d51/content.htm
For DropdownbyKey
http://help.sap.com/saphelp_nw04/helpdata/en/08/13dbfb6e779743bb2ca641ebcb3411/content.htm
For DropdownByIndex
http://help.sap.com/saphelp_nw04/helpdata/en/24/25e08d4ba6c743b55f1d375637ba8d/frameset.htm
Regards,
Saraswathi
Pls reward points for useful info. -
We have tried to add a WPS Canon Pixma-Pro to our Airport Extreme network. However when we are in Utilities and try to access the Base Station drop down menu nothing is highlighted. Therefore we can not click on the Add WPS Printer title. I'm sure it is some user error that we are overlooking, but extremely frustrated. Any help will be greatly appreciated.
Open AirPort Utility
Click on the AirPort Extreme icon
Click Edit in the smaller window that appears
Now try the Base Station menu again -
Dynamic Drop-down list - selected value can't be cleared ...
1. check out the following code of a dynamic drop down list using cursor :-
DECLARE
-- DROP-DOWN LIST OF ALL DEPARTMENTS
TEMPNUMBER NUMBER(2) := 2 ;
-- Because we've to initialize the list
-- at least with 1 item.
CURSOR C_DEPT IS
SELECT DEPT_ID FROM DEPARTMENT;
BEGIN
ABORT_QUERY ;
CLEAR_LIST('DEPTLIST');
FOR TEMP IN C_DEPT LOOP
ADD_LIST_ELEMENT( 'DEPTLIST', TEMPNUMBER, TEMP.DEPT_ID, TEMP.DEPT_ID );
:SRBLOCK.LST := TEMP.DEPTNO;
-- prev. line set the newly selected value
TEMPNUMBER := TEMPNUMBER + 1 ;
END LOOP;
END;
2. problem is as we've to atleast initialize with one list item... that item can't be cleared with CLEAR_LIST.
3. how can i actually clear that and still use cursor. because i've searched forum for this thing and found all those code not working ... for my project ...
4. quick help needed ...Hi Omar,
I have solution for you
To populating or refreshing the lists you can use
two procedures:
One of them - generic, which can be used for all types of list
Another is specific which contain a SQL statement to retrieve the data for
particular list.
1. Specific procedure:
PROCEDURE GET_DEPARTMENT_LIST
IS
sql_stat VARCHAR2(32767);
ret_code NUMBER;
BEGIN
-- SQL Statement for Drop-down List
-- (must have two columns for label and value - both VARCHAR2)
sql_stat := ' SELECT DEPARTMENT_NAME,TO_CHAR(DEPT_ID)'
||' FROM SCHEMA.DEPARTMENT';
POPULATE_MY_LIST('BLOCK.DEPARTMENT_LIST',sql_stat,ret_code);
END;
2. Generic procedure:
PROCEDURE POPULATE_MY_LIST
(item_name VARCHAR2,
sql_stat VARCHAR2,
out_code OUT NUMBER)
IS
rg_id RECORDGROUP;
rg_name VARCHAR2(100);
ret_code NUMBER;
item_id ITEM;
BEGIN
item_id := FIND_ITEM(item_name);
IF ID_NULL(item_id) THEN
out_code := -1;
RETURN;
END IF;
--Creating Record Group with Unique Name
rg_name := 'RG_'||SUBSTR(item_name,INSTR(item_name,'.',1)+1,LENGTH(item_name));
--Checking Record Group Name for existance
rg_id := FIND_GROUP(rg_name);
--If Group does exist - delete it
IF NOT ID_NULL(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
--Creating Record Group
rg_id := CREATE_GROUP_FROM_QUERY(rg_name,sql_stat);
ret_code := POPULATE_GROUP(rg_id);
IF (ret_code <> 0) THEN
out_code := ret_code;
RETURN;
END IF;
POPULATE_LIST(item_name,rg_id);
IF NOT FORM_SUCCESS THEN
out_code := -2;
RETURN;
ELSE
out_code := 0;
END IF;
DELETE_GROUP(rg_id);
END;
Hope it help.
Dmitry -
Drop Down shows the values twice
Hi,
In MPP, there is a drop dop which displays all the Infotypes along with the description.
Populated all the Infotype using the FM F4IF_INT_TABLE_VALUE_REQUEST in Process on Value-request.
But the drop down shows the values twice as,
PA000 : Organisation Assignment PA000 : Organisation Assignment
PA001: Actions PA0001: Actions
In debugging,i have checked the internal table which i pass to the FM, it has only one time.
Could be help me to resolve this.?Ensure your code follows below logic
PARAMETERS: pa_it TYPE t582s-infty AS LISTBOX VISIBLE LENGTH 40 MODIF ID 2md.
TYPES: BEGIN OF t_infty,
infty TYPE t582s-infty,
itext TYPE char40,
END OF t_infty.
DATA: it_infty TYPE STANDARD TABLE OF t_infty WITH HEADER LINE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_it.
REFRESH it_infty.
SELECT * FROM t582s WHERE sprsl = sy-langu.
MOVE-CORRESPONDING t582s TO it_infty.
it_infty-itext = t582s-itext.
CONCATENATE it_infty-infty t582s-itext INTO it_infty-itext SEPARATED BY ' - '.
APPEND it_infty.
ENDSELECT.
PERFORM dropdown_list_values_create TABLES it_infty USING 'INFTY'.
FORM dropdown_list_values_create TABLES f_tab
USING retfield TYPE dfies-fieldname.
"display internal table as a dropdown list,
"return field 'INFTY' when the event is trigerred
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = retfield
value_org = 'S'
TABLES
value_tab = f_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "dropdown_list_values_create
Regards
Marcin -
Clicked on a drop down option asking if I wanted to use itune share I clicked on it and now my downloaded music is no longer on my ipod. I want my music back on my ipod as it was before, how do I do it ?
Hello wayne229,
Our article named iTunes 10 for Mac: Share your iTunes library found here: https://discussions.apple.com/thread/5020867 outline how to turn off iTunes Sharing.
It says it is for iTunes 10, but the same steps apply to iTunes 11.
To turn off sharing:
Choose iTunes > Preferences, and click Sharing.
Deselect “Share my library on my local network.”
Take care,
Sterling -
I am currently using FormsCentral to distribute a form created in Acrobat. I need to add an option to one of the drop down fields but do not want to re-distribute the form due to reporting purposes. How can I do this?
You can open the form in Acrobat, select "File > Save a Copy", open the copy you just saved (it doesn't happen automatically), edit the dropdown to add the new item, save as a new file, and then Reader-enable the file by selecting: File > Save As Other > Reader Extended PDF > Enable More Tools. The resulting PDF should work with FormsCentral just like the original.
-
creative cloud installed and run but doesn't display apps or anything for that matters , only a black bar at the top with creative cloud written and a drop down menu of (help pin on notification area and quit ), creative cloud installed and run but doesn't display apps or anything for that matters , only a black bar at the top with creative cloud written and a drop down menu of (help pin on notification area and quit )
don't know if it's relevant or not , I run Windows 8 64-bit111994 please try utilizing the steps listed in App doesn’t open | Progress wheel spins continually to resolve the current error.
-
Problem in getting the current value of the drop down while calling value change listener
I have 2 drop down list. I am trying to get the value of first drop down from other drop downs value change listener. Initially one drop down contains a default value. First time I got the value while calling the value change listener. But if I change the default value to other in the first drop down and call the value change listener of the second drop down then I got the old value in the bean. Can anyone suggest a process
If I use the following code it gives me the current index.
valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
System.out.println(valueChangeEvent.getNewValue());
This is also giving me current index.
BindingContainer container = BindingContext.getCurrent().getCurrentBindingsEntry();
AttributeBinding attrIdBinding = (AttributeBinding)container.getControlBinding("PersonTypeId1");
if(attrIdBinding.getInputValue()!=null)
System.out.println(attrIdBinding.getInputValue().toString());
But at last I got some help from Shay Shmeltzer's Weblog.
BindingContainer bindings =
BindingContext.getCurrent().getCurrentBindingsEntry();
// Get the sepecific list binding
JUCtrlListBinding listBinding =
(JUCtrlListBinding)bindings.get("PersonTypeId1");
// Get the value which is currently selected
Object selectedValue = listBinding.getSelectedValue();
long value =0L;
if(selectedValue!=null){
System.out.println("Sudip.. Person Type using bindings"+selectedValue.toString());
But this returns "ViewRow [oracle.jbo.Key[300000860721156 ]]"
300000860721156 is the original value.. Would you please help me to figure it. -
Popup instead of list when using WD4A ALV Grid Drop Down By Key
I am develop a WD4A application and I am using an ALV grid. I have set the cell editor for one column wiht the following code:
CREATE OBJECT lr_ddbk
EXPORTING
SELECTED_KEY_FIELDNAME = 'ZCURRENCY'.
Data: lv_key_visable TYPE abap_bool,
lv_key_visible_fieldname TYPE string.
lr_ddbk->set_type( if_salv_wd_c_uie_drdn_by_index=>type_key_value ).
* lv_key_visable = lr_ddbk->GET_KEY_VISIBLE( ).
* lv_key_visible_fieldname = lr_ddbk->GET_KEY_VISIBLE_FIELDNAME( ).
* lr_ddbk->SET_KEY_VISIBLE( abap_false ).
lr_alv_column->SET_CELL_EDITOR( lr_ddbk ).
This code works fine. I then fill the drop down with the following code:
*...Build the currency drop down list
DATA lv_default_currency TYPE wdr_context_attr_value.
DATA lv_currency_count TYPE STRING.
DATA ls_tcurt TYPE tcurt.
CLEAR ls_contextvalue_set.
CLEAR lt_contextvalue_set. REFRESH lt_contextvalue_set.
CLEAR lv_default_currency.
loop at it_ac_attr into ls_ac_attr.
if ls_ac_attr-attr_id eq 'CUR'.
select single * from tcurt into ls_tcurt
Where spras = 'EN' AND
waers = ls_ac_attr-value.
If sy-subrc = 0.
ls_contextvalue_set-value = ls_ac_attr-value.
ls_contextvalue_set-value = ls_ac_attr-value.
ls_contextvalue_set-text = ls_tcurt-ktext.
IF ls_ac_attr-DFT_FLAG = 'X'.
lv_default_currency = ls_contextvalue_set.
ENDIF.
append ls_contextvalue_set to lt_contextvalue_set.
endif.
Endif.
endloop.
lo_nd_zebuy_describe_item_info = lo_nd_zebuy_describe_item->get_node_info( ).
lo_nd_zebuy_describe_item_info->set_attribute_value_set(
exporting
name = 'ZCURRENCY'
value_set = lt_contextvalue_set ).
*...End build currency drop down list
This code works fine. The issue I am having is that the drop down is behaving like a search help field rather than a drop down list. Meaning a popup comes when I drop down the list. The popup has the values I have set. I don't want a popup I want a drop down list. Additionallly the field is editable (meaning I can type a value into the field as well as select a value). I want the user to only be able to select values from the list. Any help with this issue would be appreciated.I fugured out what I was doing wrong. I was setting the cell editor to cl_salv_wd_uie_input_field later in the code by mistake.
Maybe you are looking for
-
My recovery key is not working even after reseting it. How can i solve it
I signed to my account but lost other device, so generate new key. This new generated key is still not working. Anny sugestion please?
-
Need to reinstall Snow Leopard?
I'm sorry if this is in the wrong place, I am new to posting in the forum. I just got my iMac back a few days ago from Best Buy, it had the hard drive replaced (for the 2nd time in 7 months). What had happened this time was that it was constantly fre
-
How to align the output?
Hi all, The following code snippet: produced output like this: Material Number Created By Changed By Material Type Material Status Material description 000000000000000001 FRE8OT MES2KOR FERT Test 000
-
Customise Userid/Password rule
HI I want to set my own userid/password rule to the users.As per the standard, As per the requirement userid should be like below.. 1) Only First letter should be Alphabet 2) Rest are Numeric. 3) Length should be 7. Is it possible through configurat
-
Hi Experts, Can anyone tell me hwo to resolve this problem? This is classic scenario, version 4.0 The user has raised a shopping cart without assigning vendor to it, so it has gone error in process as we dont have the Purchase requistion scenario. I