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
575

Hi,

I have created 4 fields in the layout of a screen in dialog program.Can anyone tell me how to fill the list box values for a field in dialog program?

Regards,

Hema

5 REPLIES 5
Read only

Former Member
0 Likes
551

HI use FM

VRM_SET_VALUES

clear list. refresh list.

name = 'P'.

  • Data selection for listbox1

select tabname from dd02l into table it_names package size 100 .

endselect.

  • sort it_names ascending by tabname.

loop at it_names.

clear value.

value-key = it_names-tabname.

value-text = it_names-tabname.

append value to list.

endloop.

  • Set the values

call function 'VRM_SET_VALUES'

exporting

id = name

values = list.

reward if helpful

thanks

vivekanand

Read only

Former Member
0 Likes
551

Hi Hema,

Check this thread it will surely help you,

https://forums.sdn.sap.com/click.jspa?searchID=5276066&messageID=3851015

Thanks,

Reward If Helpful.

Read only

Former Member
0 Likes
551

Hello Hema,

Please go to SE38 -> program name "DEMO_DROPDOWN_LIST_BOX "...display

It is a simple SAP demo program for the same purpose as required by you

Pls check the code in the demo program...

first we create a drop down box and assign a function code to it in menu painter

in the demo program the function code assigned is "Selected"

so when we click the drop down..the function code is that assigned on the screen painter....

after the sy-comm is verfied we do a select

query and fill the internal table or fill the internal table as per our requirements

(Here we select the values needed for displaying in the drop down using a select )

SELECT carrid carrname

FROM scarr

INTO CORRESPONDING FIELDS OF TABLE itab_carrid.

Here we pass the field name as given on the screen and the internal table filled above

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'CARRID'

value_org = 'S'

TABLES

value_tab = itab_carrid

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

endif.

Pls check and revert....Reward if helpful

Regards

Byju

Read only

Former Member
0 Likes
551

hi,

try like this,

DATA: name TYPE vrm_id,

list TYPE vrm_values,

value LIKE LINE OF list.

value-id = 1.

value-key = 'Suresh'

APPEND value TO list.

value-id = 2.

value-key = 'Babu'

APPEND value TO list.

value-id = 3.

value-key = 'Aluri'

APPEND value TO list.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list.

ENDMODULE.

if helpful reward some points.

with regards,

Suresh Aluri.

Read only

Former Member
0 Likes
551

Hi,

Try like this:

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.

START-OF-SELECTION.

WRITE: / 'PARAMETER:', PS_PARM.

Regards,

Bhaskar