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: 

VRM_SET_VALUES --list box in module pool

Former Member
0 Kudos

Hi all,

i am using VRM_SET_VALUES in my dialog programming. this function module show the value which we hard in program (backgrond).But

what my user requirement is he will add new vale for the list box. how can i do it.

ex: list box have four value like

1 bus

2 car

3 van

4 bicycle

at the time of program run use add new list box details for the list box option like they are going to add

5 motor-cycle

how it is possible

4 REPLIES 4

former_member188685
Active Contributor
0 Kudos

with the vrm_set_values function it is not possible, but you may have to choose other option, that you can find it from command box, i feel there is some possibility.but i never tried it from my side.

Former Member
0 Kudos

Below example might give you an idea to handle your requirement:

TYPE-POOLS: vrm.
TABLES sscrfields.

PARAMETERS: p_values AS LISTBOX VISIBLE LENGTH 10.
PARAMETERS: p_key TYPE char40 DEFAULT '5',
            p_text TYPE char80 DEFAULT 'Motorcycle'.
SELECTION-SCREEN PUSHBUTTON /10(10) but USER-COMMAND abc.

DATA: i_val TYPE vrm_values,
      wa_val TYPE vrm_value.

AT SELECTION-SCREEN OUTPUT.
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'P_VALUES'
      values          = i_val
    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.

AT SELECTION-SCREEN.
  IF sscrfields-ucomm = 'ABC'.
    IF p_key IS INITIAL AND p_text IS INITIAL.
      MESSAGE e001(00) WITH 'Enter both Key and Text to add value'.
    ELSE.
      CLEAR: wa_val.
      wa_val-key = p_key.
      wa_val-text = p_text.
      APPEND wa_val TO i_val.
    ENDIF.
  ENDIF.


INITIALIZATION.
  CLEAR: wa_val.
  wa_val-key = 1.
  wa_val-text = 'Bus'.
  APPEND wa_val TO i_val.

  CLEAR: wa_val.
  wa_val-key = 2.
  wa_val-text = 'Car'.
  APPEND wa_val TO i_val.

  CLEAR: wa_val.
  wa_val-key = 3.
  wa_val-text = 'Van'.
  APPEND wa_val TO i_val.

  CLEAR: wa_val.
  wa_val-key = 4.
  wa_val-text = 'Bicycle'.
  APPEND wa_val TO i_val.

  MOVE 'Add Values' TO but.

Regards

Eswar

Former Member
0 Kudos

The answer is FM VRM_DELETE_VALUES

1. Drop a input field on your screen, named it 'LIST01'

2. Change its Dropdown attribute to Listbox with key

3. Change its Value List attribute which is in Program tabpage to A from program

4. Declare some global data objects in your TOP include


TYPE-POOLS VRM.
DATA: VALUES TYPE VRM_VALUES,
      VALUE TYPE VRM_VALUE.

5. In a PBO moudle add some code like


VALUE-KEY = '1'.
VALUE-TEXT = 'Car'.
APPEND VALUE TO VALUES.

...

VALUE-KEY = '4'.
VALUE-TEXT = 'Bicycle'.
APPEND VALUE TO VALUES.

IF (some_condition).
  VALUE-KEY = '5'.
  VALUE-TEXT = 'Motor-cycle'.
  APPEND VALUE TO VALUES.
ENDIF.

CALL FUNCTION 'VRM_DELETE_VALUES'
  EXPORTING
    id = 'LIST01'
  EXCEPTIONS
    ID_NOT_FOUND = 1.

CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    id                    = 'LIST01'
    values                = VALUES.

0 Kudos

hi ,

DATA: v_name TYPE vrm_id,

v_list TYPE vrm_values,

v_value TYPE vrm_value,

INITIALIZATION.

title = 'Infotype Type Selection ' . " frame title

text = 'Initial and Current Conversion'. " text for radio button1

text1 = 'PA Infotype Conversion'. " text for radio button2

text2 = 'OM Infotype Conversion'. " text for radio button3

*& populating list box1

CLEAR: v_name, v_value.

REFRESH v_list .

v_name = 'P1'.

v_value-key = '1'. v_value-text = 'Initial Conversion'.

APPEND v_value TO v_list .

v_value-key = '2'. v_value-text = 'Current Conversion'.

APPEND v_value TO v_list .

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = v_name

values = v_list.

Thanks and Regards .

Priyank dixit