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

listbox

Former Member
0 Likes
1,456

When i select a value in a listbox,the values related to the selected value must be displayed in another listbox.

I am getting the values but only after pressing the enter key.i want the values without pressing the enter key.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,400

Use <b>user-command</b> field to trigger an event when the listbox is selected. See a sample 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<b> USER-COMMAND fcodex.</b>
data: i_spfli type spfli occurs 0 with header line.


PARAMETERS PQ_PARAM LIKE SPFLI-connid AS LISTBOX VISIBLE LENGTH 15
USER-COMMAND
fcodey.

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.
<b>  if sy-ucomm eq 'FCODEX'.</b>
    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.
    <b>IF SY-UCOMM NE 'FCODEX' OR SY-UCOMM NE 'FCODEY'.</b>      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.

10 REPLIES 10
Read only

Former Member
0 Likes
1,401

Use <b>user-command</b> field to trigger an event when the listbox is selected. See a sample 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<b> USER-COMMAND fcodex.</b>
data: i_spfli type spfli occurs 0 with header line.


PARAMETERS PQ_PARAM LIKE SPFLI-connid AS LISTBOX VISIBLE LENGTH 15
USER-COMMAND
fcodey.

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.
<b>  if sy-ucomm eq 'FCODEX'.</b>
    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.
    <b>IF SY-UCOMM NE 'FCODEX' OR SY-UCOMM NE 'FCODEY'.</b>      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.

Read only

0 Likes
1,400

Not in Exe program.

I want in module pool program.

Read only

0 Likes
1,400

HI

see this demo program

DEMO_DYNPRO_DROPDOWN_LISTBOX

regards

kishore

Read only

0 Likes
1,400

if u want values in the screen to be read with out pressing enter,

use the fn module

<b>DYNPRO_READ_VALUES</b> or <b>DYNPRO_FIELD_GET</b> WHICH WILL READ THE VALUES IN THE SCREEN

Message was edited by: Hymavathi Oruganti

Read only

0 Likes
1,400

Hi Suganya,

you have demo programs itself check them..

<b>DEMO_DYNPRO_DROPDOWN_LISTBOX</b>

<b>DEMO_DROPDOWN_LIST_BOX</b>

the above examples are module pool programs..

check out...

Regards

vijay

Read only

0 Likes
1,400

hi vijay,

After Pressing enter only i am getting the values.

without pressing i wnt the values.

Read only

0 Likes
1,400

Hi,

if you choose it from drop down you will get it,

But i don't know how you are doing, can you tell me..

it should be like this..

in PAI flow logic

PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0110.

PROCESS ON VALUE-REQUEST.
  FIELD: v_drop MODULE get_dropdown.

MODULE GET_DROPDOWN INPUT.
* populate listbox
  NAME = 'V_DROP'.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      ID     = NAME
      VALUES = LIST.
ENDMODULE.                 " get_dropdown  INPUT

Regards

vijay

Read only

Former Member
0 Likes
1,400

hi Suganya,

sample on your requirement

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.

regards'satesh

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,400

Hi,

Have you tried Wenceslaus G's code?It's working fine.

Read only

Former Member
0 Likes
1,400

Hi Suganya,

I suppose your requirement is when you click on a particular value, a new screen with another listbox should appear. This is how it works.

Consider a listbox whose function code is defined as LIST. The listbox name is MARA-MTART. so at runtime the list box will be populated with MTART values.

In the PAI event. do the following.

case sy-ucomm.

when 'LIST'.

call screen '200'.

endcase.

In the screen 200, you define another listbox with some other values.

This should work.

Regards,

Sylendra.