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 events

Former Member
0 Kudos

Hi,

I am using a List box in a table control. I have given the FCT code for the list. But on execution no values are retrieved in the list box from the database table.

Is there any event that can be given to the list box to retrieve the values from the database table?

Pls help.

16 REPLIES 16

Former Member
0 Kudos

Check this one... It retrieves values from DB

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.

Former Member
0 Kudos

HI Aarthi,

look at the following sample..

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.

this way you populate values from a db table..

regards

satesh

0 Kudos

Hi,

I tried with the above code. It doesnt seem to work. Is there any event for list box?

Thanks,

Former Member
0 Kudos

Hi Aarthi,

Refer to link:

<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/68/5eb441b0133531e10000000a155106/frameset.htm">http://help.sap.com/saphelp_erp2005/helpdata/en/68/5eb441b0133531e10000000a155106/frameset.htm</a>

OR

<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/d3/a37a8d047511d4a7400000e83dd863/frameset.htm">http://help.sap.com/saphelp_erp2005/helpdata/en/d3/a37a8d047511d4a7400000e83dd863/frameset.htm</a>

OR

<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/23/928b411fb4b05fe10000000a1550b0/frameset.htm">http://help.sap.com/saphelp_erp2005/helpdata/en/23/928b411fb4b05fe10000000a1550b0/frameset.htm</a>

Hope it helps...

Lokesh

pls. reward appropriate points

former_member188685
Active Contributor
0 Kudos

Hi arathi,

you need to use VRM_SET_VALUES to set the value for the table control list box field.

Regards

vijay

0 Kudos

hi Aarthi,

VRM_SET_VALUE will work..

its usage is already given ..

did you try it out..

regards

satesh

0 Kudos

VRM set values works. But once i select any item from the list no event gets triggered in the PAI.

0 Kudos

Hi Aarti,

Did you set the user command paramter in

PARAMETERS PS_PARM LIKE SPFLI-CARRID AS LISTBOX VISIBLE LENGTH 10

<b>USER-COMMAND fcodex</b>.

If you had set this AT SELECTION SCREEN event gets triggered.

0 Kudos

HI

try this code

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.

<b>second listbox populates based on the first listbox selected.</b>

regards

kishore

Message was edited by: Harikishore Sreenivasulu

0 Kudos

It has been set.Still it doesnt work.

0 Kudos

Hi,

Then can you post your code...

0 Kudos

HI aarthi

it perfectly working in my code.

can you post your code.

regards

kishore

0 Kudos

hi aarthi,

did you set the FUNCTION CODE for the drop down ,and click the check box respond to double click also.

Regards

vijay

Former Member
0 Kudos

hi Vijay,

I tried with that too.

0 Kudos

Hi aarhi,

are you handling that Fcode in your PAI.

please show your PAI.

Regards

vijay

0 Kudos

check out this Demo program

DEMO_DYNPRO_DROPDOWN_LISTBOX

and the associated screen (to see the fcode assignment) to understand how it works.

Regards

Raja