cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down list & Dynamic field population

Former Member
0 Kudos

Hi,

I have a module pool program (only 1 screen with values populated from table for initial display) to maintain user profile.

In that I am suppose to provide a drop down list for a field called 'Grade' (A1 to A10 grades etc). these grade values are to be handled manually,as they are not stored in any standard/Ztable. So how to go about providing a drop down list for this field with predefined value.

Now there is a second field on the module pool screen known as 'Designation', whos field is to be populated dynamically depending upon the value of 'Grade' field.

Say if from a drop down of 'Grade' user selects 'A1', then this 'Designation field should immediately change to 'Officer' ......like wise. Point to note is that the user can change the value if required....from say 'Officer' to 'Sr. Officer'........so here we only need to provide a default value based on input from 'Grade' field.

No events are are triggered on selection of a value from drop down list and also PAI has BDC and will be triggered on only 'save', 'back' button provided explicitly on the screen or 'enter' key option.

Awaiting for ur response, I was asked the same question in one of my recent interview.....and i said i have no idea....n now am facing the real scenario.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Here is the simple program to create the list box with your own values,

REPORT ZLIST.

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.

Here PS_PARM will have the value, based on this fill the second field

Regards

Sudheer

Former Member
0 Kudos

thanx sudheer....but how do we do it in module pool

I have posted this Q by mistake in this forum (wrong forum, as meant for Script n all). Have reposted the Q in ABAP General forum.

Message was edited by:

navin devda

former_member196280
Active Contributor
0 Kudos

see the below programs to fill the field with a valid listbox value, for example, in this program, I am building the listbox in the program and just assign P_FIELD a valid value from internal table'ivrm_values' . Create screen 100 and create a field call P_FIELD, make sure to select "ListBox" from the DropDown Field.

report zTEST_0001.

type-pools: vrm.

data: p_field(20) type c.

data: ivrm_values type vrm_values.

data: xvrm_values like line of ivrm_values.

data: name type vrm_id.

start-of-selection.

  • Set default value, before calling the screen

p_field = 'DEF'.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module status_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

name = 'P_FIELD'.

xvrm_values-key = 'ABC'.

xvrm_values-text = 'ABC'.

append xvrm_values to ivrm_values.

xvrm_values-key = 'DEF'.

xvrm_values-text = 'DEF'.

append xvrm_values to ivrm_values.

xvrm_values-key = 'GHI'.

xvrm_values-text = 'GHI'.

append xvrm_values to ivrm_values.

call function 'VRM_SET_VALUES'

exporting

id = name

values = ivrm_values.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module user_command_0100 input.

endmodule. " USER_COMMAND_0100 INPUT

Regards,

Sairam