I have a selection screen field called SP$00005 which is not known until runtime as the field is selected in Adhoc Query (SAP Query) by the user.
In the customer exit I am attempting to write code to default in a range to this field - it is a date field and I want to enter the range 01.04.2007 - 30.04.2007.
As select-options require the appending of the screen field table SP$00005 I need a way of adding an entry to this table.
Please see my latest attempt below which appends the correct value to the field symbol <startdate> but this entry does not appear in the internal table SP$00005 when stepping through at runtime.
Can anyone suggest a possible solution?
data: ref_field(8) type c.
field-symbols: <startdate> type table. "table = STANDARD by default
types: begin of sp$00005, "type definition required for syntax check
low type d,
high type d,
end of sp$00005.
data: lt_ref type ref to data.
ranges: selection for sy-datum.
ref_field = 'SP$00005'.
create data lt_ref type table of (ref_field).
assign lt_ref->* to <startdate>.
assign (ref_field) to <startdate>. "- raises type error
move 'I' to selection-sign.
move 'BT' to selection-option.
move '20070401' to selection-low.
move '20070430' to selection-high.
append selection to <startdate>.