If you need to use variant values as the default values in your selection screen, then you can achieve this by using the “RS_SUPPORT_SELECTIONS” function module.
All you need to do is supply the variant name and it will display the value automatically during the INITIALIZATION event.
Here’s the ABAP SAMPLE CODE.
01.INITIALIZATION.02. 03. data: tp_subrc like sy-subrc.04. data: tp_repid like rsvar-report.05. data: tp_variant like rsvar-variant.06. 07. tp_repid = sy-repid.08. clear tp_variant.09. tp_variant = 'Your Variant Name'.10. 11. "Check if the variant is exist.12. 13. call function 'RS_VARIANT_EXISTS'14. exporting15. report = tp_repid16. variant = tp_variant17. importing18. r_c = tp_subrc19. exceptions20. others = 9.21. 22. if sy-subrc = 0.23. 24. call function 'RS_SUPPORT_SELECTIONS'25. exporting26. report = tp_repid27. variant = tp_variant28. exceptions29. variant_not_existent = 0130. variant_obsolete = 02.31. 32. endif.Once you run the report program (F8) you will see the selection screen are populated by the variant values.
No comments:
Post a Comment