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 in parameters ?

Former Member
0 Likes
7,894

hi,

i know that i can produce drop-down-parameter in sel. screen with:

PARAMETERS..................AS LISTBOX........................

well, i have on problem:

i have one parameter MONTH. there i want to select the 12 month (TEXT of month like january, february, march................) in the dropdown and ONLY this month !

as default i want to set the last month (from sy-date).

how to archive this ?

reg, Martin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,732

create Data element in that data element create Domain

In that domain in VALU RANGE u can specify ur values

& use that DATA ELEMENT in ur program

Then it will act as drop down list

It will work for u

Regards,

Swarup

9 REPLIES 9
Read only

Former Member
0 Likes
3,732

create a datatype in se11 where you enter all the months as predefined values. refer to this type in the selection screen.

kind regards

arthur de smidt

Read only

0 Likes
3,732

isn't there a sap-standard for it ? i think i am not the first person who needs this

Read only

0 Likes
3,732

HI,

TRY THIS EXAMPLE..

type-pools:vrm.

PARAMETERS: PNAM AS LISTBOX VISIBLE LENGTH 30.

data:name TYPE VRM_ID,

LIST TYPE VRM_VALUES,

VALUE LIKE LINE OF LIST.

AT SELECTION-SCREEN OUTPUT.

NAME = 'PNAM'.

VALUE-KEY = '1'.

VALUE-TEXT = 'JANUARY'.

APPEND VALUE TO LIST.

VALUE-KEY = '2'.

VALUE-TEXT = 'FEBRUARY'.

APPEND VALUE TO LIST.

VALUE-KEY = '3'.

VALUE-TEXT = 'MARCH'.

APPEND VALUE TO LIST.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = NAME

values = LIST

EXCEPTIONS

ID_ILLEGAL_NAME = 1

OTHERS = 2

Regards,

venkat n

Read only

Former Member
0 Likes
3,732

try this code



TYPE-POOLS : vrm.


INITIALIZATION.  


v_name = 'MONTH'.   " MONTH must be a parameter name....
  wa_value-key = 'JAN' .
  APPEND wa_value TO i_list.
  wa_value-key = 'FEB' .
  APPEND wa_value TO i_list.
  wa_value-key = 'MAR' .
  APPEND wa_value TO i_list.
...................
  wa_value-key = 'DEC' .
  APPEND wa_value TO i_list.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = v_name
      values = i_list.

Read only

Former Member
0 Likes
3,733

create Data element in that data element create Domain

In that domain in VALU RANGE u can specify ur values

& use that DATA ELEMENT in ur program

Then it will act as drop down list

It will work for u

Regards,

Swarup

Read only

0 Likes
3,732

thank you,

but why to create a 'own' data element for that issue ? there has to be sap-standard ?!?

reg, Martin

Read only

0 Likes
3,732

okay, now i have found out:

p_monat TYPE month AS LISTBOX VISIBLE LENGTH 20.

so far so good. how is it possible now to enter a default value here which is

always the actual month - 1.

reg, Martin

Read only

0 Likes
3,732

b'caoz after that u can use it anywhere in other object

Or else create dynamic list in INITIALIZATION.

but it is always better to go with VALUE RANGE

Read only

Former Member
0 Likes
3,732

Pl. see this code. May be it will help u.

&----


*& Report ZTEST_HL6

*&

&----


*&

*&

&----


REPORT ZTEST_HL6.

data: l_date type sydatum,

l_mon(2) type n.

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.

initialization.

l_date = sy-datum.

l_mon = l_date+4(2).

l_mon = l_mon - 1.

case l_mon.

when '01'.

PS_PARM = '1'.

when '02'.

PS_PARM = '2'.

when '03'.

PS_PARM = '3'.

when '04'.

PS_PARM = '4'.

when '05'.

PS_PARM = '5'.

when '06'.

PS_PARM = '6'.

when '07'.

PS_PARM = '7'.

when '08'.

PS_PARM = '8'.

when '09'.

PS_PARM = '9'.

when '10'.

PS_PARM = '10'.

when '11'.

PS_PARM = '11'.

when '12'.

PS_PARM = '12'.

endcase.

NAME = 'PS_PARM'.

VALUE-KEY = '1'. VALUE-TEXT = 'January'.

APPEND VALUE TO LIST.

VALUE-KEY = '2'. VALUE-TEXT = 'February'.

APPEND VALUE TO LIST.

VALUE-KEY = '3'. VALUE-TEXT = 'March'.

APPEND VALUE TO LIST.

VALUE-KEY = '4'. VALUE-TEXT = 'April'.

APPEND VALUE TO LIST.

VALUE-KEY = '5'. VALUE-TEXT = 'May'.

APPEND VALUE TO LIST.

VALUE-KEY = '6'. VALUE-TEXT = 'June'.

APPEND VALUE TO LIST.

VALUE-KEY = '7'. VALUE-TEXT = 'July'.

APPEND VALUE TO LIST.

VALUE-KEY = '8'. VALUE-TEXT = 'August'.

APPEND VALUE TO LIST.

VALUE-KEY = '9'. VALUE-TEXT = 'September'.

APPEND VALUE TO LIST.

VALUE-KEY = '10'. VALUE-TEXT = 'October'.

APPEND VALUE TO LIST.

VALUE-KEY = '11'. VALUE-TEXT = 'November'.

APPEND VALUE TO LIST.

VALUE-KEY = '12'. VALUE-TEXT = 'December'.

APPEND VALUE TO LIST.

AT SELECTION-SCREEN OUTPUT.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Regards,

Joy.