‎2007 Oct 04 6:48 AM
‎2007 Oct 04 6:49 AM
HI,
VRM stands for Value Request Manager.
<b>vrm_values is an internal table without header line.
vrm_value is a structure.(only one record it will hold)</b>
see this example.
TYPE-POOLS : vrm.
tables: bkpf.
<b>DATA : values TYPE vrm_values.
DATA : wa LIKE LINE OF vrm_value.</b>
PARAMETERS : list_box(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
PARAMETERS: dd type bkpf-BSTAT user-command abc.
select-options: a for bkpf-bukrs MODIF ID buk.
select-options: b for bkpf-belnr MODIF ID SEL.
at selection-screen output.
If list_box = 2.
loop at screen.
if screen-group1 = 'SEL'.
screen-input = 0.
modify screen.
endif.
endloop.
endif.
INITIALIZATION.
wa-key = '1'.
wa-text = 'Orange'.
APPEND wa TO values.
wa-key = '2'.
wa-text = 'Red'.
APPEND wa TO values.
wa-key = '3'.
wa-text = 'Blue'.
APPEND wa TO values.
wa-key = '4'.
wa-text = 'Gray'.
APPEND wa TO values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'LIST_BOX'
values = values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
rgds,
bharat.
‎2007 Oct 04 6:52 AM
Hi,
Check the below code.
TYPE-POOLS : vrm. "Value Request Manager
PARAMETERS: p_test AS LISTBOX VISIBLE LENGTH 12 OBLIGATORY.
INITIALIZATION.
PERFORM f4_value_request.
START-OF-SELECTION.
WRITE P_TEST.
&----
*& Form f4_value_request
&----
text
----
FORM f4_value_request.
DATA: l_name TYPE vrm_id,
li_list TYPE vrm_values,
l_value LIKE LINE OF li_list.
l_value-key = '1'.
l_value-text = 'January'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '2'.
l_value-text = 'February'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '3'.
l_value-text = 'March'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '4'.
l_value-text = 'April'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '5'.
l_value-text = 'May'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '6'.
l_value-text = 'June'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '7'.
l_value-text = 'July'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '8'.
l_value-text = 'August'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '9'.
l_value-text = 'September'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '10'.
l_value-text = 'October'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '11'.
l_value-text = 'November'.
APPEND l_value TO li_list.
CLEAR l_value.
l_value-key = '12'.
l_value-text = 'December'.
APPEND l_value TO li_list.
CLEAR l_value.
l_name = 'P_TEST'.
p_test = '1'. "this is to set the default value of the list box.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = l_name
values = li_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.
ENDFORM. " f4_value_request
‎2007 Oct 04 6:52 AM
hI BALAJI..
VRM is a Type Pool.
VRM_SET_VALUES
VRM_GET_VALUES
These are the Function modules to SET or GET the VALUES of a LISTBOX
Eg:
Which parameter should have the dropdown list?
field_for_dropdown = 'PA_URL'.
Fill two-column dropdown list
gs_values-key = c_intranet.
gs_values-text = 'Image from intranet'(se7).
APPEND gs_values TO gt_values.
gs_values-key = c_internet.
gs_values-text = 'Image from Internet'(se8).
APPEND gs_values TO gt_values.
Pass information to function module
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = field_for_dropdown
values = gt_values.
<b>REWARD IF HELPFUL.</b>
‎2007 Oct 04 7:04 AM
hi balaji,
in the fn module vrm_set_values,
VRM_VALUE is defined with types statement.
vrm_values ia table of type vrm_value.
so, the difference is one is a standard table and the other is a user defined datatype.
to use the user-defined datatype like the standard datatype in the same program, we can define the datatype with the types statement.
later that datatype can be reused .
TYPES:
*-- Single Value in Value Set
BEGIN OF VRM_VALUE,
KEY(40) TYPE C,
TEXT(80) TYPE C,
END OF VRM_VALUE,
*-- Table of Values
VRM_VALUES TYPE VRM_VALUE OCCURS 0,