Show TOC Entering content frame

Background documentation Providing the Data Locate the document in its SAP Library structure

To provide the data you want to display in the ALV output, perform the following three steps:

·        Internal data table

You provide an internal data table.

·        Context node

You provide a suitable context node and attributes in the context of your application.

·        Transfer data to the ALV component

You provide this context node for the ALV component.

Internal Data Table

The data from the internal data table must be available in flat structures. This is the only prerequisite. The easiest way to do this is to use an existing DDIC structure.

Context Node

The ALV component requires a context node that can contain the data for the internal data table. This context node has the following properties:

·        It has the cardinality 0..n.

·        It only contains attributes and no subnodes. You generate an attribute for every column of your internal data table (with the same name and data type).

If the internal data table is based on a DDIC structure, the easiest way to generate the attributes of the context node is to use a DDIC structure.

To transfer the data of the internal data table into the application context node, connect the data table to this node. To do this, use the method BIND_TABLE, for example, in the SUPPLY method of your controller.

Transferring Data to the ALV Component

In the previous step, you created the entire structure of the ALV output in the context node. Now you must transfer this to the ALV component. You can do this in the following ways:

·        By means of Structure linkexternal context mapping

·        Using the method SET_DATA

Note 

As you may have defined a particular component usage for several different components (or different ALV components), you must specify the exact ALV component usage that the data for your context node contains for context mapping.

External Context Mapping

The ALV component contains a separate context node known as DATA that must contain the structure and data of the ALV output to be able to display the required output. The easiest way to transfer the data to the DATA context node is to use Structure linkexternal context mapping.

SET_DATA Method

You can transfer the data of your context node to the ALV component as well by using the SET_DATA method (reference type IF_WD_CONTEXT_NODE). You can do this, for example, in the WDDOINIT method. For more information, see SET_DATA. You specify the correct context node of your application as a parameter.

Note

You also use the method SET_DATA if you want to specify another structure for your ALV output at a later date or time.  In this case, however, you cannot use the method in the WDDOINIT method or another standard method. If the ALV output has already been displayed once, you can only define the data for the ALV component in an event handler.

Note

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.

 

Leaving content frame