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

creating list box and retriving data from database table.

Former Member
0 Likes
1,833

Hi all,

I need to create a list box on selection screen in a report and depends on the user input have to fetch data from a data base table.

please help me in acheving this,

thanks in advance,

usha.

Hello Usha,

SAP does not give you the opportunity to use LISTBOX with SELECT-OPTIONS. But may i ask you why do you want to use a listbox with SELEC-OPTIONS?

Can you not try standard F4 helps?

Plz revert back.

BR,

Suhas

6 REPLIES 6
Read only

Former Member
0 Likes
1,220

Try like this.......

 data : begin of it_kan1 occurs 0,
                    kunnr type kna1-kunnr,
                    name1 type kna1-name1,
                    end of it_kan1.

PARAMETERS p_kunnr TYPE kna1-kunnr
            AS LISTBOX VISIBLE LENGTH 20
                    DEFAULT '1'.

select kunnr
       name1 from kna1 into table it_kan1 where kunnr = p_kunnr.

Read only

Former Member
0 Likes
1,220

Hi,

Refer to the demo program RSDEMO_DROPDOWN_LISTBOX

Read only

Former Member
0 Likes
1,220

See this also,it will give you better solution


parameter : p_field(30) TYPE c AS LISTBOX VISIBLE LENGTH 20.

TYPE-POOLS: vrm.
DATA: name TYPE vrm_id,
          list     TYPE vrm_values,
          value LIKE LINE OF list.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field.

name = 'p_field'.

value = 'PLANT'.
APPEND value to list.

value = 'COUNTRY'.
APPEND value to list.

value = 'CODE'.
APPEND value to list.

CALL FUNCTION 'VRM_SET_VALUES'
  EXPORTING
    id                      = name
    values                  = list
 EXCEPTIONS
   ID_ILLEGAL_NAME   = 1
   OTHERS                  = 2
          .

Edited by: sekhar manda on Jun 5, 2009 2:16 PM

Read only

Former Member
0 Likes
1,220

Hi,

You can define like below.

PARAMETERS p_matnr like mara-matnr

AS LISTBOX VISIBLE LENGTH 20

DEFAULT '00000000000000001'.

You can fetch the value into databse table like where matnr = p_matnr. So p_matnr hold the value is 1.

let me know if you required further help

Regards

Thiru

Read only

0 Likes
1,220

Thanks for the answers ,

but I need to define a select-option instead of parameter..Is it possible.?

regards,

usha

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,220

Hello Usha,

SAP does not give you the opportunity to use LISTBOX with SELECT-OPTIONS. But may i ask you why do you want to use a listbox with SELEC-OPTIONS?

Can you not try standard F4 helps?

Plz revert back.

BR,

Suhas