Skip to Content
author's profile photo Former Member
Former Member

List Box in Module Pool

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Feb 21, 2008 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 07: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 09: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 09:49 AM

    could not solve the problem

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 10:03 AM

    did u try keeping a flag?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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!

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.