I am selecting values from a table zexc_rec using the query
select * from zexc_rec into table it_ZEXC_REC
LIFNR in S_LIFNR and
DOCNO in S_DOCNO and
RDOCTYP in S_RDTYP and
DOCTYP EQ S_DOCTYP AND
DATE1 in S_DATE1 and
MATNR EQ S_MATNR.
Now I am having condition that I have to check whether any other row with same document no., same material no and document type as ' CT ' exist there in the table zexc_rec, if it is there then I have to select the row with the doctyp as ' CT' otherwise I have to select the row with doctype as 'CT1'.
Please suggest what modifications I should do?