09-29-2007 4:31 AM
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
09-29-2007 6:32 AM
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.
09-29-2007 5:25 AM
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
09-29-2007 5:44 AM
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
09-29-2007 5:47 AM
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.
09-29-2007 5:52 AM
Hi Ashish:
I had tried in this way , but it doesn't work .
So do you have another way to do so ?
09-29-2007 5:57 AM
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?
09-29-2007 6:48 AM
09-29-2007 6:32 AM
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.