Purpose
If you want to use an ALV output in your application, you have to follow various steps, depending on the required result. The following variants outline the most important ways in which you can call ALV:
● Simple call without ALV configuration model
You only display an ALV output. You do not want to make any changes.
● Simple call with ALV configuration model
You want to change the standard output using your application. To do this, you require the ALV configuration model.
● ALV output in external view without ALV configuration model
ALV output is just one of many elements in a view. You do not want to change the ALV output. You do not need the ALV configuration model.
● ALV output in external view with ALV configuration model
ALV output is just one of many elements in a view. You want to change the standard output using your application. To do this, you require the ALV configuration model.
Most of the steps listed below are the same as those you follow with the Web Dynpro components. Some of them, however, are tailored specifically for use with ALV.
Prerequisites
You must proceed as follows (ALV-independent) for all the variants listed above:
● You generate a Web Dynpro component for your application and save it as active.
● You generate a context node with the cardinality 0..n. The structure of the attributes in this context node (name and data type) and the structure of the internal data table that you connect to this context node in the next step are the same.
● You connect your internal data table to the context node (for example, using the supply method). To do this, you use method BIND_TABLE from interface IF_WD_CONTEXT_NODE.
Process Flow
Simple Call Without ALV Configuration Model
...
1. You define a component usage for the ALV component SALV_WD_TABLE in your application component. In doing so, you specify a name for the component usage (for example, MY_ALV).
2. Using external context mapping, you provide the DATA context node in the ALV interface controller with your application data.
3. You embed the TABLE view of ALV component SALV_WD_TABLE into a window of your component.
Simple Call with ALV Configuration Model
...
1. You define a component usage for ALV component SALV_WD_TABLE in your application component. In doing so, you specify a name for the component usage (for example, MY_ALV).
You also define this component usage in your component controller. Since you need the ALV configuration model for your changes, select the With Controller Access variant (component interface).
2. You embed the TABLE view of ALV component SALV_WD_TABLE into a window of your component.
3. Using external context mapping, you provide the DATA context node in the ALV interface controller with your application data.
4. To configure the ALV output, you must follow two additional steps:
○ You instantiate the used ALV component in a method of the component controller (for example, WDDOINIT).
○ You receive the ALV configuration model and with it the object model, field objects, and column objects.
You can find a description of all the classes and methods of the ALV configuration model in the system in package SALV_WD_CONFIG.
ALV Output in External View Without ALV Configuration Model
...
...
1. You decide whether you require the context node in the component controller or in the view context of your application view. If necessary, you generate an appropriate context node in your view and map the context node from the component controller to it.
2. In your application component, you define a component usage for ALV component SALV_WD_TABLE. In doing so, you specify a name for the component usage (for example, MY_ALV).
You also define the usage of this component in the properties for your view. Since you do not need the ALV configuration model, choose the Without Controller Access variant (no component interface).
3. Using external context mapping, you provide the DATA context node in the ALV interface controller with your application data.
4. You generate the UI element ViewContainerUIElement at the required position in the layout of your view.
5. You have already embedded your view in the window of your application. The name of the UI element ViewContainerUIElement that you prepared in the previous step for the ALV output is displayed beneath this view. Under this entry, you then embed the TABLE view for the SALV_WD_TABLE ALV component.
ALV Output in External View with ALV Configuration Model
...
...
1. You decide whether you require the context node in the component controller or in the view context of your application view. If necessary, you generate an appropriate context node in your view and map the context node from the component controller to it.
2. In your application component, you define a component usage for ALV component SALV_WD_TABLE. In doing so, you specify a name for the component usage (for example, MY_ALV).
You also define the usage of this component in the properties for your view. Since you need the object model for your changes, choose the With Controller Access variant (component interface).
3. Using external context mapping, you provide the DATA context node in the ALV interface controller with your application data.
4. You generate the UI element ViewContainerUIElement at the required position in the layout of your view.
5. You have already embedded your view in the window of your application. The name of the UI element ViewContainerUIElement that you prepared in the previous step for the ALV output is displayed beneath this view. Under this entry, you then embed the TABLE view for the SALV_WD_TABLE ALV component.
6. To configure the ALV output, you must follow two additional steps:
○ You instantiate the used ALV component in a method of your view (for example, WDDOINIT).
○ You receive the ALV configuration model and with it the object model, field objects, and column objects.
You can find a description of all the classes and methods of the ALV configuration model in the system in package SALV_WD_CONFIG.