<< previous | next >>
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.
Let’s wrap this series up – we’re getting close. Below is the flow of the Save operation. When the user clicks the button, the BTN_SAVE_CLICK event is fired:
The PROMPT_TO_SAVE method then displays the W_SAVE_VARIANT window and waits for the [OK] button.
The neat thing about this selection screen variant implementation is that it offers the user the ability to save dynamic date parameters. The W_SAVE_VARIANT window uses ALV (usage 2) to display a list of fields for this purpose. We’ll go into more detail on that in the next post. For now, let’s focus on saving the variant.
The view V_SAVE_VARIANT shows the variant name and description. Also available is the ability to “lock” the variant for use only by a single user id. Finally the list of fields from all attached selection screens.
Again, the view has an INIT_ALV routine to set up ALV2. It is called from the WDDOINIT method. Here’s a better look at the “clear messages” mentioned back in the Get Variant section:
After the variant name and description are entered, the user presses the [OK] button. Once pressed, the MAIN view SAVE_OK action is fired. In the ONACTIONSAVE_OK routine, we need to check for validity and existence and react accordingly.
The PROMPT_OVERWRITE routine uses a popup window for user confirmation.
After a valid variant name has been identified, the component controller’s SAVE_VARIANT routine does the real work. First, we update a few header fields: program, variant, change date, etc. Then we get the field values in GET_FIELDS. Finally, we save it to storage with the EXPORT TO DATABASE statement.
The GET_FIELDS routine has the job of retrieving all field values from all attached selection screens.
The last couple routines that get called are:
- REFRESH_VARIANT_LIST – so that the Get Variant screen is up-to-date.
- (Optionally) FIRE_AFTER_SAVE_EVT – to let the calling application know that a variant has just been saved.
That’s all there is to saving a selection screen variant in Web Dynpro!
<< previous | next >>