2014 Jul 17 6:39 AM
Hi All,
i have a requirement that i have to fetch records only which are not started with special character i.e. '!'. So could you please do let me know how to write in select statement for this requirement.
Regards,
Jyotsna
2014 Jul 17 6:47 AM
Hi Jyotsna,
From which table which fields you have to fetch..
I think you can use the advantage of comparison statements
or you can refer the link below
Comparisons Between Character Strings and Byte Strings (SAP Library - ABAP Programming (BC-ABA))
Regards Ashwin kv
2014 Jul 17 6:49 AM
Hi,
Select <fldlst> into table <itab> from (dbtab) where fldname NP '!*'
2014 Jul 17 7:02 AM
Hi Somendra,
I'm afraid this is a wrong statement for this requirement.
You cannot use NP in select statement.
Sam
2014 Jul 17 7:05 AM
Hi Sam,
Yes Inplace of NP their will be Not Like as u have used , NP is used in Internal table while reading.
2014 Jul 17 7:09 AM
Hi,
Use like this.
SELECT <fields>
FROM <Table> INTO TABLE <IT Table>
WHERE <Field> NOT LIKE '!%'.
This will fetch the records which are not started with '!'.
Regards,
Pavan
2014 Jul 17 6:59 AM
Hi jyotsna,
SELECT *
FROM xxxx
into TABLE itab
WHERE xxxxx NOT LIKE '!%'.
if you have many special characters to exclude,you can use a range table.
data r_xxxxx type range of xxxxx with header line.
r_xxxxx-sign = 'I'.
r_xxxxx-option = 'NP'.
r_xxxxx-low = '!*'.
APPEND r_xxxxx.
r_xxxxx-low = '$*'.
APPEND r_xxxxx.
.......
SELECT *
FROM xxxx
INTO TABLE itab
WHERE xxxxx IN r_xxxxx.
But I don't think it's efficient way to fetch records...Maybe you can filter the data after fetching them with some criteria.
LOOP AT itab.
IF itab-xxxxx NOT IN r_xxxxx.
DELETE itab.
ENDIF.
....
ENDLOOP.
Thanks,
Sam
2014 Jul 17 7:05 AM
Hi jyotsna,
Use
Select *
from <db_table>
into table <int_table>
where field not like '!%'.
Regards
Yogendra Bhaskar