cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Drop down by key

konchada_saikrishna
Active Participant
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

saraswathi_d
Participant
0 Kudos

Hi Refer the below link

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.

populating dropdownbyvalue with the r/3 value?

/message/2187817#2187817 [original link is broken]

create context value attribute and bind to drop down by key

Dropdown by key

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.

lajitha_menon
Contributor
0 Kudos
konchada_saikrishna
Active Participant
0 Kudos

Hi L.M,

I have already gone through this help file and implemented it, the result is I could see the drop down but in a readonly mode which does not display the list on clicking the box (but could see values if it was binded to a table). Here is the code,

IWDMessageManager msgmgr = wdThis.wdGetAPI().getComponent().getMessageManager();

IWDAttributeInfo aInfo=wdContext.nodeDropdowns().getNodeInfo().getAttribute("Language");//.getNodeInfo().getAttribute("Dropdowns.Language");

if(aInfo!=null)

{

IModifiableSimpleValueSet valSet=aInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();

for(int i=0;i<wdContext.nodeF4_Language().size();i++)

{

valSet.put(wdContext.nodeF4_Language().getF4_LanguageElementAt(i).getSprsl(),wdContext.nodeF4_Language().getF4_LanguageElementAt(i).getSptxt());

}

wdContext.currentF4_LanguageElement().setSprsl("E");

}

else

{

msgmgr.reportSuccess("attribute info fail");

}

i have tried it in both init() and modify() of the view.

my context is like this

Context

(1 modelnode)F4_Language(binded to custom node)

(1 attributes)spras,sprsl,sptxt

(2 valuenode)Dropdowns

(2 attribute)Language(which is mapped/binded to dropdownby key)

Please help me,

With regards,

Sai Krishna.

Former Member
0 Kudos

How is the "selectedKey" property of the dropdown-list bound?

Armin

konchada_saikrishna
Active Participant
0 Kudos

Hi Armin,

In view I have a

context

(value node) Dropdowns

(value attribute) Language.

This attribute "language" is binded to "selectedKey" of the drop down by key

Sai Krishna.

Former Member
0 Kudos

Sai,

For RFC, you can simply use drop-down by index, you dont need to write a single line of code, attach your language attribute it DDBIndex, you can solve it.

/Raj.

lajitha_menon
Contributor
0 Kudos

Hi Sai Krishna,

Change the cardinality of dropdown node to 1..1 and that should make the language dropdown editable. I presume it is not 1:1 at the moment.

Regards,

LM

konchada_saikrishna
Active Participant
0 Kudos

Hi Raj,

If we use drop down by index can we find out the selected value, if so the problem is very much reduced.

Because, my requirement is, I should display a table with 7 columns where 3 columns are drop downs, when user fills some rows, these rows are to be stored back in R/3.

Thanks & Regards.

Sai Krishna.

konchada_saikrishna
Active Participant
0 Kudos

Hi L.M,

The crdinality is 1:1 but did'nt work,

Can you help me, in displaying a table with 5 rows, where user is allowed to enter values into these rows. finally these values are to be stored in R/3.

Thanks in advance,

With regards,

Sai Krishna. K

Message was edited by: Konchada Sai Krishna

lajitha_menon
Contributor
0 Kudos

Hi there,

If I understand the requirement correctly, you need dropdowns in your table rows, with each row showing different values for the dropdown - correct?

If yes, you can use only dropdown by index for this purpose - not dropdownbykey,

regards,

LM

Former Member
0 Kudos

hi

You are facing good problem,now do this thing:

In component controller :

1)Make an instance of your BapiNode

2)Make an AbstractList of the parameter you are passing into R/3,for eg,if your paramter is input then do this:

AbstractList list = <structureofyourparameter>.<structureofyourparameter_List>();

now create instance of your structure:

table = new <structureofyourparameter>();

3)Now bind this table to your node like this:

wdContext.node<Bapiinputnode>.node<parameternode>.bind(table);

4)<Instance of your Bapi node>.set<parameter>(list);

in executebapi method:

list.add(table);

wdContext.node<BapiNode>.current<Bapiinputelement>.modelobject.set<parameter(List);

Now execute your bapi.

If your problem is not solved send me strucutre of your Bapi node and structure of your input paramter.

Regards

Nidhideep