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(drop down box) issue

Former Member
0 Kudos
98

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.

5 REPLIES 5

Former Member
0 Kudos
72

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

Former Member
0 Kudos
72

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....

0 Kudos
72

Hi Murali,

it is the screen field name name only.i don't know what is going wrong.

in debugging also it is not returning any value.

rgds,

Hi.

Former Member
0 Kudos
72

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.

Former Member
0 Kudos
72

See standard demp Program

DEMO_DROPDOWN_LIST_BOX