2010 Apr 26 3:02 PM
Hi,
I have to select data from mara using different selection parameters coming from TVARVC but I do not know how to do.
SELECT matnr
FROM mara
WHERE matnr in r_matnr
AND mtart in r_mtart.But the users must be able to add or to suppress fields from the where clause. The fields and there values will be in the table TVARVC.
LOOP AT TVARVC
Here must I create ranges from different types to put the values in... (How to do this?)
fieldname (eg MATNR)
fieldvalue (eg MATERIAL-0001)
=> where clause
ENDLOOP
SELECT matnr
FROM MARA
(where).Thanks
2010 Apr 26 4:24 PM
the only way is to create several select-options with the values of the clause WHERE fields, so the user can add o not data to those select options.
Hi,
I have to select data from mara using different selection parameters coming from TVARVC but I do not know how to do.
SELECT matnr
FROM mara
WHERE matnr in r_matnr
AND mtart in r_mtart.But the users must be able to add or to suppress fields from the where clause. The fields and there values will be in the table TVARVC.
LOOP AT TVARVC
Here must I create ranges from different types to put the values in... (How to do this?)
fieldname (eg MATNR)
fieldvalue (eg MATERIAL-0001)
=> where clause
ENDLOOP
SELECT matnr
FROM MARA
(where).Thanks
2010 Apr 26 4:24 PM
the only way is to create several select-options with the values of the clause WHERE fields, so the user can add o not data to those select options.
2010 Apr 26 5:46 PM
After a discussion, we decide to change the rules.
We decide to write the where clause in SQL It should be simplier but...
DATA : w_where(60) TYPE c.
LOOP AT tvarvc.
....
CONCATENATE tvarvc-low
INTO w_where.
...
ENDLOOP.
(w_where: MTART = TEST; i tried MTART = "TEST")
SELECT matnr
INTO TABLE t_marx
FROM mara
WHERE (w_where).This simple code dump... I try to have MTART = 'TEST' but same result.
Why?
Edited by: David31 on Apr 26, 2010 6:58 PM
2010 Apr 26 6:35 PM
Hi,
You should have tried with MTART = 'TEST' instead of "TEST". Observe the quotes!!!
Check below sample code.
DATA: i_mara TYPE TABLE OF mara,
w_where TYPE string.
CONCATENATE 'MTART =' '''TEST''' INTO w_where SEPARATED BY space. "Look at the quotes
SELECT * INTO TABLE i_mara
FROM mara
WHERE (w_where).
WRITE sy-subrc.Check F1 help for more details.
Subject line confused me little bit. It is where clause instead of selection clause:-)
Thanks,
Vinod.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |