2007 Jul 25 4:04 PM
Friends,
Could you tell me the difference between below two select statements.
data : itab like ztab occurs 0 with header line.
1. SELECT * FROM ztab
INTO table itab
WHERE cust IN s_cust
AND shipdt IN s_date
AND Xflag NE 'Y'
AND status NE 'XX'
AND ddate LE gv_deldate
AND cflag EQ ' '.
2. SELECT * FROM ztab
WHERE cust IN s_cust
AND shipdt IN s_date
AND Xflag NE 'Y'
AND status NE 'XX'
AND ddate LE gv_deldate.
check ztab-cflag is initial.
move-corresponding ztab to itab.
append itab.
ENDSELECT.
I am looking up for a particular entry in the ztab but it would give me the result when i use the 2nd select statement. But i think both the statements should give the same results.
Thanks,
Dev
2007 Jul 25 4:47 PM
Hi,
Please try this.
SELECT * FROM ztab
INTO table itab
WHERE cust IN s_cust
AND shipdt IN s_date
AND Xflag NE 'Y'
AND status NE 'XX'
AND ddate LE gv_deldate
AND cflag IS initial. "Change here
Regards,
Ferry Lianto
depending on the type of field CFLAG the select statement may give you different result.... Both statement will give same result of CFLAG is of type CHAR with lenth 1
2007 Jul 25 4:16 PM
I do not see any diffrenece in both query's
data : itab like ztab occurs 0 with header line.
1. SELECT * FROM ztab
INTO table itab
WHERE cust IN s_cust
AND shipdt IN s_date
AND Xflag NE 'Y'
AND status NE 'XX'
AND ddate LE gv_deldate
AND cflag EQ <b>space</b>.
2. SELECT * FROM ztab
WHERE cust IN s_cust
AND shipdt IN s_date
AND Xflag NE 'Y'
AND status NE 'XX'
AND ddate LE gv_deldate.
check ztab-cflag is initial.
move-corresponding ztab to itab.
append itab.
ENDSELECT.
What is data type of cflag ?
sort the internal table and see the results.
Thanks
Seshu
2007 Jul 25 4:42 PM
cflag data type is 1 character in both cases.
I tried using space instead of ' ' in the select statement . It gives me result only when i use check statement.
2007 Jul 25 4:16 PM
depending on the type of field CFLAG the select statement may give you different result.... Both statement will give same result of CFLAG is of type CHAR with lenth 1
2007 Jul 25 4:47 PM
Hi,
Please try this.
SELECT * FROM ztab
INTO table itab
WHERE cust IN s_cust
AND shipdt IN s_date
AND Xflag NE 'Y'
AND status NE 'XX'
AND ddate LE gv_deldate
AND cflag IS initial. "Change here
Regards,
Ferry Lianto
2007 Jul 25 4:56 PM
It works when i use cflag is NULL. But would like to know the difference. Why would it not show up in case of 1st select stmt.
2007 Jul 25 4:54 PM
Hi,
Try this way
SELECT * FROM ztab
INTO table itab
WHERE cust IN s_cust
AND shipdt IN s_date
AND Xflag NE 'Y'
AND status NE 'XX'
AND ddate LE gv_deldate.
if sy-subrc eq 0.
delete ztab where cflag ne space.
endif.
aRs
2007 Jul 25 5:04 PM
Performance wise 2nd one is better..
though results will be same.
Reward if useful..
Regards
Prax
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |