‎2014 May 02 2:22 AM
Hi All,
I have a requirement in which i need to create a table control ( with 3 columns eg:employee ,age,name).
I need to create a drop down list for employee where user can choose multiple employee for a row in table control.
I was trying to achieve it using listbox but as listbox can only contain one value in field.
is there any soln for that?
Please let me know....
thanks in advance
Regards
Neha
‎2014 May 05 12:34 AM
Hi Neha,
you can't use a listbox like that.
We have a developed program with several fields of multiple values, called by search help (F4) or a button. We achieved it by creating a function module with a popup screen that presents a table control with two columns, key and description. User can select whatever lines he wanted.
If user only selects one line the original text field or table cell is filled with that value. If more than one value is selected the field is closed for input and an asterisk is written on the field.
It can be done also with an ALV.
regards,
Edgar
‎2014 May 02 3:49 AM
Hello Neha.
My suggestion is to create two table controls: one for employees and another for other data.
By this way, you can choose multiple employees and perform the desired business logic.
Regards.
‎2014 May 04 11:39 PM
Hi Arun,
Thanks for your reply but this is an enhancement in a screen where i need to add one more column and that column (field) may contain mutiple values.
Thanks
‎2014 May 05 12:34 AM
Hi Neha,
you can't use a listbox like that.
We have a developed program with several fields of multiple values, called by search help (F4) or a button. We achieved it by creating a function module with a popup screen that presents a table control with two columns, key and description. User can select whatever lines he wanted.
If user only selects one line the original text field or table cell is filled with that value. If more than one value is selected the field is closed for input and an asterisk is written on the field.
It can be done also with an ALV.
regards,
Edgar
‎2014 May 05 12:38 AM
Hi Edger,
Can you please share your code or guide me how can i achive that.
Regards
Neha
‎2014 May 05 1:09 AM
We have the original screen element that can be stored in something like this:
types: begin of t_sel,
selected, "this is were we keep the keys that are selected at a given moment
key(40),
text(60),
end of t_sel.
data: begin of l_var,
text(40),
selections type t_sel occurs 0,
end of l_var.
at search-help event the search function is called with the t_sel part, like:
call function 'Z_SEARCH_MULTIPLE'
changing c_text = l_var-text
tables
ct_selections = l_var-selections.
this function would then call popup:
CALL SCREEN '0900' starting at......
this popup would present a table control were selection column would be "ct_selections[]-selected" and "key" and "text" as columns . At ok_code='OK' we would:
LEAVE TO SCREEN 0.
This would terminate screen processing and return to function were we'd count selected lines:
describe table ct_selections lines l_count.
if l_count = 1.
read table ct_selections with key selected = 'X'.
c_text = ct_selections-key.
elseif l_count = 0.
clear c_text.
else.
c_text = '*'.
endif.
That's about it! Let me know if I can be of more assistance.
regards,
Edgar
‎2014 May 07 11:31 PM
Hi Edgar,
As per your code if user choose multiple values field is closed for input and an asterisk is written on the field.
but if user want to change those values how can we achive that.
Regards
Neha
‎2014 May 07 11:42 PM