Messy code replaced by Config Step
Anybody who has developed applications using SAP WD ALV component SALV_WD_TABLE, know’s how many lines of code is required to configure ALV to specific requirements. There’s getting instance of ALV model and then calling all sort of API methods to fine tune standard ALV like- sequence the columns, hide, rename the column header, set lead selection behaviors, set column width, editable ALV or not, set cell editors and many more. For complex scenarios – set cell variant, map column properties with other field value(from context).
Now think of a solution which provides an ALV configurator which can be used to do all the above configurations so that developer doesn’t have to write that boilerplate code. The whole functionality is delegated to an external application. Your ALV instance automatically adjusts itself to the values set in the configurator.
Let’s say during UAT phase of your project – user wants to re-sequence the columns and also update column headings – you just have to make changes in the configurator. This can be done by functional consultant on the project – no developer involved – no source code change.
The architecture of this solution supports abstracting the common ALV functions like – showing record count, custom excel export, etc so that they can be easily provisioned.
Here’s the overview diagram of the solution.
- Add ALV Usage to the business application
- Add ZALV Usage for every ALV usage in the application
- Execute the application once to update Z tables with original config values
- Run the ZALV configurator app to override the original config values with wrapper values
- Transport business application components and wrapper records to UT/IT/PD
- Almost all the ALV config properties mapped
- Supports all ALV column properties
- Supports screen resolution based adaptation ( details in next point )
- Supports config variants that can be selected based on qualifiers – eg – role name, screen size etc. So columns shown to ROLE_A can be different from ROLE_B. Similarly, more columns can be shown for higher resolution display.
- Supports overriding wrapper config value by run time value. Eg – retain the dynamic control of column visibility
- Custom ALV functions (ALV Buttons) can be built in ZALV component and provisioned to consumer apps
- ‘Record Count’, ‘Full Screen’ and ‘Custom Export’ functions are currently available
- Non-invasive: Original component and its ALV config code is untouched
- Fallback: Just remove ZALV usage for easy fallback
- Configurator lists the applications which uses ZALV with easy search mechanism.
- Drop Down selectors used for the properties. Value descriptions used instead of internal values.
- Property names are same as the one used in code for easy reference
- Z Tables
- Separate tables used for config, columns and functions.
- CONFIG_SOURCE field is used to easily identify source of config record
- CONFIG_SOURCE = 01 : Original Config
- CONFIG_SOURCE = 02 : Wrapper Config
With all said – the implementation is of proto-type (beta) quality and not any where near to production quality. I am making this open source on GITHUB so as to involve WD ABAP community to contribute, provide feedback/suggestions and use freely.
Please raise github issues on the repository for better tracking.
You can find more details in the github repository.