‎2009 Jul 07 7:45 PM
Hi everybody,
I have a number (several thousands) of single values. This values must be inserted into the table lt_singelvalues. Now i want to use a SELECT statement with "IN" like the following example in order to get only values within lt_singlevalues:
SELECT * from mytable INTO lt_mytable
WHERE value IN lt_singlevalues
How can i create a table like lt_singlevalues in order to use "WHERE value IN lt_singlevalues"?
regards,
sid
Edited by: Sid on Jul 7, 2009 8:46 PM
‎2009 Jul 07 7:51 PM
You may define the table like this. But be advised there is a limitation to the number of single values that you can add to the table and use in the IN operator of a SELECT statement. The only work around for this is to use a RANGE between set numbers or incorporate an exclusion as well. I think the limit is between 750 and 900.
Types: Begin of t_sv,
sign(1) type c,
option(2) type c,
low(20) type c,
high(20) type c,
end of t_sv.
data: lt_singlevalues type table of t_sv.
data: ls_singlevalues like line of lt_singlevalues.
ls_singlevalues-sign = 'I'.
ls_singlevalues-option = 'EQ'.
ls_singlevalues-low = '1000'.
append ls_singlevalues to t_singlevalues.
ls_singlevalues-low = '2000'.
append ls_singlevalues to t_singlevalues.
ls_singlevalues-low = 3000'.
append ls_singlevalues to t_singlevalues.Also, the LOW and HIGH fields can be a specific type, like if you needed the length to be 30, you can modifiy it, but the SIGN and OPTION fields must be char 1, and char 2 fields respecfully.
Regads,
Rich Heilman
Edited by: Rich Heilman on Jul 7, 2009 2:52 PM
‎2009 Jul 07 7:50 PM
‎2009 Jul 07 7:51 PM
You may define the table like this. But be advised there is a limitation to the number of single values that you can add to the table and use in the IN operator of a SELECT statement. The only work around for this is to use a RANGE between set numbers or incorporate an exclusion as well. I think the limit is between 750 and 900.
Types: Begin of t_sv,
sign(1) type c,
option(2) type c,
low(20) type c,
high(20) type c,
end of t_sv.
data: lt_singlevalues type table of t_sv.
data: ls_singlevalues like line of lt_singlevalues.
ls_singlevalues-sign = 'I'.
ls_singlevalues-option = 'EQ'.
ls_singlevalues-low = '1000'.
append ls_singlevalues to t_singlevalues.
ls_singlevalues-low = '2000'.
append ls_singlevalues to t_singlevalues.
ls_singlevalues-low = 3000'.
append ls_singlevalues to t_singlevalues.Also, the LOW and HIGH fields can be a specific type, like if you needed the length to be 30, you can modifiy it, but the SIGN and OPTION fields must be char 1, and char 2 fields respecfully.
Regads,
Rich Heilman
Edited by: Rich Heilman on Jul 7, 2009 2:52 PM