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: 

listbox handling

naveenvishal
Contributor
0 Kudos
108

ive appended the value-key set into listbox as:

select * from zda_sntype into table lt_zda_sntype.

name = 'PS_PARM'.

loop at lt_zda_sntype into wa_zda_sntype.

value-key = wa_zda_sntype-santyp.

value-text = wa_zda_sntype-txt30.

append value to list.

endloop.

call function 'VRM_SET_VALUES'

exporting

id = name

values = list.

lst_flg = 1.

endif.

HOW TO GET THE SELECTED VALUE, At runtime....????

1 ACCEPTED SOLUTION

Former Member
0 Kudos
77

hi,

Naveen

Try this code.

REPORT Z_LISTBOX.

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.

thanks

Dharmishta

8 REPLIES 8

praveen_hannu
Contributor
0 Kudos
77

Hi

Use this function module CIFIDYNP_VALUES_READ. it retrives the values

at runtime.

praveen_hannu
Contributor
0 Kudos
77

you can use this FM also DYNP_VALUES_READ

0 Kudos
77

not able to use DYNP_VALUES_READ,

kindly provide exmple.

sorry 4 d trouble.

Former Member
0 Kudos
78

hi,

Naveen

Try this code.

REPORT Z_LISTBOX.

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.

thanks

Dharmishta

Former Member
0 Kudos
77

Hi

Pls refer the sample code demo_dynpro_dropdown_listbox

Regards,

Renjith Michael.

Former Member
0 Kudos
77

Naveen,

DATA : dynnum TYPE sy-dynnr,

dynpro_values TYPE TABLE OF dynpread,

field_value LIKE LINE OF dynpro_values.

DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE.

PARAMETERS :p_mngrp LIKE viqmsm-mngrp AS LISTBOX VISIBLE LENGTH 9.

CLEAR : field_value, dynpro_values .

REFRESH : dynpro_values .

field_value-fieldname = 'P_MNGRP'.

APPEND field_value TO dynpro_values.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

translate_to_upper = 'X'

TABLES

dynpfields = dynpro_values.

READ TABLE dynpro_values INDEX 1 INTO field_value.

IF NOT field_value-fieldvalue IS INITIAL.

IF sy-subrc = 0 AND field_value-fieldvalue = 1.

field_value-fieldvalue = 'I&CSCR'.

ELSEIF sy-subrc = 0 AND field_value-fieldvalue = 2.

field_value-fieldvalue = 'I&CSCF'.

ENDIF.

ENDIF.

p_mngrp = field_value-fieldvalue.

Don't forget to reward if useful...

0 Kudos
77

im using DIALOG MODULE, its not getting the value selected..

0 Kudos
77

hi,

first write this in flow logic of screen after PAI.

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 which i have declared as list box

DATA : BEGIN OF ifmtp OCCURS 0,

form_type LIKE zform_track_mast-form_type,

END OF ifmtp.

reward if usefull...