Skip to Content
avatar image
Former Member

onLeadSelect Event:: IWDTable: read row data

Hi,

I have a dynpro page with a IWDTable, that lists the flights from the BAPI_FLIGHT_GETLIST BAPI .

Now I would like to display some details of a special

flight, that I select from the IWDTable. I created a

onLeadSelect Event to indicate on which flight I'd like

to get more information.

In the corresponding method of the View class

there is the onLeadSelect event handling method

public void onActionSelected (com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent)

{

...

}

To get flight details I use another BAPI: BAPI_FLIGHT_GETDETAIL. This BAPI needs three input parameters: 1. Airlineid 2. Connectid 3. Flightdate

All these parameters are displayed in the IWDTable.

Now I need to extract these parameter values from the selected row of the table to get the flight details from the BAPI_FLIGHT_GETDETAIL BAPI.

I already tried the

IWDCustomEvent.getString("<parameter>"); with "Airlineid", "Connectid", "Flightdate" for <parameter>. These three values correspond with the column identifiers of the IWDTable. I always get null values when I use the IWDCustomEvent.getString() Method.

What I have to do retrieve the parameter values of the selected table row?

In Swing for example there is a special event handler with a method "rowSelected(XYEvent event)". With the

XYEvent it is simple to get the selected row data.

Did somebody do this already?

Greets Simon

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 20, 2004 at 09:52 AM

    Hi Simon,

    the context model node which is bound to the dataSource property of the table has the current lead selection already. One possibility to get this lead selected element in a view is

    int leadSelection = wdContext.node<Model>.getLeadSelection();
    if (leadSelection != IWDNode.NO_SELECTION) {
      IPrivate<ViewName>.I<Model>Element el = wdContext.node<Model>.get<Model>ElementAt(leadSelection);
      // Do something with the element... 
    }

    Insert this into the action handler method and exchange the <Model> placeholders by the name of the dataSource node.

    Hope that helps.

    Regards

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Simon,

      it is not necessary to use the generic getters to access the attribute values of the node element. Assume you have a node named "Flight" with the attribute "AirlineID" type string, then, according to Armin's proposal getting the current node element (thx Armin), you can simply do:

      String airlineID = wdContext.currentFlightElement().getAirlineID();

      This is much more convenient, isn't it?

      Regards

      Stefan

  • avatar image
    Former Member
    Aug 20, 2004 at 10:04 AM

    Let X be the view context node used as the table's data source.

    After selection of a new table row, the lead selection of node X is changed to the new row index and you can get the value of attribute Y by

    wdContext.currentXElement().getY()
    

    (In many cases, master-detail-views can be implemented completely using data binding without need for event handlers.)

    Armin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Armin,

      Thank you for your reply. The context, or more precisely,

      the special node of the context is updated or initialized

      by the WebDynpro Framework when the event has been fired.

      Simon