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

list box(drop down box) issue

Hi experts,

I have created a list box(drop down list in module-pool program).in that values are appearing in my list box.but, when i select a row from that list it is not standing in that field.

see the code.

TYPE-POOLS:vrm.
DATA:FIELD1(10),field2(10).
DATA:lines TYPE VRM_VALUE OCCURS 0,
     line TYPE vrm_value.
DATA:t_lfa1 TYPE TABLE OF lfa1 WITH HEADER LINE.
SET SCREEN 100.

MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MENU'.
*  SET TITLEBAR 'xxx'.
ENDMODULE.                 " STATUS_0100  OUTPUT

MODULE list_box_0100 OUTPUT.

  SELECT * from lfa1 into table t_lfa1 UP TO 10 rows.

  clear:lines[],line-key.
  loop at t_lfa1.
    line-key = line-key + 1.
    line-text = t_lfa1-name1.
    APPEND LINE to LINES.
  endloop.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      ID                    = 'FIELD1'
      VALUES                = lines.

ENDMODULE.                 " list_box_0100  OUTPUT

MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.
    WHEN 'BACK'.                 "Back
      set SCREEN 0.
    WHEN 'SEL'.
      MESSAGE I000(zmsg) with field1.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

flow logic for screen 100.

PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
 MODULE list_box_0100.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

regards,

Hi.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 08:01 AM

    Hi,

    Check the below code.

    &----


    *& Module STATUS_0100 OUTPUT

    &----


    • text

    ----


    MODULE STATUS_0100 OUTPUT.

    data: v_num type i value 1.

    SET PF-STATUS 'ZPF'. "zpf. "'xxxxxxxx'.

    • SET TITLEBAR 'xxx'.

    case sy-ucomm.

    when 'BACK'.

    set screen 0.

    Leave screen.

    endcase.

    type-pools vrm.

    data: v_id type vrm_id,

    i_list type vrm_values,

    wa_list like line of i_list.

    *v_id = 'P_LIST'.

    if v_num = 1.

    wa_list-key = '1'.

    wa_list-text = 'Hi'.

    append wa_list to i_list.

    wa_list-key = '2'.

    wa_list-text = 'Hello'.

    append wa_list to i_list.

    wa_list-key = '3'.

    wa_list-text = 'Great'.

    append wa_list to i_list.

    v_num = v_num + 1.

    endif.

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    id = 'LIST_BOX' "this is your list box name

    values = i_list

    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.

    ENDMODULE. " STATUS_0100 OUTPUT

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 08:02 AM

    Hi,

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING

    ID = 'FIELD1'

    VALUES = lines.

    In the above code the id value should be the your screen field name .Pls. check the name....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 09:38 AM

    Hi,

    my problem is solved. it is coming because of the statement line-key = line-key + 1.

    instead of i placed line-key = t_lfa1-lifnr.

    thanks for all the replies.

    rgds,

    Hi.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 11, 2008 at 10:43 AM

    See standard demp Program

    DEMO_DROPDOWN_LIST_BOX

    Add a comment
    10|10000 characters needed characters exceeded

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.