cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI - DropdownByKey

Former Member
0 Kudos

Hi Experts,

I have a 2 column(no,text)in a table in bapi like

01 - one

02 - two

03- three

.. ...

.. ...

in my Webdynpro Screen i have DropdownbyKey based on no i can display the text. for eg: If i select two it indicatiing no 2

for current selected value (wdContext.current<node>element.getno)

How to do that?

Regards,

Manivannan P

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Follow this procedure,

Create a parameter of type string to onSelect action, lets say "key"

Go to the outline view

select the drop down by key right click and select parameter mapping.

from the right side drag the "key" previously created to the left side "key"

access this parameter from code this will return you the selected key.

Ex your method signature will look as follows

public void onActionTest(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String key )
  {
    //@@begin onActionTt(ServerEvent)
           
        wdComponentAPI.getMessageManager().reportSuccess(key);
 
    //@@end
  }

Regards,

Sunaina Reddy T

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

instead of the DropDownBykey you can use the DropBownByIndex UI element.

fthis element has the property "texts" just bind this with the attribute of the rfc.

Regards,

Ramesh Babu.v

Former Member
0 Kudos

closed

Former Member
0 Kudos

Hi,

instead of the DropDownBykey you can use the DropBownByIndex UI element.

fthis element has the property "texts" just bind this with the attribute of the rfc.

Regards,

Ramesh Babu.v

susmita_panigrahi
Active Participant
0 Kudos

Hi

You can try the below code insie the method which is assigned to on Select property of drop down:

int noSelected = wdContext.nodeXYZ().getLeadSelection();//XYZ is the node name to which dropdown is mapped

String text = wdContext.nodeXYZ().getXYZElementAt(noSelected).getText();//Text the attribute of drop down

Thanks

Susmita

Former Member
0 Kudos

Hi,

IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateMain.IContextElement.text);

ISimpleTypeModifiable textType = attributeInfo.getModifiableSimpleType();

// Set field label and populate valueset

textType.setFieldLabel("text");

IModifiableSimpleValueSet valueSet =

textType.getSVServices().getModifiableSimpleValueSet();

for (int i = 0; i < 40; i++){

valueSet.put("Key_"i,"text "i);

}

// initialize context value attribute 'text'

wdContext.currentContextElement().settext("Key_0");

refer the following link

http://help.sap.com/saphelp_nw04/helpdata/en/b3/f68e4ab25d7549888eb612bcb359f1/content.htm

and there was another thread posted in sdn for the similar question

Regards

Manohar