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: 

Dropdown list box in selection screen

Former Member
12,879

Hello Expert,

I am creating a selection screen wherein I have to use drop-down list box for 3 fields. I want to get the current field on which the cursor is placed so that its drop down list will be displayed.I tried it using USER-COMMAND fcode option with parameters statement. But the control doesn't go to the AT SELECTION-SCREEN event when we click on a field for displaying its drop down.

How can I get the current parameter to display its dropdown?

Please help.Its urgent.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
1,530

Use the function module VRM_SET_VALUES to link a field on screen to a drop list.

Sample

* Parameter with listbox
  PARAMETERS: pdfopt AS LISTBOX VISIBLE LENGTH 30 MODIF ID pdf.

* Filling the list box
AT SELECTION-SCREEN OUTPUT.

  DATA: vrm_id TYPE vrm_id,
        vrm_values TYPE vrm_values,
        vrm_value LIKE LINE OF vrm_values.

  CLEAR vrm_value.
  APPEND vrm_value TO vrm_values.

  vrm_value-key = 'D'.
  vrm_value-text = text-100.
  APPEND vrm_value TO vrm_values.

  vrm_value-key = 'S'.
  vrm_value-text = text-101.
  APPEND vrm_value TO vrm_values.

  vrm_id = 'PDFOPT'.

  CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            id              = vrm_id
            values          = vrm_values
       EXCEPTIONS
            id_illegavrm_id = 1
            OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Regards

9 REPLIES 9

Former Member
0 Kudos
1,530

Hi Radhika,

Check the below code, this might get you the solution.

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.

<b>Saying thanks in SDN is by rewarding points,</b>

Kiran

Former Member
0 Kudos
1,530

Hi

Please use this method.

insert the value u wish to see in dropdown in this table itab_dropdown and call this method.

wa_dropdown-handle = '3'.

wa_dropdown-value = 'abc'.

APPEND wa_dropdown TO itab_dropdown.

CALL METHOD wa_grid->set_drop_down_table

EXPORTING

it_drop_down = itab_dropdown.

Hope this helps........

Regards,

ravish

raymond_giuseppi
Active Contributor
1,531

Use the function module VRM_SET_VALUES to link a field on screen to a drop list.

Sample

* Parameter with listbox
  PARAMETERS: pdfopt AS LISTBOX VISIBLE LENGTH 30 MODIF ID pdf.

* Filling the list box
AT SELECTION-SCREEN OUTPUT.

  DATA: vrm_id TYPE vrm_id,
        vrm_values TYPE vrm_values,
        vrm_value LIKE LINE OF vrm_values.

  CLEAR vrm_value.
  APPEND vrm_value TO vrm_values.

  vrm_value-key = 'D'.
  vrm_value-text = text-100.
  APPEND vrm_value TO vrm_values.

  vrm_value-key = 'S'.
  vrm_value-text = text-101.
  APPEND vrm_value TO vrm_values.

  vrm_id = 'PDFOPT'.

  CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            id              = vrm_id
            values          = vrm_values
       EXCEPTIONS
            id_illegavrm_id = 1
            OTHERS          = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Regards

0 Kudos
1,530

Hi Raymond,

In id = 'PDFOPT' , can u please specify what id PDFOPT?

0 Kudos
1,530

The name of the parameter for which the list box is to be filled.

Regards

0 Kudos
1,530

Hi,

The list box is to be filled for 3 parameters on selection screen.

When the user clicks on the parameter, that should be dynamically stored in a variable which then I will pass to the function module to display the list box.

0 Kudos
1,530

I don't know if it is possible, dropdown list must (<i>as far as I know</i>) be ready before sending the screen (in PBO)

You can use F4IF_INT_TABLE_VALUE_REQUEST in the AT SELECTION-SCREEN ON VALUE-REQUEST FOR (PROCESS ON VALUE-REQUEST) reading some values from the dynpro (DYNP_VALUES_READ) but i don't know a way to display the list in a dropdown list at this stage, in this function module.

With my opinion, you should to fill the three list box in initialization or PBO.

Regards

1,530

Thanks! Perfect example.

Former Member
0 Kudos
1,530

Hi radhika,

1. For getting a taste of list box,

just copy paste.

<b> (We don't require at selection screen for this)</b>

2.

REPORT abc.

TYPE-POOLS : vrm.

DATA : v TYPE vrm_values.

DATA : vw LIKE LINE OF v.

PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.

INITIALIZATION.

vw-key = '1'.

vw-text = 'Jan'.

APPEND vw TO v.

vw-key = '2'.

vw-text = 'Feb'.

APPEND vw TO v.

vw-key = '3'.

vw-text = 'Mar'.

APPEND vw TO v.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'A'

values = v

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

regards,

amit m.