1

I want to display the keys in a dropdown field next to the text. I know how I can do this via the options but for our customers I am looking to set this up via my ABAP coding. Is there a way to do this in my ABAP code or does the customers set this by himself via the options?

Greetings Dominic

I looked for any setting in the VRM_SET_VALUES function and stuff like that.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
Dominic
  • 11
  • 1
  • are we talking about a selection screen or dynpro? In case of a selection screen, you can use the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR and then call the function module F4IF_INT_TABLE_VALUE_REQUEST to show the F4 help with custom entries. – Dirk Trilsbeek May 08 '23 at 11:26

1 Answers1

2

The listbox values may contain anything you want, you can simulate the option to force the display of key values... No need to look for a setting in VRM_SET_VALUES.

With the below program, according to the user's SAP GUI option "Show keys in dropdown list" whether it's on or off: SAP GUI option "Show keys in dropdown list"

If off, the user will see:

SAP GUI option "Show keys in dropdown list" = OFF

If on, the user will see the same output:

SAP GUI option "Show keys in dropdown list" = ON

Demo code:

REPORT zdemo.
PARAMETERS country(40) LOWER CASE OBLIGATORY AS LISTBOX VISIBLE LENGTH 40.
AT SELECTION-SCREEN OUTPUT.
  DATA(values) = VALUE vrm_values(
      ( key = 'FRA' text = 'France' )
      ( key = 'GER' text = 'Germany' ) ).
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'COUNTRY'
      values          = values
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
AT SELECTION-SCREEN.
  MESSAGE substring( val = country len = 3 ) TYPE 'I'.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48