Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 


Most WebDynpro ALV tutorials show you step by step how to import and setup an ALV component into your project. Add the ALV component to the list of used component in the COMPONENTCONTROLLER properties and add this usage to the display View.


Embed the TABLE View from the ALV component usage into your display View.



And then setup the data to be used by binding a node from the component context to the DATA node in the ALV component  INTERFACECONTROLLER.


Admittedly, this is probably the simplest, most direct way of introducing this process; statically defining the binding of the data node. And, not having conducted a poll myself, I would venture to say that for most implementations this is sufficient.

But there is always that one time, that one time where you need to be able to assign and/or reassign that binding at run time. That one time when it is not known at design time which node will be displayed. It may be dependent on user input or data selection or whatever. The point is that you need to dynamically bind a data node to the ALV.

Well, fear not, here’s how it’s done.

In a recent project I needed to display the same set of data at different granularity based on the user’s selection. There are two buttons for the user to choose: one displaying the data as a summary and the other combining it with more detailed line item type data for a more denormalized view. In any case, here’s how I approached it.

First, skip the last step above where the binding is done.


In the VIEW where the ALV is displayed I created a method called SET_DATA_MAPPING. This method takes in a parameter of type IF_WD_ACTION and gets called from the WDDOBEFOREACTION hook method which supplies the value for the ACTION that was triggered thru a reference to the view controller.


Based on the value of the action, I get the child node from the context that represents the data to be displayed. Then, get a reference to the ALV INTERFACECONTROLLER and using its SET_DATA method pass the value of the context node and the binding is done.


This should be enough to now go ahead and setup the properties and display your ALV. There are also methods that handle refreshing the view after, for example, adding or removing records, but we'll tackle does in a different post.

Good luck!

Labels in this area