‎2008 May 13 6:10 PM
Hi,
it is not possible to use a select quiry at internal tables.
I would like determine the number of person with a where
condition at an internal table. How does it work ?
I cant say :
select count( * ) from xxx into xxxxxxx
where xx= xx.
What else can I do ?
Regards
ertas
‎2008 May 13 7:11 PM
Rather than loop through the table you could try this.
Your table is itab1. Define a temporary table, itab2, of the same type. NOTE: neither table with header lines. cond is the condition you want the records to meet.
itab2 = itab1.
DELETE itab2 WHERE NOT cond.
no_of_recs_meeting_cond = lines( itab2 ).Not terribly memory efficient, but it could be a little quicker than looping.
matt
‎2008 May 13 6:11 PM
hi check this..
PARAMETERS: p_carrid TYPE sbook-carrid,
p_connid TYPE sbook-connid.
TYPES: BEGIN OF sbook_type,
fldate TYPE sbook-fldate,
smoker TYPE sbook-smoker,
smk_cnt TYPE i,
END OF sbook_type.
DATA sbook_tab TYPE TABLE OF sbook_type.
SELECT fldate smoker COUNT( * ) AS smk_cnt
FROM sbook
INTO CORRESPONDING FIELDS OF TABLE sbook_tab
WHERE connid = p_connid
GROUP BY carrid fldate smoker
HAVING carrid = p_carrid
ORDER BY fldate smoker
regards,
venkat
‎2008 May 13 6:15 PM
‎2008 May 13 6:21 PM
Hi,
Use a normal select.
The system variable sy-dbcnt has the number of records from last select statement.
Regards,
Fernando
‎2008 May 13 6:22 PM
Hello.
Make queries to internal tables it's not possible.
In your specific case, to know the number of rows with a specific WHERE condition, you can do it this way:
- LOOP at itab WHERE condition ...
- after the loop check variable sy-tabix: it return how many lines where found.
Best regards.
Valter Oliveira.
‎2008 May 13 7:11 PM
Rather than loop through the table you could try this.
Your table is itab1. Define a temporary table, itab2, of the same type. NOTE: neither table with header lines. cond is the condition you want the records to meet.
itab2 = itab1.
DELETE itab2 WHERE NOT cond.
no_of_recs_meeting_cond = lines( itab2 ).Not terribly memory efficient, but it could be a little quicker than looping.
matt
‎2008 May 13 7:19 PM