02-21-2008 6:20 AM
I hav one List box Status with values 'Open', 'Closed','Cancelled'.
If i retrieve data from Data base, suppose if Status = 'Open' in DB, My list value gets repeated like
'Open'
'Closed'
'Cancelled'
'Open' -
Repeated Value in the list
Blank data---Blank space comes here.
02-21-2008 6:24 AM
Hi Santhosh,
Try clearing your LISTBOX before you populate values onto it.
(If you are using VRM Type pool, clear the structure and variables before you populate).
Thanks
Anand D
02-21-2008 6:50 AM
Hai
U can use this code to solve ur list box prob.
TYPE-POOLS VRM.
DATA: IT_VRM TYPE VRM_VALUES,
WA_VRM LIKE LINE OF IT_VRM,
****populate the records********
WA_VRM-KEY = '1'.
WA_VRM-TEXT = '5'.
APPEND WA_VRM TO IT_VRM.
WA_VRM-KEY = '2'.
WA_VRM-TEXT = '10'.
APPEND WA_VRM TO IT_VRM.
WA_VRM-KEY = '3'.
WA_VRM-TEXT = '15'.
APPEND WA_VRM TO IT_VRM.
WA_VRM-KEY = '4'.
WA_VRM-TEXT = '20'.
APPEND WA_VRM TO IT_VRM.
WA_VRM-KEY = '5'.
WA_VRM-TEXT = '25'.
APPEND WA_VRM TO IT_VRM.
*******populate********************
/ if u have the data in the data base table means use select query to store the data in the internal table.***
/ here key is nothing but a serial number**
/ text is the value that u want to display in the text box**
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'DUR'
VALUES = IT_VRM
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
/ here DUR is the field name which is present in the screen**
/ IT_VRM is the internal table which is contain list box values**
regards
santi
Edited by: Santiago on Feb 21, 2008 7:51 AM
02-21-2008 7:51 AM
hi,
You just keep a flag and do it.
ex:
if c = 0.
select land1 landx from t005t into table wi_country.
sort wi_country by land1.
delete adjacent duplicates from wi_country comparing all fields.
loop at wi_country.
wa_ctry-key = wi_country-land1.
wa_ctry-text = wi_country-landx .
append wa_ctry to wi_ctry.
endloop.
call function 'VRM_SET_VALUES'
exporting
id = 'ZCUST_MASTER1-COUNTRY'
values = wi_ctry
exceptions
id_illegal_name = 1
others = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
c = 1.
endif.
hope this helps u,
Regards,
Sri
02-21-2008 9:15 AM
Thanku for ur reply.
But I am not getting the List Values from DB Table.
I hard coded in my program.
My scenario is
In create Mode I assigned Status = 'Open' and Saved the data.
(Here the list Values are not repeated)
In Change mode I retrieved status = 'Open' from DB table. Now I fill the Status List Values.
(Here i am getting Open Two times and a Blank Text)
Plz Help me!
My code is ,
In change Mode:
select STATUS from DB table
into Wa_zmmgp_h_d-ZZ_STATUS.
Perform FILL_LOV_STATUS.
ZZ_STATUS = Wa_zmmgp_h_d-ZZ_STATUS.
FORM FILL_LOV_STATUS .
DATA : it_LOV_STATUS TYPE VRM_VALUES.
DATA : WA_LOV_STATUS LIKE LINE OF it_LOV_STATUS.
WA_LOV_STATUS-KEY = 'OPEN'.
WA_LOV_STATUS-TEXT = 'Open'.
APPEND WA_LOV_STATUS TO it_LOV_STATUS.
Clear WA_LOV_STATUS.
WA_LOV_STATUS-KEY = 'CLOSED'.
WA_LOV_STATUS-TEXT = 'Closed'.
APPEND WA_LOV_STATUS TO it_LOV_STATUS.
Clear WA_LOV_STATUS.
WA_LOV_STATUS-KEY = 'CANCELLED'.
WA_LOV_STATUS-TEXT = 'Cancelled'.
APPEND WA_LOV_STATUS TO it_LOV_STATUS.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'ZZ_STATUS'
VALUES = it_LOV_STATUS.
Refresh it_LOV_STATUS.
Clear WA_LOV_STATUS.
ENDFORM.
02-21-2008 9:49 AM
02-21-2008 10:03 AM
02-21-2008 10:18 AM
Flag variable shold b a global one or local within that Form?
IN the FORM FILL_LOV_STATUS
In debug mode it_LOV_STATUS(itab) has only 3 records (Open, Closed and Cancelled).
and also i cleared itab and wa.
--I dont know where that DB value is repeated in the list.
Plz help me!