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: 

LIST BOX

Former Member
0 Kudos
93

Hi,

I have created a screen and I place a text box and change the type into List Box. I have to display data in the list box.

The user should select the data from the list box then according to that we have to popup message.

How can add data to a list box ?

and how can i get the user has selected particular record ?

regards,

satya.

9 REPLIES 9

Former Member
0 Kudos
64

Hi,

Use FM VRM_SET_VALUES.

Check this sample code

In PBO write this code for your field

CLEAR wa_itab.

wa_itab-key = '1'.

wa_itab-text = '1'.

APPEND wa_itab TO it_itab.

wa_itab-key = '2'.

wa_itab-text = '2'.

APPEND wa_itab TO it_itab.

wa_itab-key = '3'.

wa_itab-text = '3'.

APPEND wa_itab TO it_itab.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'ZMATERIAL' "Here use your input box name in which you need dropdown

values = it_itab

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

see this sample demo program also DEMO_DROPDOWN_LIST_BOX

Regards,

Satish

Former Member
0 Kudos
64

Hi Satya,

Check the properties of the list box and then add the values in the PAI part of the screen for the list box and append the values.

Reward if Useful.

Thanks,

Anita

Former Member
0 Kudos
64

refer this program...

-


list box for p_pernr----


type-pools : VRM.

tables : pa0000.

parameters : p_pernr like pa0000-pernr as listbox visible length 10 obligatory.

initialization.

data: v_id type vrm_id,

i_list type vrm_values,

wa_list like line of i_list.

v_id = 'P_PERNR'.

wa_list-key = '1'.

wa_list-text = '10000174'.

append wa_list to i_list.

wa_list-key = '2'.

wa_list-text = '10000175'.

append wa_list to i_list.

wa_list-key = '3'.

wa_list-text = '10000176'.

append wa_list to i_list.

p_pernr = '2'. "to set default value 10000175

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = v_id

values = i_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.

----


----


populating list box for second field -

-----based on value selected in listbox for first field

reward if useful

regards

vivek

Former Member
0 Kudos
64

DATA: name TYPE vrm_id,

list TYPE vrm_values,

value LIKE LINE OF list.

AT SELECTION-SCREEN OUTPUT.

name = 'P_FRWD'.

value-key = '07'.

value-text = '7 weeks'.

APPEND value TO list.

value-key = '06'.

value-text = '6 weeks'.

APPEND value TO list.

value-key = '05'.

value-text = '5 weeks'.

APPEND value TO list.

value-key = '04'.

value-text = '4 weeks'.

APPEND value TO list.

value-key = '03'.

value-text = '3 weeks'.

APPEND value TO list.

value-key = '02'.

value-text = '2 weeks'.

APPEND value TO list.

value-key = '01'.

value-text = '1 week'.

APPEND value TO list.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list.

plz reward if useful

Former Member
0 Kudos
64

U can use FM : VRM_SET_VALUES

Check this thread for sample code.

Former Member
0 Kudos
64

Hi,

refer the demo program demo_dynpro_dropdown_listbox

Regards,

Renjith Michael.

former_member202957
Contributor
0 Kudos
64

Hi Satyanarayana,

In your flow logic write an event.

Process on value-request.

FIELD <b>ZTD_SUGG_DATA-ZZGRADE</b> MOUDLE VALUE_REQUEST.

In module value_request input.

SELECT FROM <DB TABLE > INTO CORRESPONDING FIELDS OF TABLE I_VALUE_TAB.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'ZZGRADE'

DYNPPROG = 'ZTDHRMOD_SUGGESTION_DATA_ENRTY'

DYNPNR = '0200'

DYNPROFIELD = 'ZTD_SUGG_DATA-ZZGRADE'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = I_VALUE_TAB

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

ENDIF.

Hope this will help you....

<b>reward if useful</b>

regards,

sunil kairam.

Former Member
0 Kudos
64

hi,

after declaring that field as list box... ( in attribute ) ,

write this after PAI in screen flow logic...

PROCESS ON VALUE-REQUEST.

FIELD ifmtp-form_type MODULE fm_drop.

MODULE fm_drop INPUT.

CLEAR ifmtp.

REFRESH ifmtp.

ifmtp-form_type = 'C'.

APPEND ifmtp.

ifmtp-form_type = 'F'.

APPEND ifmtp.

ifmtp-form_type = 'H'.

APPEND ifmtp.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'FORM_TYPE'

value_org = 'S'

TABLES

value_tab = ifmtp.

IF sy-subrc 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMODULE. " fm_drop INPUT

here ifmtp-form_type is my field of screen which i have declared as list box...

and u have to declare one internal table with this field in TOP Module...

DATA : BEGIN OF ifmtp OCCURS 0,

form_type LIKE zform_track_mast-form_type,

END OF ifmtp.

reward if usefull....

Former Member
0 Kudos
64

Hi,

Here is a simple program to understand the concept.

report y1.

type-pools : VRM.

data : name type vrm_id,

list type vrm_values,

value like line of list.

parameters : c(10) as listbox visible length 10.

at selection-screen output.

name = 'c'.

value-key = '1'.

value-text = 'line1'.

append value to list.

value-key = '2'.

value-text = 'line2'.

append value to list.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name

values = list

.

thanks,

mallika