Application Development and Automation 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: 
Read only

Populate value into dropdownlist

Former Member
0 Likes
1,070

Is it possible to populate value of a dropdownlist?

I will want what is inside my dropdownlist to have values according to this SQL statement.

-


Select distinct PROGRAM_ID from ZPROGRAM_TABLE

-


How am I suppose to do this? Any codes example?

9 REPLIES 9
Read only

Former Member
0 Likes
1,042

HI

This is correct like based on the import parameter, we can write the query and finally export the value.

Ex:-

select roledes into e_roledesc from zse_role where rolecd = i_rolecd.

endselect.

reward if help.

Read only

Former Member
0 Likes
1,042

check this it might give u some clue.

PARAMETERS P_PLANT TYPE STR AS LISTBOX VISIBLE LENGTH 10.

TYPE-POOLS: VRM.

DATA: T_PLANT type vrm_values.

INITIALIZATION.

APPEND '1000' TO T_PLANT.

APPEND '3200' TO T_PLANT.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_PLANT'

values = T_PLANT.

Read only

0 Likes
1,042

Can u explain what is STR and other parameters to me?

Read only

0 Likes
1,042

str is for type string.

its not necessary to give this type u can give ur own type also..its just a parameter definition...the thing to be noted is addition - as listbox.

p_plant is the parameter for which u want a listbox.

and declare any variable of type vrm_values (here it is t_plant),

this (t_plant) will hold all those values which u want to display in the dropdown.

Edited by: Kamini Rawat on Jan 28, 2008 5:48 AM

Read only

0 Likes
1,042

Use the below code.

TYPE-POOLS : VRM.

DATA : VAL TYPE VRM_VALUES.

DATA : DROPDOWN LIKE LINE OF VAL.

DROPDOWN-TEXT = 'Ticket Booking'.

APPEND DROPDOWN TO VAL.

DROPDOWN-TEXT = 'Electricity Bill Payment'.

APPEND DROPDOWN TO VAL.

DROPDOWN-TEXT = 'Telephone Bill Payment'.

APPEND DROPDOWN TO VAL.

DROPDOWN-TEXT = 'E-Shop'.

APPEND DROPDOWN TO VAL.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'CREDITUSAGE' /////// Your list box name.....

VALUES = VAL

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2.

Thanks

Anand D

Read only

Former Member
0 Likes
1,042

Try This code.

data: it_itab type standard table of vrm_value,

wa_itab type vrm_value.

DATA : K TYPE I VALUE 1.

select DISTINCT PROGRAM_ID from ZPROGRAM_TABLE

into table itab.

loop at itab.

clear wa_itab.

wa_itab-key = K .

wa_itab-text = itab-ename.

append wa_itab to it_itab.

K = K + 1.

endloop.

call function 'VRM_SET_VALUES'

exporting

id = 'L1' "Here use your input box name in which you need dropdown

values = it_itab

exceptions

id_illegal_name = 1

others = 2.

    • hERE L1 IS NAME OF THE LISTBOX

Read only

0 Likes
1,042

Where should I paste these codes at?

Read only

0 Likes
1,042

at pbo of the screen

Read only

0 Likes
1,042

I got an error when I put this codes:

-


data: itab type standard table of ZPROGRAM_TABLE WITH HEADER LINE,

wa_itab type ZPROGRAM_TABLE.

DATA : K TYPE I VALUE 1.

START-OF-SELECTION.

CALL SCREEN 1000.

----


  • MODULE STATUS_1000 OUTPUT

----


*

----


MODULE STATUS_1000 OUTPUT.

SET PF-STATUS 'SCREEN_1000'.

SET TITLEBAR 'TITLE_1000'.

select DISTINCT PROGRAM_ID from ZPROGRAM_TABLE

into table itab.

loop at itab.

clear wa_itab.

wa_itab-PROGRAM_ID = K .

wa_itab-PROGRAM_CODE = itab-PROGRAM_CODE.

append wa_itab to itab.

K = K + 1.

endloop.

call function 'VRM_SET_VALUES'

exporting

id = 'ZDROPDOWNLIST' "Here use your input box name in which you need dropdown

values = itab

exceptions

id_illegal_name = 1

others = 2.

ENDMODULE. "STATUS_1000 OUTPUT

-


Here is the link of how the error look like:

http://img529.imageshack.us/img529/9650/screenee6.png

Can someone tell me how to solve it and where is the error?