cancel
Showing results for 
Search instead for 
Did you mean: 

Bapi in a Drop down list

pranav_nagpal2
Contributor
0 Kudos

Hi Experts,

I want to include a bapi from R/3 into a drop down list in JAVA NWDS project. For example

Bapi is say Bapi_flight_get_list. I want that airline id(like AA, LH etc.) should come in drop down list which user can select.

Thank you in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Pranav,

You may have resolved your issue, but i was jst trying to help.

U need to execute the bapi first and then u need to bind the context to the drop down list.

For that u need to write ur code in init.

Code for executing the bapi:

IWDMessageManager manager = wdComponentAPI.getMessageManager();
    try
    {
      wdContext.current<model node name>Element().modelObject().execute();
      wdContext.node<node name in which data gets populated>().invalidate();
    }
    catch(WDDynamicRFCExecuteException e)
    {
      manager.reportException(e.getMessage(), false);
    }

Now the data gets populated in your node and u need to do the following to populate ur data into a dropdown.

1. take drop down by key UI element.

2. create a value attribute in the context with any name(ex: airlineid ).

3.bind that value node to your UI element.

4. write the following code in init() after executing bapi.

try{
ISimpleTypeModifiable dd = wdThis.wdGetAPI().getContext().getModifiableTypeOf("airlineid");

IModifiableSimpleValueSet values = dd.getSVServices().getModifiableSimpleValueSet();

values.put(<value from the model node>,<value from the model node>); 	 	    
  
			 }catch(Exception e){wdComponentAPI.getMessageManager().reportSuccess(e.toString());}