The key that you assign to the structure must fulfill the following conditions:
● It identifies the application in which the ALV output is displayed.
You can use the field USAGE_PATH from S_PARAM_OUT for this purpose, for example.
● It identifies the ALV output within the application.
If multiple ALV outputs are displayed in the application, you must be able to distinguish them from one another. To do this, you can use the field ALV_COMPONENT_USAGE, for example, which returns the component usage for the individual ALV outputs.
● It identifies the structure that is displayed in the ALV output with SET_DATA .
To do this you can use any unique character string.
If you connect three components to one another, you generate a key that identifies a structure sufficiently. In this way, a view can be assigned uniquely.
The following example shows the steps in a method SET_ALV_CONFIG_ID that are required for generating and assigning the configuration key.
method SET_ALV_CONFIG_ID.
[ ... ]
data:
l_ref_if_controller
type ref to iwci_salv_wd_table,
lr_node
type ref to if_wd_context_node,
own_key
type string.
*... Get RELEVANT NODE of the APPLICATION CONTEXT
lr_node =
WD_THIS->APPL_get_data_node( ).
*... Determine name for KEy dependING on THE APPLICATION CONTEXT
OWN_KEY = ‘ALV1’.
*... SET NODE of THE APPLICATION CONTEXT
l_ref_if_controller->set_data(
r_node_data = lr_node ).
[ ... ]
*... create configuration key consisting of
* usage path,
component usage, own key
data:
ls_param_out type
if_salv_wd_table=>s_type_param_config_out,
ls_param_in type
if_salv_wd_table=>s_type_param_config_in,
l_key type
string,
l_key_32 type string.
ls_param_in-action =
if_salv_wd_table=>key.
ls_param_out =
l_ref_if_controller->get_config_data( ls_param_in ).
concatenate
ls_param_out-usage_path
ls_param_out-alv_component_usage
own_key
into
l_key
separated by '&'.
*... Hash configuration key to unique key of 32 chars length
try.
l_key_32 =
cl_rsmds_hash_utilities=>to_hash_c32( l_key ).
catch
cx_rsmds_input_invalid cx_rsmds_input_invalid_type.
endtry.
[ ... ]
*... set new configuration key
ls_param_in-action
= if_salv_wd_table=>set.
ls_param_in-config_key-config_type = '08'.
ls_param_in-config_key-config_id = l_key_32.
l_ref_if_controller
->get_config_data( ls_param_in ).