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: 

how to populate values in listbox of a field?

Former Member
0 Kudos

HI all,

My requirement is : i have one filed , for that i have five values,

i want to display those five values in the list box. then i have to select one of them and based on this field i have to display few fields in table control .

here i am able to display the values in listbox but even i select any value , it showing the first vale only !!!!!!

please help me in this regard.

3 REPLIES 3

Former Member
0 Kudos

This is the way........

DATA: DYNFIELDS TYPE TABLE OF DYNPREAD WITH HEADER LINE.

DATA : L_PSPNR TYPE PROJ-PSPID,

L_WBSE TYPE PRPS-POSID.

PARAMETERS : P_BPO TYPE CKIS-EXTNR

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BPO.

DATA : BEGIN OF IT_BPO OCCURS 100,

BPO LIKE ZCKIS-BPO,

END OF IT_BPO.

DYNFIELDS-FIELDNAME = 'P_PSPNR'.

APPEND DYNFIELDS.

CLEAR DYNFIELDS.

DYNFIELDS-FIELDNAME = 'P_WBSE'.

APPEND DYNFIELDS.

CLEAR DYNFIELDS.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = DYNFIELDS

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

INVALID_PARAMETER = 7

UNDEFIND_ERROR = 8

DOUBLE_CONVERSION = 9

STEPL_NOT_FOUND = 10

OTHERS = 11.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

Rewards if satisfied

Thanks

Former Member
0 Kudos

Hi Sitaram

LIST BOX in SELECTION SCREEN

List Box is created in selection screen using PARAMETERS staement

with AS LISTBOX addition other attributes like VISIBLE LENGTH (width of listbox)

can be specified with the declaration.

PARAMETERS name(n) AS LISTBOX VISIBLE LENGTH n.

Here n is an integer and name is the name of parameter.

To populate the value list we use the FM VRM_SET_VALUES and the

selection screen event AT SELECTION-SCREEN OUTPUT is used to write the code to fill it.

VRM_SET_VALUES

The function module VRM_SET_VALUES is used to fill the value list associated with a List Box .This FM uses types which are declared in type group VRM. So

we should declare TYPE-POOLS VRM before using this FM.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = name of screen element ,it is of TYPE VRM_ID

VALUES = internal table containing values,of TYPE VRM_VALUES

Hope this info will help you.

Reward with Points if helpful

Regards

Karan Arya

Former Member
0 Kudos

hi,

use this code .... copy and use this code jst modify the values....

TYPE-POOLS : vrm.

DATA : int_list TYPE vrm_values.

DATA : int_values LIKE LINE OF int_list.

DATA : wf_vrm_id TYPE vrm_id.

PARAMETER : p_dtype(13) TYPE c AS LISTBOX VISIBLE LENGTH 15.

AT SELECTION-SCREEN OUTPUT.

  • To fill the list to be passed to the FM

wf_vrm_id = 'P_DTYPE'.

int_values-key = 'opt1'.

int_values-text = 'opt1'.

append int_values to int_list.

clear int_values.

int_values-key = 'opt2'.

int_values-text = 'opt2'.

append int_values to int_list.

clear int_values.

  • FM to populate the drop down box.

call function 'VRM_SET_VALUES'

exporting

id = wf_vrm_id

values = int_list.

reward points if useful.......:-)

and mark the post answered once ur problem is solved ....