dynamic time selection for background jobs thanks to variant selection variable

dynamic time selection for background jobs thanks to variant selection variable
4 (80%) 1 vote

When you are dealing with date and time dependent data , dynamic date and time selection method should be very handy. Besides many times you need selection of records according to current date and time. For instance i had a requirement to get the latest 3 hours records from a database table and accordingly i was processing these records.
For this requirement i put a select-options time variable to selection screen and i filled this variable in initialization part of my report. For low part of select-options i used system time minus 3 hours and for high part of select-options i used system time.

Then i realized that this structure of report become very static as i wanted to schedule my report as background job. Now i will tell why this structure is not dynamic.
While scheduling a report as background job you have 2 options either you can create a variant and schedule your report with your custom variant or you can schedule you job without a variant. For my case scheduling without a variant means i also initiate all other selection screen parameters and select-options from the report like i did for time variable and this means a very static report.
Afterwards i had focused on using dynamic variant usage for date and time variables. Using this feature things become simpler as it you can create dynamic variants. The only weak side for this feature is you can not set dynamic variable for low and high part of select-options .

I did a workaround for this problem. Instead of using select-options for time selection i had defined two parameters one is for beginning time(low) and one is for end time(high). And then i have created dynamic variant for each parameter.Below figures show how to create this dynamic variable.


You may also like