The concept of a selection screen variant is something that most SAP users have come to expect, yet this feature is unavailable in standard Web Dynpro. Below is the next in a series of posts detailing how to bring this necessary feature back to Web Dynpro. Start here to see the full requirements.
Some might say that the most beneficial feature of the selection screen variant in classic ABAP programs is the dynamic date functionality.
This has been emulated in the Web Dynpro implementation. For this we need to go back to the V_SAVE_VARIANT view. It starts with an enhancement made to the INIT_ALV routine. The field VTYPE is being replaced with a [Date] button.
Next the ALV_ON_CELL_ACTION is used to catch the button press.
In the case of the ‘VTYPE’ column, a new window W_ASK_PARAMETERS is presented to the user. The data for the dynamic date selection is retrieved from the field’s static attributes and placed into the node FIELD_PARAMS for temporary use by the V_ASK_PARAMETERS view.
This view contains the same fields available in the classic dynpro version of dynamic dates. When the view loads, the WDDOINIT routine calls INIT_DYNAMIC_CONTEXT to load the values for the Dynamic date type drop-down list from wd_assist->mt_varivar table.
The drop-down list is attached to an action DYN_DATE_ON_SELECT. This action calls the REFRESH_PARAM_FIELDS to identify which fields to enable based on the selected dynamic date type.
When the [OK] button is pressed, the ASK_OK action is used to generate a human-readable text string that represents the dynamic date selection (call method REPLACE_VARIVAR_TEXT). Then values are stored back into the field’s static attributes.
The static attributes travel along with the rest of the save operation described in the previous post. Then in the component controller’s GET_FIELDS routine, each field is reviewed as the result table is generated. Another routine in the component controller – GET_FIELD_PARAMS – takes the task of retrieving the static attributes for each field and assigning the dynamic date values to the fields in the ZES_VUVVALUES structure.
This allows the user to specify what dynamic date function to use and and additional offset parameters. But how and where does this get used when the variant is used?
When the user selects a variant, the component controller’s LOAD_VARIANT routine is executed. It calls SET_FIELDS to read the variant data and put the values into the attached selection screens. One more routine - SET_FIELD_PARAMS - is called for each field to call the selected dynamic date function to interpret the resulting date.
In the next post, we’ll close the series by showing how this Web Dynpro component can be used in your own application.