
To provide the data that you want to display in the ALV display, you must connect the context node of your application (the one that contains the data for the table output) with the DATA context node of the ALV component. This takes place using External Context Mapping .
In the context of the ALV component, context node DATA only contains a reference to the corresponding context node of your application. This in turn is a reference to the internal data table.
By default, the ALV component works with your reference to the data. Filters, calculations, and other standard ALV functions are executed on the data by various mechanisms, and the changed ALV display is then shown on the screen.
Important Exception: Sorting
Here ALV has to use the entire dataset so that the data records can be arranged in the new order. For this purpose, the ALV component temporarily takes control of the internal data table and invalidates the corresponding context node of your application during this time . This ensures that the application cannot access the context node while the ALV component is editing the internal data table.
Once the internal data table has been resorted, ALV rebuilds the context node, releases it again for the application, and displays the data accordingly.
This ensures that the internal data table is never copied. This is important because large volumes of data would considerably impact performance and memory space.
When you are planning your application, note the following side-effects of this mechanism:
When the context node is invalidated, information about current selections, and in particular the lead selection, is lost.
If your application has created subnodes for the context node (master-detail scenario), these subnodes are lost as soon as the ALV component invalidates the context node. If the application then tries to access the subnodes, a runtime error occurs.
The context node that contains the data for the ALV must be constructed as follows:
It has the cardinality 0..n .
It only contains attributes and no subnodes: For each column of your internal data table, you create exactly one attribute of the same name and data type.
All the attributes are static, not dynamic.
The data of the internal data table (which is connected to this context node) must also exist in flat structures. The easiest way to do this is to use an existing DDIC structure.
In Web Dynpro Explorer open
As you may have defined a particular component usage for several different ALV components, you must specify the exact ALV component usage that the data for your context node contains for context mapping.
Click on controller usage, select your Component Controller, and confirm.
Select the context node
DATA of the INTERFACECONTROLLERs, open the context menu, and choose
Defining External Mapping . Select the required context node of your Component Controller. The context node DATA is now displayed with a small arrow that symbolizes the mapping.
SET_DATA Method
Another options to transferring data to the ALV component is the SET_DATA method (reference type IF_WD_CONTEXT_NODE ). In this way you can specify another structure for your ALV display at a later time. You specify the correct context node of your application as a parameter.
The method SET_DATA always deletes any ALV Configuration Model that may exist. If you want to configure the ALV output, you must Retrieve the ALV Configuration Model again once the SET_DATA method has been run.