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: 

Dropdown list with selection screen.

Former Member
0 Kudos
8,217

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

Former Member
0 Kudos
2,585

Amardeep,

Follow the below link:

Amit.

6 REPLIES 6

former_member223537
Active Contributor
0 Kudos
2,585

Hi Amardeep,

Pls. refer program rsdemo_dropdown_listbox.

Best regards,

Prashant

Former Member
0 Kudos
2,586

Amardeep,

Follow the below link:

Amit.

Former Member
0 Kudos
2,585

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.

Former Member
0 Kudos
2,585

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

former_member202474
Contributor
0 Kudos
2,585

Hi ,

U can write it as

PARAMETERS p_type TYPE but0id-type

AS LISTBOX VISIBLE LENGTH 30

DEFAULT 'value' .

        • Reward if useful *****

Regards,

Ruby.

Former Member
0 Kudos
2,585

This message was moderated.