Standard ABAP reports provide several facilities for dynamic programming. In this entry I’ll cover mostly dynamic select options and selection screen display control.The end result will be a SE16 clone based on the class described in a Yet another webdynpro (ABAP) se16 clone. As usual the full source code is available in my google code page as saplink packages.
Since the core logic is handled by the above mentioned class, most of this is related to the select-options handling.Most of the actual code is in a local class zse16_urb; the only real advantage of this over a series of subroutines is to keep the report cleaner (fewer global data).
h2. *Dynamic select-options – how they work *
As you can see from sap’s help, these are pretty straightforward:
data c000 like tabfield-lfieldname.
select-options:so000 for (c000).
so000 will be defined as a range for a character field of length 45, but after putting the name of a DDIC defined field in C000 (i.e. SFLIGHT-CARRID) it’ll look as a select option for that field, complete with field description and search help.
This syntax doesn’t allow creation or deletion of select-options, so it forces us to declare every select option and every fieldname variable we might want to use.
IObjects of class zcl_se16_core (described in an Yet another webdynpro (ABAP) se16 clone) have two public attributes to provide the field lists described above: userfields and mainfields.These are filled when the object is created. suffix = screen-name4(3).<br /> endif.<br /> if screen-name(2) = ‘SO’.<br /> suffix = screen-name2(3).