‎2008 Apr 05 6:54 AM
Hello Gurus ,
Hw to make the drop down box in table control , plz send me some code for that .
I m waiting for that , its an urjent .
with regards ,
Joy Chakravorty .
‎2008 Apr 05 8:17 AM
Hello Joy,
Try this out,
Once you have your fields in the Table control screen painter...double click on the field you need to change as drop down box...a pop up comes and there is a field called "DropDown" -> select -> Listbox with key
After that assign a function code to it.....XXXX
if you need to fill the values in list box there are mutliple ways
(1) Fixed values in domain(static method)
If this field has fixed values in the domain created and you have defined the field used in the table control using a data element of this domain..fields will automatically come
For this in the domain we are using..click on the "field values"
tab and fill the value and the text associated with it
(2) Dynamic values are used
if you are not using the static method and not filling anything in domain and need values from a specific table on a specific criteria
in the PBO write the code as follows
TYPE-POOLS vrm.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
name = name of the field on the screen of table control
eg: ZFIELD
name = ZFIELD.
do your select query and fill the internal table with the fields we want....
SELECT ZFIELD
FROM spfli
INTO CORRESPONDING FIELDS OF table int_spfli
WHERE carrid = demof4help-carrier2. *do your filter here
fill the key field of the list box from the internal table
if you append only the fields will be seen on screen in drop down
loop at int_spfli into wa_spfli.
value-key = wa_spfli-ZFIELD.
APPEND value TO list.
endloop.
this displays value on the screen
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list.
IN PAI..
Case sy-ucomm.
When 'XXXX'.
The field on the screen / name of the field on the screen of table control will contain what the user has selected and you can do validation of further processing accordingly,,,
endcase.
The solution suggested works fine..as long as the field you are selecting is a key field..if it is a non-key field..please do the statement
Sort the internal table
Delete adjacent duplicates from internal table
comparing the field you are displaying on the screen
Pls check and revert
Reward if helpful
Regards
Byju