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: 

how to retrieve data according to Listbox?

Former Member
0 Kudos

Hi all :

I have a question about how to retrieve data according to Listbox.

  • add the value into the Listbox, now the listbox contained 2 values.

DATA: v_name TYPE vrm_id,

v_list TYPE vrm_values,

v_value LIKE LINE OF v_list.

v_name = p_parameter.

CASE p_parameter.

WHEN 'P_LTYP'.

v_value-key = 'A'.

v_value-text = 'Stock list'.

APPEND v_value TO v_list.

v_value-key = 'B'.

v_value-text = 'Reservation list'.

APPEND v_value TO v_list.

WHEN OTHERS.

ENDCASE.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = v_name

values = v_list.

  • now i want to retrieve data .

when the listbox is checked by first value, I want to

SELECT *

FROM A

..................

when the listbox is checked by second value , I want to

SELECT *

FROM B

......

So How can I do that ?

thanks in advace

Best Regard.

Nick

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos

Hi.Nick.

As per ur Logic the Key Values in the Listbox are the TABLE names in DDIC.

So in that case you can have a Dynamic SELECT to fetch the Data.

PARAMETERS: P_LIST TYPE <FIELD> AS LISTBOX VISIBLE LENGHT 30.

START-OF-SELECTION.

CASE P_LIST.

WHEN 'A'.

SELECT * FROM A

INTO TABLE ITAB_A.

WHEN 'B'.

SELECT * FROM A

INTO TABLE ITAB_A.

ENDCASE.

If this is not the solution then you need to paste the code..

Reward if Helpful.

7 REPLIES 7

Former Member
0 Kudos

Nick,

I did not understand your question. I have tested program ZAH_DYNAMIC_OO in my system which has list box for the parameter. In the selection screen, if i choose any value for the parameter, the parameter field contains the same. So you can use this parameter in a normal way in the program.

Can you please explain where are you facing the difficulty.

ashish

0 Kudos

Hi Ashish:

the problem is :

in the listbox , there are two values , one is "Stock Batch" , and the other is "Batch Reservation".

so when I choose the "Stock Batch" in the listbox, it will select * from table A.

when I choose the "Batch Reservation" in the listbox , it will select * from talbe B.

Nick

0 Kudos

I believe you have done coding to show a parameter with list box. Suppose the parameter name is P_PAR

Now here is the logic in start-of-selection.

if p_par = 'Stock Batch'.

select data from table A

elseif p_par = 'atch Reservation'.

select data from table B

endif.

0 Kudos

Hi Ashish:

I had tried in this way , but it doesn't work .

So do you have another way to do so ?

0 Kudos

I see the code you pasted says

v_value-text = 'Stock list'.

APPEND v_value TO v_list.

v_value-key = 'B'.

v_value-text = 'Reservation list'.

But one of the replies says

one is "Stock Batch" , and the other is "Batch Reservation".

Am i missing something here? Can you confirm?

0 Kudos

hi Ashish:

you are not missing . you pasted right.

varma_narayana
Active Contributor
0 Kudos

Hi.Nick.

As per ur Logic the Key Values in the Listbox are the TABLE names in DDIC.

So in that case you can have a Dynamic SELECT to fetch the Data.

PARAMETERS: P_LIST TYPE <FIELD> AS LISTBOX VISIBLE LENGHT 30.

START-OF-SELECTION.

CASE P_LIST.

WHEN 'A'.

SELECT * FROM A

INTO TABLE ITAB_A.

WHEN 'B'.

SELECT * FROM A

INTO TABLE ITAB_A.

ENDCASE.

If this is not the solution then you need to paste the code..

Reward if Helpful.