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: 

Dropdownlist depending on parament value

Former Member
0 Kudos

Hi gurus,

I'm having parameter plant using that i'm getting data into a dropdown.When i'm giving value in plant after pressing 'Enter' button only data is coming in dropdownlist.If the user changes the value of plant and don't press "Enter' pervious values are there in dropdown.I want to get value in dropdown as soon as the user gives value for plant without press 'Enter' button.

can i use Usercommand.How?

This is my code :

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-023.

PARAMETERS : P_PLANT TYPE WERKS_D DEFAULT 'TKDS'.

SELECT-OPTIONS : S_DATE FOR SY-DATUM.

*ZHRSPLDUTY-FROM_DATE.

PARAMETERS: P_BTRTL(4) AS LISTBOX VISIBLE LENGTH 10.

  • USER-COMMAND ABC.

PARAMETERS: P_SELID(2) AS LISTBOX VISIBLE LENGTH 10.

  • USER-COMMAND ABC.

SELECTION-SCREEN END OF BLOCK B1.

***ListBox

AT SELECTION-SCREEN OUTPUT.

CHECK P_PLANT IS NOT INITIAL.

CLEAR LIST.

SELECT BTRTL AS KEY

BTEXT AS TEXT

INTO TABLE LIST

FROM T001P

WHERE WERKS = P_PLANT.

IF SY-SUBRC = 0.

NAME = 'P_BTRTL'.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = NAME

VALUES = LIST

EXCEPTIONS

ID_ILLEGAL_NAME = 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.

ENDIF.

Edited by: miriamjs on Aug 8, 2011 11:20 AM

2 REPLIES 2

former_member209703
Active Contributor
0 Kudos

Hi

As far as I know you can't do this using a Dropdown, because no selection-screen event is fired unless you hit ENTER. In this case if the first value is updated and the user tries to select a value from the drop-down list, no event is fired to place your code into.

Maybe you need to use a normal Search Help if you want to achieve this behaviour.

Regards.

Former Member
0 Kudos

Hi,

Try with the FM 'DYNP_VALUES_READ'. Use this FM in output event before select query & pass report name & screen no as input values , you will get all the screen fields with values in tables 'DYNFIELDS' . Then use read statement with your field to get the present value of that field.

Check the below code.

DATA: ISCR TYPE TABLE OF DYNPREAD WITH HEADER LINE

V_REPID = SY-REPID.

V_DYNNR = SY-DYNNR.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = V_REPID

DYNUMB = V_DYNNR

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = ISCR

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

INVALID_PARAMETER = 7

UNDEFIND_ERROR = 8

OTHERS = 9.

READ TABLE ISCR WITH KEY FIELDNAME = 'RQIDENT'.

IF ISCR-FIELDVALUE IS INITIAL.

CLEAR ISCR.

READ TABLE ISCR WITH KEY FIELDNAME = 'RQOWNER'.

IF ISCR-FIELDVALUE IS INITIAL.

V_RQOWNER = '%'. "ALL USERS

ELSE.

V_RQOWNER = ISCR-FIELDVALUE.

TRANSLATE V_RQOWNER USING '*%'.

ENDIF.

I hope this will help to solve your problem.

Regards,

S.Senthilkumar.