on 03-26-2007 3:44 PM
Hello,
Does anybody know, if there is a function module which can count the rows of a table without returning the rows? the rows should be selectable by conditions (where-clause).
RFC_READ_TABLE returns the whole result table and may be slow for big tables.
thank you,
alex
Have you looked at
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alexander,
you can use the function module + rfc_get_table_entries+.
Hint:
The default value for the parameter + NUMBER_OF_ENTRIES+ that are to be returned is 0.
Unless you don't want to read parts of the table entries you should not change this value.
The number of table entries is returned with the parameter + NUMBER_OF_ENTRIES+.
Best regards,
André
FUNCTION rfc_get_table_entries.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(BYPASS_BUFFER) LIKE SY-FTYPE DEFAULT SPACE
*" VALUE(FROM_KEY) LIKE SY-ENTRY DEFAULT SPACE
*" VALUE(GEN_KEY) LIKE SY-ENTRY DEFAULT SPACE
*" VALUE(MAX_ENTRIES) LIKE SY-TABIX DEFAULT 0
*" VALUE(TABLE_NAME) LIKE X030L-TABNAME
*" VALUE(TO_KEY) LIKE SY-ENTRY DEFAULT SPACE
*" EXPORTING
*" VALUE(NUMBER_OF_ENTRIES) LIKE SY-INDEX
*" TABLES
*" ENTRIES STRUCTURE TAB512
*" EXCEPTIONS
*" INTERNAL_ERROR
*" TABLE_EMPTY
*" TABLE_NOT_FOUND
*"----------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alex,
plese check <a href="http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_dwb/~form/handler{5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d313932333939}">SAP Note 192399 No authorization check in FG RFC1</a> and <a href="http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_dwb/~form/handler{5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d313039353333}">SAP Note 109533 Use of SAP function modules</a>.
The function module rfc_read_table_entries is not released for customers and it is not working correctly any more with current releases.
I assume you will have to write your own function module to achieve your task using
"Select count(*) From ... where ...".
Since you want to get the number of rows and use a select statement that contains non-key-fields please have in mind that this might cause a high load on your database server since such searches require a full table scan.
Best regards,
André
Hi,
Instead of using a FM, u can use 'DESCRIBE' statement to get the no of rows in any internal table.
For DB, "SELECT COUNT(*) from DB into lv" can be used.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.