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

Former Member
0 Likes
1,322

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

10 REPLIES 10
Read only

Former Member
0 Likes
1,198

Please help me with the above request

Read only

0 Likes
1,198

You can use FM :

VRM_SET_VALUES

VRM_GET_VALUES

Read only

Former Member
0 Likes
1,198

hi srik,

go throught this link,

here u get perfect example.

[perfect link|http://sap.niraj.tripod.com/id38.html]

regards,

sandeep

Read only

Former Member
0 Likes
1,198

HI,

Please check this link i think this will solve this problem.

https://www.sdn.sap.com/irj/sdn/wiki

Thanks,

Read only

Former Member
0 Likes
1,198

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

Read only

Former Member
0 Likes
1,198

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

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,198

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.

Read only

Former Member
0 Likes
1,198

hI VINOD,

I am getting the error wa_values-key is not defined. checl ur spelling.. Pleas help me with this.

Regards,

Srik

Read only

0 Likes
1,198

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.

Read only

Former Member
0 Likes
1,198

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.