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

Regarding List Box

Former Member
0 Likes
463

hi

experts..

can any one give a simple example for using of list box in a report..

thanks

Spandana

hi

experts..

can any one give a simple example for using of list box in a report..

thanks

Spandana

3 REPLIES 3
Read only

Former Member
0 Likes
428

hi

chk this thread:

check the sample program

DEMO_DYNPRO_DROPDOWN_LISTBOX.

regards,

madhumitha

Read only

Former Member
0 Likes
428

DEMO_DYNPRO_DROPDOWN_LISTBOX it is for screen program

and code below is for report program

type-pools: vrm.

data: name type vrm_id,

list type vrm_values,

value like line of list.

data : v_temp type werks.

types : begin of t_werks,

werks type werks,

end of t_werks.

data : wa_t001w type t001w.

data : wa_werks type t_werks.

data : it_werks type standard table of t_werks.

parameters: p_werks type werks as listbox visible length 50 obligatory.

parameters : p_obj1 as listbox visible length 100 obligatory default 'B'.

data p(4) type c value 0.

at selection-screen output .

clear list .

refresh list .

name = 'P_WERKS'.

select werks from t001w into table it_werks.

loop at it_werks into wa_werks.

p = p + 1.

value-key = p.

value-text = wa_werks-werks.

append value to list .

endloop.

call function 'VRM_SET_VALUES'

exporting

id = name

values = list.

name = 'P_OBJ1'.

clear list .

refresh list .

value-key = 'A'.

value-text = 'Object A'.

append value to list .

value-key = 'B'.

value-text = 'Object B'.

append value to list .

call function 'VRM_SET_VALUES'

exporting

id = name

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

start-of-selection.

set pf-status 'Z11_AP_CONTEXTMENU'.

loop at it_werks into wa_werks.

write:/ wa_werks.

endloop.

at user-command.

case sy-ucomm.

when 'PLANT'.

select name1 from t001w into wa_t001w-name1 where werks = v_temp.

write:/ wa_t001w-name1.

endselect.

when 'CANCEL'.

leave program.

endcase.

&----


*& Form on_ctmenu_request

&----


  • text

----


  • -->L_MENU text

----


form on_ctmenu_request using l_menu type ref to cl_ctmenu.

data lin type i.

get cursor line lin value v_temp.

if sy-lsind = 0.

call method l_menu->add_function

exporting

fcode = 'PLANT'

text = 'PLANT'.

endif.

call method l_menu->add_function

exporting

fcode = 'CANCEL'

text = 'CANCEL'.

endform. "on_ctmenu_request

demo program RSDEMO_DROPDOWN_LISTBOX is also for report program

reward if helpful

Read only

asik_shameem
Active Contributor
0 Likes
428

Hi

Try the following code.

REPORT abc.

TYPE-POOLS : VRM.

DATA : LIST TYPE VRM_VALUES,
       VALUE LIKE LINE OF LIST.

PARAMETERS: para(12) AS LISTBOX VISIBLE LENGTH 10 OBLIGATORY.

INITIALIZATION.

  VALUE-KEY = '1'.
  VALUE-TEXT = 'Annual'.
  APPEND VALUE TO LIST.
  VALUE-KEY = '2'.
  VALUE-TEXT = 'Quaterly'.
  APPEND VALUE TO LIST.
  VALUE-KEY = '3'.
  VALUE-TEXT = 'Monthly'.
  APPEND VALUE TO LIST.
  CLEAR value.
  CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            ID              = 'PARA'
            VALUES          = LIST.

  START-OF-SELECTION.

   READ TABLE LIST INTO VALUE WITH KEY key = para.
   para = VALUE-text.

write para.