‎2008 Jul 10 12:14 PM
Hi All,
I have created a list box in se51 and I have only two values for that. like "Internal and External" and I want to insert these values into the List box. Please help me how I can insert them.
Regards,
Srik
‎2008 Jul 10 12:19 PM
‎2008 Jul 10 12:21 PM
‎2008 Jul 10 12:20 PM
hi srik,
go throught this link,
here u get perfect example.
[perfect link|http://sap.niraj.tripod.com/id38.html]
regards,
sandeep
‎2008 Jul 10 12:21 PM
HI,
Please check this link i think this will solve this problem.
https://www.sdn.sap.com/irj/sdn/wiki
Thanks,
‎2008 Jul 10 12:23 PM
Hi,
Check this link with sample code.
[http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm]
Hope your problem will be solved.
Regards,
Anirban Bhattacharjee
‎2008 Jul 10 12:23 PM
Hi,
See the below coding...
TYPE-POOLS VRM.
DATA VALUES1 TYPE VRM_VALUES WITH HEADER LINE.
VALUES1-KEY = 'I'.
VALUES1-TEXT = 'INCH'.
APPEND VALUES1.
VALUES1-KEY = 'M'.
VALUES1-TEXT = 'MM'.
APPEND VALUES1.
VALUES1-KEY = 'C'.
VALUES1-TEXT = 'CM'.
APPEND VALUES1.
VALUES1-KEY = 'E'.
VALUES1-TEXT = 'METERS'.
APPEND VALUES1.
CLEAR VALUES1.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'CRTYPE'
VALUES = VALUES[]
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.
Hope it will usefull..
‎2008 Jul 10 12:27 PM
Hi,
Put this code in PBO.
Here replace po_name by screen field name and also the data declarations in top include.
PARAMETERS: po_name(30) TYPE c VISIBLE LENGTH 20 AS LISTBOX.
TYPE-POOLS: VRM.
DATA: i_values TYPE vrm_values,
wa_values LIKE LINE OF i_values.
wa_values-key = '1'.
wa_values-text = 'External'.
APPEND wa_values TO i_values.
wa_values-key = '2'.
wa_values-text = 'Internal'.
APPEND wa_values TO i_values.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'PO_NAME' "Screen field name
values = i_values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
And this code in PAI.
READ TABLE i_values INTO wa_values WITH KEY key = po_name.
MOVE wa_values-text TO w_name. " This will be ur actual value.
Thanks,
Vinod.
‎2008 Jul 10 12:55 PM
hI VINOD,
I am getting the error wa_values-key is not defined. checl ur spelling.. Pleas help me with this.
Regards,
Srik
‎2008 Jul 10 1:12 PM
Hi,
Where u r getting this error? Can u paste the piece of code where u r getting this error and also ur data declarations?Just double click on that error. It will show where u r grtting this error.
Declare wa_values and i_values in TOP include. Also refresh i_values table before appending in PBO module.
Thanks,
Vinod.
‎2008 Jul 10 1:18 PM
Hi,
Plz try this piece of code.
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.this will work.
plz reward if useful.
thanks,
dhanashri.