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: 

select-options as drop down list box

Former Member
0 Kudos

how can i make a select-option(with no interval) as drop down list box ? list box values should be filled from the values of the corresponding field from data dictionary table. For my report selection screen has 3 fields as list boxes and a date range, if user type only date ranges and execute, it should display corresponding records as an alv report., thats why i cant keep those fields as parameters, i need them as select-options.

8 REPLIES 8

koolspy_ultimate
Active Contributor
0 Kudos

Hi,

try this


 SELECT-OPTIONS : FKDAT FOR VBRK-FKDAT no intervals.
(or)
parameters: FKDAT like VBRK-FKDAT.

select options with f4 functionality


data: fkdat type vbrk-fkdat.
select-options: s_fkdat for fkdat.

Regards,

koolspy.

Former Member
0 Kudos

Hi see below thread

-

Former Member
0 Kudos

hi,

look at this documentation u ll have an idea....

http://www.sapfans.com/forums/viewtopic.php?f=31&t=326584

thanks,

chaitanya

Former Member
0 Kudos

List Box is created in selection screen using PARAMETERS staement

with AS LISTBOX addition other attributes like VISIBLE LENGTH (width of listbox)

can be specified with the declaration.

PARAMETERS name(n) AS LISTBOX VISIBLE LENGTH n.

Here n is an integer and name is the name of parameter.

To populate the value list we use the FM VRM_SET_VALUES and the

selection screen event AT SELECTION-SCREEN OUTPUT is used to write the code to fill it.

regards

Ajit

Edited by: ajitabap on Oct 3, 2011 11:33 AM

Former Member
0 Kudos

Hi,

You need to use module pool programming to display a list box. Select Input/Output field and set its drop down property.

OR

If you are using report program you need to implement the logic in this way,


PARAMETERS: LV_LIST TYPE VBRK-VBELN AS LISTBOX VISIBLE LENGTH 12.

0 Kudos

Hi,

I usually use another approach:

just use the parameters on the selection screen, select the data you need to an internal table but do not use the parameters as select condition in your query.

Filter the data you have collect later. using some condition like these:

IF PARAM1 is not initial.

DELETE itab WHERE field1 <> PARAM1.

ENDIF.

Regards,

Oki

Sandra_Rossi
Active Contributor
0 Kudos

Hi,

if user type only date ranges and execute, it should display corresponding records as an alv report., thats why i cant keep those fields as parameters, i need them as select-options.

But you could use a parameters, and define a local range (DATA ... TYPE RANGE OF...) that you fill from the parameters only if something has been entered in it, and do SELECT ... WHERE ... IN local range.

Or do you really want the user to be able to select several values in the list box field? (This is not possible to customize the standard selection criterion input dialog, so you'd have to create your own dialog, the easiest would be to use ALV, or to create a search help with a search help exit defining MULTISEL = 'X', and the values could be transferred, concatenated, separated by comma, in a protected field would be better...)

Sandra

koolspy_ultimate
Active Contributor
0 Kudos

Hi,

try this code

you can get your selection screen with no intervals and with drop down list


TYPE-POOLS: vrm.

DATA: gt_list     TYPE vrm_values.
DATA: gwa_list    TYPE vrm_value.
DATA: gt_values   TYPE TABLE OF dynpread,
      gwa_values  TYPE dynpread.

DATA: gv_selected_value(10) TYPE c.
*--------------------------------------------------------------*
*Selection-Screen
*--------------------------------------------------------------*
PARAMETERS: list TYPE c AS LISTBOX VISIBLE LENGTH 20.
*--------------------------------------------------------------*
*At Selection Screen
*--------------------------------------------------------------*
AT SELECTION-SCREEN ON list.
  CLEAR: gwa_values, gt_values.
  REFRESH gt_values.
  gwa_values-fieldname = 'LIST'.
  APPEND gwa_values TO gt_values.
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname             = sy-cprog
      dynumb             = sy-dynnr
      translate_to_upper = 'X'
    TABLES
      dynpfields         = gt_values.

  READ TABLE gt_values INDEX 1 INTO gwa_values.
  IF sy-subrc = 0 AND gwa_values-fieldvalue IS NOT INITIAL.
    READ TABLE gt_list INTO gwa_list
                      WITH KEY key = gwa_values-fieldvalue.
    IF sy-subrc = 0.
      gv_selected_value = gwa_list-text.
    ENDIF.
  ENDIF.
*--------------------------------------------------------------*
*Initialization
*--------------------------------------------------------------*
INITIALIZATION.
  gwa_list-key = '1'.
  gwa_list-text = 'Product'.
  APPEND gwa_list TO gt_list.
  gwa_list-key = '2'.
  gwa_list-text = 'Collection'.
  APPEND gwa_list TO gt_list.
  gwa_list-key = '3'.
  gwa_list-text = 'Color'.
  APPEND gwa_list TO gt_list.
  gwa_list-key = '4'.
  gwa_list-text = 'Count'.
  APPEND gwa_list TO gt_list.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'LIST'
      values          = gt_list
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
*--------------------------------------------------------------*
*Start of Selection
*--------------------------------------------------------------*
START-OF-SELECTION.
  WRITE:/ gv_selected_value.

Regards,

koolspy.