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

Populating list box

Former Member
0 Likes
865

Hello all,

We have a requirement where in a list box should contain only certain specific values, but currently the listbox is getting populated using the values from data dictionary as it refers to the domain which has a value table assigned.

We have incorporated a part of the code calling a function module VRM_SET_VALUES and had passed the selected values only to this. But this seems to be not working. Still the list box contains all the values for the field from the database table. Can anyone please let us know how to go about this.

Thanks in advance.

Regards,

trinath

Hello all,

We have a requirement where in a list box should contain only certain specific values, but currently the listbox is getting populated using the values from data dictionary as it refers to the domain which has a value table assigned.

We have incorporated a part of the code calling a function module VRM_SET_VALUES and had passed the selected values only to this. But this seems to be not working. Still the list box contains all the values for the field from the database table. Can anyone please let us know how to go about this.

Thanks in advance.

Regards,

trinath

5 REPLIES 5
Read only

dani_mn
Active Contributor
0 Likes
794

HI,

don't refer the list box field to that data element. use some other refereing data element. which don't have a domain with value table. and then use 'VRM_SET_VALUES' to populate the list box with values you required.

REgards,

Read only

Former Member
0 Likes
794

Hi,

Just put your data to List box.

Here the sample code:


TYPE-POOLS: VRM.
DATA: VRM_VALUE  TYPE VRM_VALUE,
      VRM_VALUES TYPE VRM_VALUE OCCURS 5,
      VEXPORTID  TYPE VRM_VALUE-TEXT .

*Input Values to List Box
   REFRESH VRM_VALUES.
   VRM_VALUE-KEY  = '1'.
   VRM_VALUE-TEXT = 'MALE'.
   APPEND VRM_VALUE TO VRM_VALUES.
   VRM_VALUE-KEY  = '2'.
   VRM_VALUE-TEXT = 'FEMALE'.
   APPEND VRM_VALUE TO VRM_VALUES.
   VEXPORTID = 'P_SEX'.
   CALL FUNCTION 'VRM_SET_VALUES'
     EXPORTING
       ID              = VEXPORTID
       VALUES          = VRM_VALUES
     EXCEPTIONS
       ID_ILLEGAL_NAME = 1
       OTHERS          = 2.

Regards,

Read only

Former Member
0 Likes
794

Hi Trinath,

I think ur decleration variable is refering some data base table fields,

eg, Parameters : kunnr like kna1-kunnr as listbox

visible length 10.

u have to declare the variable using the data elements.

declare like,

parameters: kunnr AS LISTBOX VISIBLE length 10.

decleare like this.

if it is usefull dont forget to give an point.

Read only

anversha_s
Active Contributor
0 Likes
794

hi venkata,

chk this.

Check the link to know how to populate values as a LIST(drop down list)

here is the sample piece of code,

PROGRAM zlist.

TYPE-POOLS : VRM.

DATA: param TYPE vrm_id,

values TYPE vrm_values,

value LIKE LINE OF values.

PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

param = 'P_NAME'.

value-key = '1'.

value-text = 'NAME1'.

APPEND value TO values.

value-key = '2'.

value-text = 'NAME2'.

APPEND value TO values.

*--and so onnn

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = param

values = values.

rgds

anver

if helped mark points

Read only

Former Member
0 Likes
794

use SELECT statement to get your values into ITAB.

then

use LOOP and ENDLOOP to populate values to that LIST BOX.

PROGRAM zlist.

TYPE-POOLS : VRM.

DATA: param TYPE vrm_id,

values TYPE vrm_values,

value LIKE LINE OF values.

PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

<b> LOOP AT ITAB.</b>

param = 'P_NAME'.

value-key = SY-TABIX.

value-text = ITAB-MATNR.

APPEND value TO values.

<b>ENDLOOP.</b>

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = param

values = values.

This way all the values FROM ITAB will be displayed for that field.