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

Dynamic Listbox

Former Member
0 Likes
971

HI Everyone

I want the data in the ListBox to be filled based on the selection in the previous List Box.

how to achieve?

thanks

priya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
765

HI priya

here is the solution

TYPE-POOLS: VRM.

TABLES SPFLI.

TABLES SSCRFIELDS.

DATA flag.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

PARAMETERS PS_PARM LIKE SPFLI-CARRID AS LISTBOX VISIBLE LENGTH 10

USER-COMMAND

fcodex.

data: i_spfli type spfli occurs 0 with header line.

PARAMETERS PQ_PARAM LIKE SPFLI-connid AS LISTBOX VISIBLE LENGTH 15

USER-COMMAND

fcodey.

*DS AS CHECKBOX USER-COMMAND FLAG.

INITIALIZATION.

NAME = 'PS_PARM'.

DATA T TYPE I VALUE 0.

SELECT DISTINCT carrid into corresponding fields of table i_spfli FROM

SPFLI.

loop at i_spfli.

VALUE-KEY = i_spfli-CARRID.

VALUE-TEXT = i_spfli-CARRID.

APPEND VALUE TO LIST.

endloop.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

AT SELECTION-SCREEN.

if sy-ucomm eq 'FCODEX'.

REFRESH LIST.

CLEAR LIST.

PQ_PARAM = ' '.

NAME = 'PQ_PARAM'.

SELECT * FROM SPFLI WHERE CARRID = PS_PARM.

VALUE-KEY = SPFLI-connid.

VALUE-TEXT = SPFLI-connid.

APPEND VALUE TO LIST.

ENDSELECT.

endif.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SY-UCOMM NE 'FCODEX' OR SY-UCOMM NE 'FCODEY'.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

START-OF-SELECTION.

clear i_spfli.

refresh i_spfli.

select * into table i_spfli from spfli where carrid = ps_parm and connid

= pq_param.

loop at i_spfli.

WRITE: / 'CITY FROM:', I_SPFLI-CITYFROM, 'CITY TO :',I_SPFLI-CITYTO,

'DEPARTURE TIME :', I_SPFLI-DEPTIME.

ENDLOOP.

regards

kishore

4 REPLIES 4
Read only

Former Member
0 Likes
766

HI priya

here is the solution

TYPE-POOLS: VRM.

TABLES SPFLI.

TABLES SSCRFIELDS.

DATA flag.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

PARAMETERS PS_PARM LIKE SPFLI-CARRID AS LISTBOX VISIBLE LENGTH 10

USER-COMMAND

fcodex.

data: i_spfli type spfli occurs 0 with header line.

PARAMETERS PQ_PARAM LIKE SPFLI-connid AS LISTBOX VISIBLE LENGTH 15

USER-COMMAND

fcodey.

*DS AS CHECKBOX USER-COMMAND FLAG.

INITIALIZATION.

NAME = 'PS_PARM'.

DATA T TYPE I VALUE 0.

SELECT DISTINCT carrid into corresponding fields of table i_spfli FROM

SPFLI.

loop at i_spfli.

VALUE-KEY = i_spfli-CARRID.

VALUE-TEXT = i_spfli-CARRID.

APPEND VALUE TO LIST.

endloop.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

AT SELECTION-SCREEN.

if sy-ucomm eq 'FCODEX'.

REFRESH LIST.

CLEAR LIST.

PQ_PARAM = ' '.

NAME = 'PQ_PARAM'.

SELECT * FROM SPFLI WHERE CARRID = PS_PARM.

VALUE-KEY = SPFLI-connid.

VALUE-TEXT = SPFLI-connid.

APPEND VALUE TO LIST.

ENDSELECT.

endif.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SY-UCOMM NE 'FCODEX' OR SY-UCOMM NE 'FCODEY'.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

START-OF-SELECTION.

clear i_spfli.

refresh i_spfli.

select * into table i_spfli from spfli where carrid = ps_parm and connid

= pq_param.

loop at i_spfli.

WRITE: / 'CITY FROM:', I_SPFLI-CITYFROM, 'CITY TO :',I_SPFLI-CITYTO,

'DEPARTURE TIME :', I_SPFLI-DEPTIME.

ENDLOOP.

regards

kishore

Read only

0 Likes
765

HI

thanks kishore. it's working nicely.

thanks hymavathi.

points awarded.

thanks

priya

Read only

hymavathi_oruganti
Active Contributor
0 Likes
765

1.u can call VRM_SET_VALUES

2. FOR DYANAMIC, U CAN PASS VALUES INTO THE TABLE U PASS TO VRM_SET_VALUES BASED ON SELECTION CRITERIA

Read only

Former Member
0 Likes
765

Hi Priya,

Based on your selection of first list box you populate the values differently to VRM_SET_VALUES . this will show the values differently.

so for this you need to use

in case of executable program.

<b>at selection-screen on vlaue-request for p_field.</b>

if it is module pool.

you need to use Process on values Request.

i hope it is clear..

when you choose value from first drop down , you have that value with you, now based on that value fill the other listbox.

Regards

vijay