Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

List Box in Module Pool

Former Member
0 Kudos

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.

7 REPLIES 7

0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

could not solve the problem

Former Member
0 Kudos

did u try keeping a flag?

0 Kudos

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!