‎2009 Aug 28 10:38 AM
Hi All,
I need to retrieve numerical data's from the database. Data base table has both numerical and text values. now I want to retrieve only numerical data's.
Can any one help me on this,
Thanks and helps will be appreciated.
‎2009 Aug 28 10:46 AM
Hi,
try this:
SELECT ... WHERE field_name CO '0123456789'.Hope it helps.
Regards,
David
‎2009 Aug 28 10:45 AM
Hi,
Check if this works
select *
from dbtable
into itab
where NOT field1 like '% A% B% C% D% E% F% G% H% I% J% K% L% M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z %'.
Regards,
Vikranth
‎2009 Aug 28 11:11 AM
Hi Vikranth,
I tried your code.
select *
from dbtable
into itab
where NOT field1 like '% A% B% C% D% E% F% G% H% I% J% K% L% M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z %'.
But it shows error like 'Like operator should be no mor than 8 characters long'..
Thanks.
‎2009 Aug 28 11:26 AM
Hi,
Try to split the where and see. Some thing like this.
select *
from ztable
into TABLE itab
where NOT ztable like '% A% B%' AND NOT ztable like 'C% D% E' AND NOT ztable like '% F% G%' AND NOT ztable like 'H% I% J'
AND NOT ztable like '% K% L' AND NOT ztable like '% M% N' AND NOT ztable like '% O% P' AND NOT ztable like '% Q% R'
AND NOT ztable like '% S% T' AND NOT ztable like '% U% V' AND NOT ztable like '% W% X' AND NOT ztable like '% Y% Z %'.Thanks,
Sri.
‎2009 Aug 28 11:28 AM
Hi,
did you try like this ?
SELECT * FROM database INTO t_inter WHERE field1 = crit1.
LOOP AT t_inter into w_intern WHERE field1 CO '0123456789'.
....
ENDLOOP.or
LOOP AT t_inter into w_intern.
CHECK w_intern-field1 CO '0123456789'
....
ENDLOOP.Regards,
David
‎2009 Aug 28 11:29 AM
Hi Nandini,
Try like this
data: begin of itab occurs 0,
f1 like T591S-SUBTY,
end of itab.
select subty
into table itab
from t591s
where NOT subty like '%A%B%C%' and
NOT subty like '%F%G%H%' and
NOT subty like '%K%L%M%' and
NOT subty like '%P%Q%R%' and
NOT subty like '%U%V%W%' and
NOT subty like '%E%J%O%' and
NOT subty like '%y%Z&'.
I must have missed 1 or 2 alphabets. Include them and check. It works
Regards,
Vik
‎2009 Aug 28 10:45 AM
Hi,
You requirement is not clear at all. Kindly mention the table and field to be retrived.
TC
Sajimon Chandran
‎2009 Aug 28 10:46 AM
Hi,
try this:
SELECT ... WHERE field_name CO '0123456789'.Hope it helps.
Regards,
David
‎2009 Aug 28 10:51 AM
Hi Experts,
Thanks for your valuable replies.
Table is T591S and field name is SUBTY.
I Used CO operator. But it throws error like "CO" is not a valid comparison operator. .
Thanks.
‎2009 Aug 28 10:56 AM
Hi,
You cannot use CO CA CP operators in where conditions of select statement directly.
Try the solution given by Dzed. It should work
Regards,
Vik
‎2009 Aug 28 10:59 AM
Hello
Working code:
data: itab like T591S occurs 0.
RANGES: R_SUBTY for T591S-SUBTY.
R_SUBTY-SIGN = 'I'.
R_SUBTY-OPTION = 'BT'.
R_SUBTY-LOW = '0'.
R_SUBTY-HIGH = '9999'.
APPEND R_SUBTY.
SELECT * FROM T591S INTO TABLE ITAB WHERE SUBTY IN R_SUBTY.
‎2009 Aug 28 11:02 AM
Hi Dzed Maroz,
Thanks for the Effort. But i need to write this code with in the method of class.
In ABAP Objects we cannot use Ranges addition. Anyway thanks for your effort.
Thanks.
‎2009 Aug 28 11:04 AM
Hi,
sorry for the mistake.
You can select all your data and then use the CO operator into your LOOP statement (i.e. with a CHECK )
Regards,
David
‎2009 Aug 28 11:05 AM
But you can use
DATA: R_SUBTY TYPE RANGE OF T591S-SUBTY.and also use a separate work area.
Thomas
‎2009 Aug 28 11:30 AM
Hello
As say Thomas you can declare:
DATA: R_SUBTY TYPE RANGE OF T591S-SUBTY.
*" instead of
RANGES: R_SUBTY for T591S-SUBTY.
It will be work.
P.s. In the future immediately elaborate that you are working with classes.
‎2009 Aug 28 10:47 AM
Hello
Try this scenario (example for MARA-MATNR):
* declare RANGES for value
RANGES: R_MATNR for MARA-MATNR.
* fill RANGES by numeric values
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'BT'.
R_MATNR-LOW = '000000000000000000'.
R_MATNR-HIGH = '999999999999999999'.
APPEND R_MATNR.
* select data
SELECT * FROM MARA INTO TABLE ITAB WHERE MATNR IN R_MATNR.
‎2009 Aug 28 10:52 AM
‎2009 Aug 28 11:33 AM
Hi Nandini,
the following code works according to ur requirement.......
types : begin of type_itab,
subty type t591s-subty,
end of type_itab.
data: w_subty type t591s-subty.
data: itab type table of type_itab with header line.
data: w_idx like sy-tabix.
select distinct subty
from t591s
into table itab.
if sy-subrc eq 0.
loop at itab.
w_idx = sy-tabix.
if itab ca sy-abcde.
delete itab index w_idx.
endif.
endloop.
clear itab.
endif.
Regards,
Mdi.Deeba