Get value of parameter dynamic
I've got a serious problem and I hope somebody of you can help me.
I have defined several parameters as a listbox:
parameters p_group1 type c length 30 as listbox visible length 30 modif id g_1 lower case. parameters p_group2 type c length 30 as listbox visible length 30 modif id g_2 lower case. ...
First of all here's the question I have, others, which are more interested in the type of problem can read on:
How can I get the <b>value</b> of a <b>parameter</b>, if I have it's <b>name</b> stored in a string?
I thought something about using cl_abap_typedescr=>describe_by_name but I didn't figure out how I get the value as type string.
So, here's the context:
I want to implement a dynamic grouping selection where you can choose a column to group by in the first parameter, then press a button ("+") and the next parameter (which was hidden until now) appears and you can select another column to group by and so on. You can also delete groupings again (that means hide the listbox).
I have already succeeded in that and all works, but I don't like my code, because it's hard to enhance as it isn't dynamic enought (I often use the references p_group1, p_group2 and so on in my code - like if lv_number_of_listboxes = 2 ... show p_group2). So now, as I have a bit of time I want to make a framework as I really often need that and this framework should be as easy to enhance as possible, and that means dynamic programming.
Thanks in advance,
Regarding getting the value of the parameter what u can do is:
FIELD-SYMBOLS : <fs>.
data str type string value 'parameter1'.
assign (str) to <fs>.
write : <fs>.