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

Dropdown list with selection screen.

Former Member
0 Likes
9,263

Hi All,

how can we use drop-down list with parameter or select-option at selection screen.please provide me the relevant code or FM for it.

Points Assured

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,631

Amardeep,

Follow the below link:

Amit.

6 REPLIES 6
Read only

Former Member
0 Likes
3,631

Hi Amardeep,

Pls. refer program rsdemo_dropdown_listbox.

Best regards,

Prashant

Read only

Former Member
0 Likes
3,632

Amardeep,

Follow the below link:

Amit.

Read only

Former Member
0 Likes
3,631

Hi,

If you are adding values company code that are in SAP tables then below code is applicable.

type-pools: vrm.
data: it_val type vrm_values,
      w_line like line of it_val.
parameters p_bukrs like t001-bukrs as listbox
           visible length 25 obligatory.

initialization.
  select bukrs butxt from t001 into (w_line-key, w_line-text).
    append w_line to it_val.
    check p_bukrs is initial.
    p_bukrs = w_line-key.
  endselect.

at selection-screen output.
  call function 'VRM_SET_VALUES'
       exporting
            id     = 'P_BUKRS'
            values = it_val.

end-of-selection.
  write: / 'Company Code:', p_bukrs.

Or if you need to add your own values to list box below code is applicable..

TYPE-POOLS: VRM.

DATA: NAME  TYPE VRM_ID,
      LIST  TYPE VRM_VALUES,
      VALUE LIKE LINE OF LIST.

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

AT SELECTION-SCREEN OUTPUT.

  NAME = 'PS_PARM'.
  
  VALUE-KEY = '1'.
  VALUE-TEXT = 'LINE 1'.
  APPEND VALUE TO LIST. 
  
  VALUE-KEY = '2'.
  VALUE-TEXT = 'LINE 2'.
  APPEND VALUE TO LIST.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      ID     = NAME
      VALUES = LIST.

This will surely help you.

Plz reward if useful.

Thanks,

Dhanashri.

Read only

Former Member
0 Likes
3,631

Hi,

Try like this:

TYPE-POOLS: VRM.

DATA: NAME TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

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

AT SELECTION-SCREEN OUTPUT.

NAME = 'PS_PARM'.

VALUE-KEY = '1'.

VALUE-TEXT = 'LINE 1'.

APPEND VALUE TO LIST. VALUE-KEY = '2'.

VALUE-TEXT = 'LINE 2'.

APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES' EXPORTING ID = NAME VALUES = LIST.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Regards,

Bhaskar

Read only

former_member202474
Contributor
0 Likes
3,631

Hi ,

U can write it as

PARAMETERS p_type TYPE but0id-type

AS LISTBOX VISIBLE LENGTH 30

DEFAULT 'value' .

        • Reward if useful *****

Regards,

Ruby.

Read only

Former Member
0 Likes
3,631

This message was moderated.