Automatic variants in reports
2011-10-17
When developing a report with a selection screen it is very annoying that every time we test it we have to input the test data to the selection screen. We usually end up creating a variant of the test to save us from this hassle. But, every time we run the report we still have to manually call this variant.
Here is a simple way to automatically call a variant. This code can be inserted into the INITIALIZATION event during the development of the program:
INITIALIZATION.
CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
EXPORTING
report = sy-repid
variant = 'TESTE'
EXCEPTIONS
VARIANT_NOT_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
Thank you Sérgio Fraga for the tip.
(And thank you to Telstar Logistics for the photo)
Greetings from Abapinho.