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

list box with default value

former_member194669
Active Contributor
0 Likes
913

Hi,

How to do list box with <b>default</b> value in <u>module pool screen</u>.

Thanks

aRs

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
475

It should be as easy as filling 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 it. Create screen 100 and create a field call P_FIELD, make sure to select "ListBox" from the DropDown Field.





report  zrich_0001.

type-pools: vrm.

<b>data: p_field(20) type c.</b>
data: ivrm_values type vrm_values.
data: xvrm_values like line of ivrm_values.
data: name type vrm_id.

start-of-selection.

<b>* Set default value, before calling the screen
  p_field = 'DEF'.</b>

  call screen 100.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

<b>  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.</b>

endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_0100 input.

endmodule.                 " USER_COMMAND_0100  INPUT

Regards,

Rich Heilman

Read only

Former Member
0 Likes
475

Hi,

Please check this demo program.

DEMO_DROPDOWN_LIST_BOX

DEMO_DYNPRO_DROPDOWN_LISTBOX

Regards,

Ferry Lianto