11-18-2005 3:48 AM
Hi,
I have selection screen with two list boxes.
I am populating the second based on the selection in the first one.
But, when I'm selecting a value from the second one, it is not reflected in the program, it means it value is blank.
Please go thro' the following code, n give ur suggestions.
IF list IS INITIAL.
Retrive Remarks from ZLOT007
SELECT remarks bukrs FROM zlot007 INTO TABLE it_ftp_tar.
name = 'FTP_TAR'.
count = 1.
Populating list box 1
LOOP AT it_ftp_tar.
value-text = it_ftp_tar-remarks.
value-key = count.
APPEND value TO list.
count = count + 1.
ENDLOOP.
Function to load data into list box
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list.
ENDIF.
If FTP setting field is not initial
IF ftp_tar IS NOT INITIAL AND list1 IS INITIAL.
READ TABLE it_ftp_tar INDEX ftp_tar.
CONDENSE it_ftp_tar-bukrs.
l_bukrs = it_ftp_tar-bukrs.
Fetching Plant belongs to the Company code
SELECT bukrs bwkey FROM t001k INTO TABLE it_werks
WHERE bukrs = l_bukrs.
name = 'P_WERKS'.
count = 1.
Populating list box 2 for Plant
LOOP AT it_werks.
value-text = it_werks-werks.
value-key = count.
APPEND value TO list1.
count = count + 1.
ENDLOOP.
function to load data into list box
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = name
values = list1.
ENDIF.
CLEAR it_werks.
CONDENSE p_werks.
<i>READ TABLE it_werks INDEX p_werks.
CONDENSE it_werks-werks.
l_werks = it_werks-werks.</i>
Thanks,
Senthil
11-18-2005 4:07 AM
Hi Senthilkumar,
Have a look at demo program DEMO_DROPDOWN_LIST_BOX.
Thanks
Lakshman
11-18-2005 4:12 AM
Hi,
Here is the sample code.
TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
PARAMETERS: ps_parm(10) AS LISTBOX VISIBLE LENGTH 10.
AT SELECTION-SCREEN OUTPUT.
name = 'PS_PARM'.
value-key = 'Line 1'.
value-text = 'Line 1'.
APPEND value TO list.
value-key = 'Line 2'.
value-text = 'Line 2'.
APPEND value TO list.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING id = name
values = list.
START-OF-SELECTION.
WRITE: / 'Parameter selected in List box:', ps_parm.
Kindly reward points if it helps.
11-18-2005 8:01 AM
When Ever u select u will have only one value.
U can directly use the field name and get the value.
Regards
vijay