‎2007 Jun 18 5:39 PM
Hi All,
Can Anybody let me know what this code is supposed to do and it shows me an error with the INDEX, so please help me out.
DATA: BEGIN OF T_KNVV OCCURS 0.
INCLUDE STRUCTURE KNVV.
DATA: END OF T_KNVV.
DATA: BEGIN OF T_KNC1 OCCURS 0.
INCLUDE STRUCTURE KNC1.
DATA: END OF T_KNC1.
LOOP AT T_KNVV.
SELECT * FROM KNC1
INTO T_KNC1
ORDER BY GJAHR DESCENDING.
READ table T_KNC1 INDEX = 1.
IF T_KNC1-GJAHR GT SO_GJAHR.
EXIT.
ELSE.
ENDIF.
ENDLOOP.
Thanks!!
‎2007 Jun 18 5:40 PM
<b>READ table T_KNC1 INDEX 1.</b>
Don't mention as INDEX = 1.
Reward if its useful.
Regards,
Sail
‎2007 Jun 18 5:47 PM
It says that the SELECT SINGLE statement cannot contain the clause ORDER BY.
‎2007 Jun 18 5:50 PM
If there is any SELECT SINGLE statement it will fetch only 1 record so there is no need to mention ORDER BY . If it throws an syntax error it is correct.
ORDER BY is nothing but SORT. If there is only 1 record then no need to sort it right
‎2007 Jun 18 5:57 PM
but waht i need is to select all the records and read the ones which meet the select criteria...
so how do i write it
‎2007 Jun 18 6:00 PM
1)Better put all the conditons in where conditon of select single statement.
2)Otherwise put all data into internal table & then filter it.
1st option is good.
Reward for useful answers.
Regards,
Sail
‎2007 Jun 18 6:03 PM
Hi,
DATA: BEGIN OF T_KNVV OCCURS 0.
INCLUDE STRUCTURE KNVV.
DATA: END OF T_KNVV.
DATA: BEGIN OF T_KNC1 OCCURS 0.
INCLUDE STRUCTURE KNC1.
DATA: END OF T_KNC1.
SELECT * FROM KNC1 INTO TABLE T_KNC1 for all entries in T_KNVV
where GJAHR GT SO_GJAHR
Regards
Sudheer